Skip to content

Manifest driven downloads #83

Manifest driven downloads

Manifest driven downloads #83

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@v4
- name: Use Node.js 20.12.0 βš™οΈ
uses: actions/setup-node@v4
with:
node-version: 20
- name: Setup vars πŸ“‹
id: vars
run: |
echo ::set-output name=distdir::$(git rev-parse --short ${{ github.sha }})-20.x-dist
echo ::set-output name=ariabaseurl::/aria/$(git rev-parse --short ${{ github.sha }})-20.x-dist
- name: Install 🎯
run: cd site; npm install
- name: Build πŸƒ
run: cd site; npm run build
env:
BASE_ARIA_URL: ${{ steps.vars.outputs.ariabaseurl }}
- name: Upload artifacts πŸ“€
uses: actions/upload-artifact@v4
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@v4
- name: Download artifacts πŸ“₯
uses: actions/download-artifact@v4
with:
name: build-artifacts
path: site/dist
- name: Configure AWS credentials πŸ”
uses: aws-actions/configure-aws-credentials@v4
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"