Update Yarn to v1.22.22 #170
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: 'Deployment' | |
on: | |
push: | |
branches: | |
- master | |
concurrency: | |
group: ${{ github.ref }}-deployment | |
cancel-in-progress: true | |
jobs: | |
build: | |
name: 'Build and deploy static site' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Wait for CI to succeed | |
uses: lewagon/wait-on-check-action@master | |
with: | |
ref: ${{ github.ref }} | |
check-name: 'Lint/Test' | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
wait-interval: 10 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20.x | |
- name: 'Checkout' | |
uses: actions/checkout@master | |
- name: Grab config | |
id: config | |
run: | | |
echo "::set-output name=Region::$(node config Region)" | |
echo "::set-output name=ProjectFQDomain::$(node config ProjectFQDomain)" | |
- uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ${{ steps.config.outputs.Region }} | |
- name: Cache node_modules | |
id: cache | |
uses: actions/cache@v4 | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-${{ hashFiles('yarn.lock') }} | |
- name: Install | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: yarn install --frozen-lockfile --ignore-scripts | |
- name: Build | |
run: yarn webpack | |
env: | |
NODE_ENV: production | |
GITHUB_SHA: ${{ github.sha }} | |
- name: Verify bucket exists | |
run: if [ "$(yarn --silent awsUtils bucketExists)" = "false" ]; then exit 1; fi | |
- name: Upload dist to bucket | |
run: | | |
aws s3 sync dist s3://${{ steps.config.outputs.ProjectFQDomain }} \ | |
--acl public-read \ | |
--cache-control max-age=31536000 | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: dist | |
path: ./dist | |
- name: Invalidate CloudFront | |
run: yarn awsUtils invalidate "/index.html" | |
sentry: | |
name: 'Track Deploy In Sentry' | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: 'Checkout' | |
uses: actions/checkout@master | |
- name: Grab config | |
id: config | |
run: | | |
echo "::set-output name=SentryOrg::$(node config SentryOrg)" | |
echo "::set-output name=SentryProject::$(node config SentryProject)" | |
- uses: actions/download-artifact@v4 | |
with: | |
name: dist | |
path: dist | |
- name: Notify Sentry of deploy | |
uses: bjacobel/sentry-cli-action@master | |
with: | |
args: releases new ${{ github.sha }} | |
env: | |
SENTRY_ORG: ${{ steps.config.outputs.SentryOrg }} | |
SENTRY_PROJECT: ${{ steps.config.outputs.SentryProject }} | |
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | |
- name: Add sourcemaps to Sentry | |
uses: bjacobel/sentry-cli-action@master | |
with: | |
args: releases files ${{ github.sha }} upload-sourcemaps dist | |
env: | |
SENTRY_ORG: ${{ steps.config.outputs.SentryOrg }} | |
SENTRY_PROJECT: ${{ steps.config.outputs.SentryProject }} | |
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} |