-
Notifications
You must be signed in to change notification settings - Fork 9
79 lines (68 loc) · 2.32 KB
/
deploy-storybook.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
name: Deploy Storybook
on:
workflow_dispatch:
push:
branches:
- beta
paths-ignore:
- '.github/**'
env:
BUILD_PATH: "/tmp/spaceone/build"
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: true
token: ${{ secrets.PAT_TOKEN }}
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '16'
- name: Cache dependencies
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
path: node_modules
key: ${{ runner.os }}-node-modules-${{ hashFiles('package-lock.json') }}
- name: Prepare build
run: |
mkdir -p ${{ env.BUILD_PATH }}
cp package.json package-lock.json *.js ${{ env.BUILD_PATH }}/
cp -r src ${{ env.BUILD_PATH }}/src
cp -r .storybook ${{ env.BUILD_PATH }}/.storybook
cp -r public ${{ env.BUILD_PATH }}/public
cp -r tsconfig.json ${{ env.BUILD_PATH }}/
cp -r tailwind.config.cjs ${{ env.BUILD_PATH }}/
- name: Install dependencies
working-directory: ${{ env.BUILD_PATH }}
if: steps.node-cache.outputs.cache-hit != 'true'
run: npm install
- name: Build
working-directory: ${{ env.BUILD_PATH }}
env:
NODE_ENV: "production"
run: |
npm run build:storybook
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.STORYBOOK_AWS_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.STORYBOOK_AWS_SECRET_KEY }}
aws-region: ap-northeast-2
- name: Deploy to s3
run: aws s3 sync ${{ env.BUILD_PATH }}/.out/ s3://${{ secrets.STORYBOOK_S3_BUCKET }} --delete
- name: Invalidate CloudFront Cache
run: aws cloudfront create-invalidation --distribution-id ${{ secrets.CDN_DISTRIBUTION_ID }} --paths "/*"
- name: Slack
if: always()
uses: 8398a7/[email protected]
with:
status: ${{job.status}}
fields: repo,message,commit,author,action,eventName,ref,workflow,job,took
author_name: Github Action Slack
env:
SLACK_WEBHOOK_URL: ${{secrets.SLACK_WEBHOOK_URL}}