chore(ci): fix CI auth (VIV-000) #960
Workflow file for this run
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 & Deploy Showcase (Dev) | |
permissions: | |
contents: read | |
packages: read | |
on: | |
pull_request: | |
types: [closed] | |
branches: [master] | |
jobs: | |
build-deploy-demo-dev: | |
runs-on: ubuntu-latest | |
if: github.event.pull_request.merged == true | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID_B }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_ACCESS_KEY_SECRET_B }} | |
AWS_DEFAULT_REGION: eu-west-2 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup NodeJS 14 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 14 | |
registry-url: https://npm.pkg.github.com | |
- name: Install yarn | |
run: npm install -g yarn | |
- name: Get yarn cache directory path | |
id: yarn-cache-dir-path | |
run: echo "::set-output name=dir::$(yarn config get cacheFolder)" | |
- name: Cache yarn dependencies | |
uses: actions/cache@v2 | |
id: yarn-cache | |
with: | |
path: | | |
${{ steps.yarn-cache-dir-path.outputs.dir }} | |
**/node_modules | |
key: vivid-cache-yarn-${{ hashFiles('**/package.json') }} | |
- name: Install dependencies | |
if: steps.yarn-cache.outputs.cache-hit != 'true' | |
run: yarn install --network-timeout 100000 | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
- name: Build storybook | |
run: yarn storybook:build | |
- name: Create deploy timestamp/version | |
run: echo "STORYBOOK_DEPLOY_TIMESTAMP=$(jq -r '.timestamp' ./.storybook/static/build-details.json)" >> $GITHUB_ENV | |
- name: Deploy showcase versioned as ${{ env.STORYBOOK_DEPLOY_TIMESTAMP }} | |
run: aws s3 sync ./.out/ s3://${{ secrets.AWS_S3_BUCKET_B }}/${{ env.STORYBOOK_DEPLOY_TIMESTAMP }} | |
- name: Update CloudFront distribution root object ${{ env.STORYBOOK_DEPLOY_TIMESTAMP }} | |
run: aws cloudfront update-distribution --id ${{ secrets.AWS_CF_DISTRIBUTION_ID_B }} --default-root-object ${{ env.STORYBOOK_DEPLOY_TIMESTAMP }}/index.html | |
- name: Invalidate CloudFront distribution root object's cache | |
run: aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_CF_DISTRIBUTION_ID_B }} --paths "/" |