Skip to content

Commit 933cbf1

Browse files
authored
Merge pull request #10 from gravity-ui/add-workflow
feat: add github workflow
2 parents f7dc146 + bd204ec commit 933cbf1

File tree

5 files changed

+135
-0
lines changed

5 files changed

+135
-0
lines changed

.github/workflows/ci.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
verify_files:
11+
name: Verify Files
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v2
16+
with:
17+
fetch-depth: 0
18+
- name: Setup Node
19+
uses: actions/setup-node@v2
20+
with:
21+
node-version: '14.x'
22+
cache: 'npm'
23+
- name: Install Packages
24+
run: npm ci
25+
- name: Lint Files
26+
run: npm run lint
27+
- name: Typecheck
28+
run: npm run typecheck
29+
- name: Typecheck (React 18)
30+
run: |
31+
npm i --no-save @types/react@18 @types/react-dom@18
32+
npm run typecheck
33+
34+
# TODO add tests
35+
# tests:
36+
# name: Tests
37+
# runs-on: ubuntu-latest
38+
# steps:
39+
# - name: Checkout
40+
# uses: actions/checkout@v2
41+
# with:
42+
# fetch-depth: 0
43+
# - name: Setup Node
44+
# uses: actions/setup-node@v2
45+
# with:
46+
# node-version: '14.x'
47+
# cache: 'npm'
48+
# - name: Install Packages
49+
# run: npm ci
50+
# - name: Unit Tests
51+
# run: npm run test

.github/workflows/main-preview.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Main Preview
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
jobs:
8+
main:
9+
name: Build and Deploy
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v2
14+
with:
15+
fetch-depth: 0
16+
- name: Setup Node
17+
uses: actions/setup-node@v2
18+
with:
19+
node-version: 14
20+
- name: Install Packages
21+
run: npm ci
22+
shell: bash
23+
- name: Build Storybook
24+
run: npx build-storybook
25+
shell: bash
26+
env:
27+
TS_NODE_PROJECT: .storybook/tsconfig.json
28+
- name: Upload to S3
29+
uses: gravity-ui/preview-upload-to-s3-action@v1
30+
with:
31+
src-path: storybook-static
32+
dest-path: /page-constructor/main/
33+
s3-key-id: ${{ secrets.STORYBOOK_S3_KEY_ID }}
34+
s3-secret-key: ${{ secrets.STORYBOOK_S3_SECRET_KEY }}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: PR Preview Build
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
build:
8+
name: Build
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: gravity-ui/preview-build-action@v1
12+
env:
13+
TS_NODE_PROJECT: .storybook/tsconfig.json
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: PR Preview Deploy
2+
3+
on:
4+
workflow_run:
5+
workflows: ['PR Preview Build']
6+
types:
7+
- completed
8+
9+
jobs:
10+
deploy:
11+
name: Deploy
12+
if: >
13+
github.event.workflow_run.event == 'pull_request' &&
14+
github.event.workflow_run.conclusion == 'success'
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: gravity-ui/preview-deploy-action@v1
18+
with:
19+
project: page-constructor
20+
github-token: ${{ secrets.GRAVITY_UI_BOT_GITHUB_TOKEN }}
21+
s3-key-id: ${{ secrets.STORYBOOK_S3_KEY_ID }}
22+
s3-secret-key: ${{ secrets.STORYBOOK_S3_SECRET_KEY }}

.github/workflows/release.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
jobs:
8+
release:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: gravity-ui/release-action@v1
12+
with:
13+
github-token: ${{ secrets.GRAVITY_UI_BOT_GITHUB_TOKEN }}
14+
npm-token: ${{ secrets.GRAVITY_UI_BOT_NPM_TOKEN }}
15+
node-version: 14

0 commit comments

Comments
 (0)