Skip to content

Github Page Staging Deployment #40

Github Page Staging Deployment

Github Page Staging Deployment #40

name: Github Page Staging Deployment
on:
workflow_dispatch:
push:
branches:
- main
permissions:
id-token: write
contents: read
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install Packages
run: npm ci
- name: Perform Tests
run: npm run test:coverage
- name: Perform Audit
run: npm audit --production
- name: Production Build
run: npm run build
- name: Store static web-app data in artifact
uses: actions/upload-artifact@v3
with:
name: distribution
path: "dist/"
upload:
name: "Upload static web-app"
runs-on: ubuntu-latest
needs: [build]
steps:
- uses: "actions/checkout@v3"
# https://github.com/aws-actions/configure-aws-credentials#notice-node12-deprecation-warning
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1-node16
with:
# TODO: REPLACE WITH ACTUAL ROLE
role-to-assume: arn:aws:iam::426579533370:role/github_actions_cloud_image_directory_staging
role-duration-seconds: 1800
aws-region: us-east-2
- name: Download all workflow run artifacts
uses: actions/download-artifact@v3
- name: Upload to S3
run: |
pipx install s3cmd
s3cmd sync --acl-public --guess-mime-type --no-mime-magic \
$(pwd)/distribution/ s3://cid-bucket-staging/