-
Notifications
You must be signed in to change notification settings - Fork 0
57 lines (43 loc) · 1.55 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
name: Deploy Storybook
on:
push:
branches: ['main']
# Run only if there are at least one change matching the following paths
paths:
- '.github/workflows/deploy_storybook.yaml'
- 'apps/nextjs-website/**'
workflow_dispatch:
# These permissions are needed to interact with GitHub's OIDC Token endpoint.
permissions:
id-token: write
contents: read
jobs:
build:
name: Build and Deploy Storybook
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: false
steps:
- name: Checkout
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
- name: Setup Node
uses: ./.github/actions/setup-node
- name: Install dependencies
shell: bash
run: npm install
- name: Create Storybook
shell: bash
working-directory: ./apps/nextjs-website
run: npm run build-storybook
- name: Configure AWS Credentials
uses: ./.github/actions/configure-aws-credentials
with:
aws_region: ${{ env.AWS_REGION || 'eu-south-1' }}
role_to_assume: ${{ secrets.IAM_ROLE_DEPLOY_WEBSITE }}
- name: Deploy to S3 Bucket
shell: bash
run: aws s3 sync ./apps/nextjs-website/storybook-static s3://${{ vars.S3_BUCKET_NAME }}/storybook --delete
- name: Create AWS Cloudfront Invalidation
shell: bash
run: aws cloudfront create-invalidation --distribution-id ${{ vars.CLOUDFRONT_DISTRIBUTION_ID_STORYBOOK }} --paths "/*"