Skip to content

Use static copy plugin to fetch the correct esm file and put it in a … #15

Use static copy plugin to fetch the correct esm file and put it in a …

Use static copy plugin to fetch the correct esm file and put it in a … #15

Workflow file for this run

# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: Deploy
on:
push:
branches: [ main ]
permissions:
id-token: write # required to use OIDC authentication
contents: read # required to checkout the code from the repo
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout 📥
uses: actions/checkout@v2
- name: Use Node.js 20.12.0 ⚙️
uses: actions/setup-node@v1
with:
node-version: 20.12.0
- name: Setup vars 📋
id: vars
run: |
echo ::set-output name=distdir::$(git rev-parse --short ${{ github.sha }})-20.x-dist
- name: Install 🎯
run: cd site; npm install
- name: Build 🏃
run: cd site; npm run build
- name: Upload artifacts 📤
uses: actions/upload-artifact@v2
with:
name: build-artifacts
path: site/dist
if-no-files-found: error
deploy:
name: Deploy
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout 📥
uses: actions/checkout@v2
- name: Download artifacts 📥
uses: actions/download-artifact@v2
with:
name: build-artifacts
path: site/dist
- name: Configure AWS credentials 🔐
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: arn:aws:iam::851725248912:role/aria-cicd-role
role-duration-seconds: 900 # the ttl of the session, in seconds.
aws-region: us-west-2
- name: Setup vars 📋
id: vars
run: |
echo ::set-output name=identifier::$(git rev-parse --short ${{ github.sha }})-20.x
echo ::set-output name=distdir::$(git rev-parse --short ${{ github.sha }})-20.x-dist
- name: Prep files 🔨
run: cd site ; npm run aws_deploy
env:
IDENTIFIER: ${{ steps.vars.outputs.identifier }}
DISTDIR: ${{ steps.vars.outputs.distdir }}
- name: Copy new index file to S3 📤
run: aws s3 cp site/$DISTDIR/index.html s3://aria-site/aria/$IDENTIFIER-aria.html --no-progress
env:
IDENTIFIER: ${{ steps.vars.outputs.identifier }}
DISTDIR: ${{ steps.vars.outputs.distdir }}
- name: Copy new dist dir to S3 📤
run: aws s3 cp site/$DISTDIR s3://aria-site/aria/$DISTDIR --recursive --no-progress
env:
IDENTIFIER: ${{ steps.vars.outputs.identifier }}
DISTDIR: ${{ steps.vars.outputs.distdir }}
- name: Deployment complete! 🚀
run: |
echo "Your build is at: https://d13285jxgcxetl.cloudfront.net/aria/${{ steps.vars.outputs.distdir }}/index.html"