-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add deployStorybook.yml workflow for building and deploying Storybook…
… to Cloudfront
- Loading branch information
Showing
1 changed file
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 "/*" |