Merge pull request #304 from TobiTRy/303-update-to-fit-the-ux #45
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
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 "/*" |