-
Notifications
You must be signed in to change notification settings - Fork 37
66 lines (54 loc) · 1.83 KB
/
dispatch_storybook_release.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
name: "[Dispatch] Storybook Deploy"
on:
workflow_dispatch:
env:
SLACK_WEBHOOK_URL: ${{secrets.SLACK_WEBHOOK_URL}}
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
token: ${{ secrets.PAT_TOKEN }}
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 20
- name: Restore cached node_modules
id: restore-node-cache
uses: actions/cache@v3
with:
path: '**/node_modules'
key: ${{ runner.OS }}-node-modules-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-node-modules-
- name: Install dependencies
if: steps.restore-node-cache.outputs.cache-hit != 'true'
run: npm ci
- name: Build
env:
NODE_ENV: "production"
run: |
npm run build -- --filter=storybook --output-logs=new-only
- 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 apps/storybook/storybook-static/ s3://${{ secrets.STORYBOOK_S3_BUCKET }} --delete
- name: Invalidate CloudFront Cache
run: aws cloudfront create-invalidation --distribution-id ${{ secrets.CDN_DISTRIBUTION_ID }} --paths "/*"
notification:
needs: deploy
runs-on: ubuntu-latest
steps:
- name: Slack
if: always()
uses: 8398a7/[email protected]
with:
status: ${{job.status}}
fields: repo,message,commit,author,action,ref,workflow,job
author_name: Github Action Slack