-
Notifications
You must be signed in to change notification settings - Fork 1
49 lines (40 loc) · 1.24 KB
/
deployStorybook.yml
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
name: Build and Deploy Storybook to Cloudfront
on:
push:
branches: [develop]
jobs:
build-and-deploy:
runs-on: ubuntu-latest
env:
DIST_ID: E2DL1NF6N4Y4TK
DIST: storybook-static
BUCKET: fancyuistorybook
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Install dependencies
run: |
npm --version
npm install
- name: Build Storybook
run: |
npm run build-storybook
- name: Create robots.txt
run: |
echo "User-agent: *" > ./storybook-static/robots.txt
echo "Disallow:" >> ./storybook-static/robots.txt
- name: Copy files to S3
run: |
echo "Copying files to S3 "
aws s3 sync --delete ./storybook-static s3://${{ env.BUCKET }}
- name: Invalidate Cloudfront
run: |
aws cloudfront create-invalidation \
--distribution-id ${{ env.DIST_ID }} \
--paths "/*"