Github Page Deployment #19
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
name: Github Page Deployment | |
on: | |
workflow_dispatch: | |
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: | |
role-to-assume: arn:aws:iam::426579533370:role/github_actions_cloud_image_directory_frontend | |
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://cloudx-json-bucket/ |