Skip to content

Commit 5d073f9

Browse files
authored
Merge pull request #210 from digital-go-jp/deploy-to-prod
prodデプロイ用のワークフローを追加
2 parents caf1fa4 + d148f1a commit 5d073f9

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Deploy Storybook to Production
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
concurrency:
9+
group: production-deploy
10+
cancel-in-progress: true
11+
12+
env:
13+
AWS_DEFAULT_REGION: ap-northeast-1
14+
15+
jobs:
16+
deploy:
17+
runs-on: ubuntu-latest
18+
environment: production
19+
permissions:
20+
id-token: write
21+
contents: read
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v4
25+
- uses: actions/setup-node@v3
26+
with:
27+
node-version: 20
28+
cache: "npm"
29+
- name: Install packages
30+
run: |
31+
npm ci
32+
- name: Build
33+
run: |
34+
npm run storybook:build
35+
- name: Define deploy_id
36+
run: |
37+
echo "deploy_id=${{ github.job }}-${{ github.run_id }}-${{ github.run_attempt }}" >> $GITHUB_ENV
38+
- name: Configure AWS credentials
39+
uses: aws-actions/configure-aws-credentials@v4
40+
with:
41+
role-to-assume: ${{ secrets.PROD_ROLE_TO_ASSUME }}
42+
role-session-name: GitHubActions-${{ env.deploy_id }}
43+
aws-region: ${{ env.AWS_DEFAULT_REGION }}
44+
- name: copy files to s3 bucket
45+
run: |
46+
aws s3 sync --delete storybook-static s3://${{ secrets.PROD_BUCKET_NAME }}/dads/react/
47+
- name: invalidate cache
48+
run: |
49+
aws cloudfront create-invalidation --distribution-id ${{ secrets.PROD_CF_DIST_ID }} --paths "/dads/react/*"

0 commit comments

Comments
 (0)