Skip to content

Commit

Permalink
Add deployStorybook.yml workflow for building and deploying Storybook…
Browse files Browse the repository at this point in the history
… to Cloudfront
  • Loading branch information
TobiTRy committed Mar 15, 2024
1 parent 3e3fe6b commit 5b907b4
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/deployStorybook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Build and Deploy Storybook to Cloudfront

on:
push:
branches: [develop]

jobs:
build-and-deploy:
runs-on: ubuntu-latest
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: ${{ env.AWS_REGION }}

- name: Install dependencies
run: |
npm --version
npm ci --production
- name: Build Storybook
run: |
npm run build-storybook
- name: Copy files to S3
run: |
aws s3 sync --delete ${{ env.DIST }} .storybook-static s3://${{ secrets.S3_BUCKET }}
- name: Invalidate Cloudfront
run: |
aws cloudfront create-invalidation \
--distribution-id ${{ env.DIST_ID }} \
--paths "/*"

0 comments on commit 5b907b4

Please sign in to comment.