Skip to content

core(ci): update version of artifact actions #5292

core(ci): update version of artifact actions

core(ci): update version of artifact actions #5292

name: Build & Deploy Showcase (PR)
on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
build-deploy-demo-pr:
runs-on: ubuntu-latest
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_VIVID_DEMO_PRS_ACCESS }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_VIVID_DEMO_PRS_SECRET }}
AWS_DEFAULT_REGION: us-east-1
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Add PR deploy URL comment
if: ${{ github.event.action == 'opened' || github.event.action == 'reopened' }}
env:
URL: ${{ github.event.pull_request.comments_url }}
run: |
curl -X POST $URL -H "Content-Type: application/json" -H "Authorization: token $GITHUB_TOKEN" \
--data '{ "body": ":rocket:\n\nLatest __successful__ build of the PR deployed [here](https://${{ secrets.TMP_PR_DEPLOYMENT_BASE_URL }}/${{ github.event.number }}/index.html).\n\n:rocket:" }'
- name: Checkout
uses: actions/checkout@v2
- run: printf "registry=https://npm.pkg.github.com/Vonage\n_authToken=\${GITHUB_TOKEN}\n//npm.pkg.github.com/:_authToken=\${GITHUB_TOKEN}\nalways-auth=true" > .npmrc
- name: Setup NodeJS 14
uses: actions/setup-node@v2
with:
node-version: 14
- 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
- name: Build storybook
run: yarn storybook:build base-url=${{ github.event.number }}
- name: Deploy showcase under PR ID (${{ github.event.number }})
run: aws s3 sync ./.out/ s3://${{ secrets.AWS_VIVID_DEMO_PRS_BUCKET }}/${{ github.event.number }}
- name: Invalidate CloudFront distribution root object's cache
run: aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_VIVID_DEMO_PRS_DISTRIBUTION }} --paths "/${{ github.event.number }}/*"