Skip to content

Commit

Permalink
ci: setup github actions (#250)
Browse files Browse the repository at this point in the history
  • Loading branch information
d3m1d0v authored May 31, 2024
1 parent c4da6bd commit 8f0271b
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 66 deletions.
53 changes: 32 additions & 21 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,42 @@ name: CI

on:
push:
branches: [master]
branches: [main]
pull_request:
branches: [master]

jobs:
verify_files:
name: Verify Files
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: '18.x'
cache: 'npm'
- name: Install Packages
run: npm ci
- name: Lint Files
run: npm run lint
- name: Tests
run: npm run test
- name: Test esbuild compatability
run: npm run test:esbuild
- name: Typecheck
run: npm run typecheck
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18
cache: npm
- name: Install Packages
run: npm ci
- name: Lint Files
run: npm run lint
- name: Typecheck
run: npm run typecheck

tests:
name: Tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18
cache: npm
- name: Install Packages
run: npm ci
- name: Unit Tests
run: npm run test
- name: ESBuild compatability
run: npm run test:esbuild
13 changes: 6 additions & 7 deletions .github/workflows/main-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,30 @@ name: Main Preview

on:
push:
branches: [master]
branches: [main]

jobs:
main:
name: Build and Deploy
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: 18
cache: npm
- name: Install Packages
run: npm ci
shell: bash
- name: Build Storybook
run: npm run storybook:build
shell: bash
- name: Upload to S3
uses: yandex-cloud/ui-preview-upload-to-s3-action@main
uses: gravity-ui/preview-upload-to-s3-action@v1
with:
src-path: storybook-static
dest-path: /yfm-editor/main/
dest-path: /md-editor/main/
s3-key-id: ${{ secrets.STORYBOOK_S3_KEY_ID }}
s3-secret-key: ${{ secrets.STORYBOOK_S3_SECRET_KEY }}
32 changes: 3 additions & 29 deletions .github/workflows/pr-preview-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,6 @@ jobs:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: 18
- name: Install Packages
run: npm ci
shell: bash
- name: Build Storybook
run: npm run storybook:build
shell: bash
- name: Create Static Artifact
uses: actions/upload-artifact@v2
with:
name: static
path: ./storybook-static
- name: Save PR ID
run: |
pr="${{ github.event.pull_request.number }}"
echo $pr > ./pr-id.txt
shell: bash
- name: Create PR Artifact
uses: actions/upload-artifact@v2
with:
name: pr
path: ./pr-id.txt
- uses: gravity-ui/preview-build-action@v1
with:
node-version: 18
6 changes: 3 additions & 3 deletions .github/workflows/pr-preview-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ jobs:
github.event.workflow_run.conclusion == 'success'
runs-on: ubuntu-latest
steps:
- uses: yandex-cloud/ui-preview-deploy-action@main
- uses: gravity-ui/preview-deploy-action@v1
with:
project: yfm-editor
github-token: ${{ secrets.YC_UI_BOT_GITHUB_TOKEN }}
project: md-editor
github-token: ${{ secrets.GRAVITY_UI_BOT_GITHUB_TOKEN }}
s3-key-id: ${{ secrets.STORYBOOK_S3_KEY_ID }}
s3-secret-key: ${{ secrets.STORYBOOK_S3_SECRET_KEY }}
17 changes: 11 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
name: Release

on:
push:
branches: [master]

name: release
branches:
- main
- release/v*

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: yandex-cloud/ui-release-action@main
- name: Release from ${{ github.ref_name }}
uses: gravity-ui/release-action@v1
with:
github-token: ${{ secrets.YC_UI_BOT_GITHUB_TOKEN }}
npm-token: ${{ secrets.YC_UI_BOT_NPM_TOKEN }}
github-token: ${{ secrets.GRAVITY_UI_BOT_GITHUB_TOKEN }}
npm-token: ${{ secrets.GRAVITY_UI_BOT_NPM_TOKEN }}
node-version: 18
default-branch: ${{ github.ref_name != 'main' && github.ref_name || null }}
npm-dist-tag: ${{ github.ref_name != 'main' && 'untagged' || 'latest' }}

0 comments on commit 8f0271b

Please sign in to comment.