Manifest driven downloads #90
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
# 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 , manifest_driven_downloads] | |
pull_request: | |
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" |