ci: update node version #58
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: 'Deploy Staging' | |
on: | |
push: | |
branches: | |
- main | |
# This allows a subsequently queued workflow run to interrupt previous runs | |
concurrency: | |
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}' | |
cancel-in-progress: true | |
jobs: | |
build: | |
name: 'Build' | |
runs-on: ubuntu-latest | |
steps: | |
- name: 'Checkout Repository' | |
uses: actions/checkout@v3 | |
- name: 'Use Build Cache' | |
id: 'setup-build-cache' | |
uses: actions/cache@v3 | |
with: | |
path: build | |
key: build-${{ github.sha }} | |
- name: 'Setup Node' | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
cache: 'yarn' | |
- name: 'Install Dependencies' | |
run: yarn install | |
- name: 'Make Production Build' | |
if: steps.setup-build-cache.outputs.cache-hit != 'true' | |
env: | |
REACT_APP_OPS_ENV: 'staging' | |
run: yarn build | |
- name: 'Set tenant' | |
env: | |
TENANT_ID: ${{ secrets.TENANT_ID }} | |
run: 'echo "{ \"TENANT_ID\": \"$TENANT_ID\" }" > build/tenant.json' | |
publish: | |
name: 'Publish' | |
needs: build | |
permissions: | |
contents: 'read' | |
id-token: 'write' | |
runs-on: ubuntu-latest | |
env: | |
GCP_BUCKET_NAME: ${{ secrets.GCP_BUCKET_NAME }} | |
steps: | |
- name: 'Checkout Repository' | |
uses: actions/checkout@v3 | |
- name: 'Use Build Cache' | |
id: 'setup-build-cache' | |
uses: actions/cache@v3 | |
with: | |
path: build | |
key: build-${{ github.sha }} | |
- name: 'Authenticate to Google Cloud' | |
uses: 'google-github-actions/auth@v0' | |
with: | |
credentials_json: ${{ secrets.GCP_CREDENTIALS_JSON }} | |
- name: 'Set up Cloud SDK' | |
uses: 'google-github-actions/setup-gcloud@v0' | |
- name: 'Remove Prior Version' | |
run: 'gsutil -m rm -a "gs://$GCP_BUCKET_NAME/**"' | |
- name: 'Upload Files' | |
id: 'upload-files' | |
uses: 'google-github-actions/upload-cloud-storage@v0' | |
with: | |
path: 'build' | |
destination: ${{ secrets.GCP_BUCKET_NAME }} | |
parent: false | |
- name: 'Upload index.html' | |
id: 'upload-index' | |
uses: 'google-github-actions/upload-cloud-storage@v0' | |
with: | |
path: 'build/index.html' | |
destination: ${{ secrets.GCP_BUCKET_NAME }} | |
headers: |- | |
content-type: text/html | |
cache-control: public, max-age=60 | |
- name: 'Upload tenant.json' | |
id: 'upload-tenant-config' | |
uses: 'google-github-actions/upload-cloud-storage@v0' | |
with: | |
path: 'build/tenant.json' | |
destination: ${{ secrets.GCP_BUCKET_NAME }} | |
headers: |- | |
content-type: application/json | |
cache-control: public, max-age=60 | |
- name: 'Assign Specialty Pages' | |
run: 'gsutil web set -m index.html -e 404.html "gs://$GCP_BUCKET_NAME"' |