Skip to content

Commit 43c6635

Browse files
committed
ci: add github workflows for preview
1 parent 99ba382 commit 43c6635

File tree

5 files changed

+77
-2
lines changed

5 files changed

+77
-2
lines changed

.github/workflows/main-preview.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Main Preview
2+
3+
on:
4+
push:
5+
branches: [master]
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: npm run storybook:build
25+
shell: bash
26+
- name: Upload to S3
27+
uses: yandex-cloud/ui-preview-upload-to-s3-action@main
28+
with:
29+
src-path: storybook-static
30+
dest-path: /yfm-editor/main/
31+
s3-key-id: ${{ secrets.STORYBOOK_S3_KEY_ID }}
32+
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: yandex-cloud/ui-preview-build-action@main
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: yandex-cloud/ui-preview-deploy-action@main
18+
with:
19+
project: yfm-editor
20+
github-token: ${{ secrets.YC_UI_BOT_GITHUB_TOKEN }}
21+
s3-key-id: ${{ secrets.STORYBOOK_S3_KEY_ID }}
22+
s3-secret-key: ${{ secrets.STORYBOOK_S3_SECRET_KEY }}

.storybook/tsconfig.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"extends": "../tsconfig.json",
3+
"compilerOptions": {
4+
"module": "commonjs",
5+
"target": "ES2017"
6+
},
7+
"include": ["src/**/*", "demo/**/*"],
8+
}

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
"clean": "gulp clean",
88
"build": "gulp",
99
"typecheck": "tsc -p tsconfig.json --noEmit",
10-
"storybook:start": "start-storybook -p 8888 -c .storybook",
11-
"storybook:build": "build-storybook -c .storybook -o storybook-static",
10+
"storybook:start": "TS_NODE_PROJECT=.storybook/tsconfig.json start-storybook -p 8888 -c .storybook",
11+
"storybook:build": "TS_NODE_PROJECT=.storybook/tsconfig.json build-storybook -c .storybook -o storybook-static",
1212
"lint": "run-p -cs lint:*",
1313
"lint:js": "eslint \"{src,demo}/**/*.{js,jsx,ts,tsx}\"",
1414
"lint:styles": "stylelint \"{src,demo}/**/*.{css,scss}\"",

0 commit comments

Comments
 (0)