Add 2025 application redirect. #188
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: Build and Deploy to GCP | |
on: | |
push: | |
branches: [ deploy-prod, deploy-staging, deploy-dev ] | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Cache node modules | |
uses: actions/cache@v2 | |
with: | |
path: node_modules | |
key: ${{ runner.OS }}-build-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.OS }}-build- | |
${{ runner.OS }}- | |
- name: Use Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 20 | |
- name: Install dependencies | |
run: yarn install | |
- name: Build | |
run: yarn build | |
# Somewhat weirdly you do the auth before the setup for the google CLI | |
- name: Authenticate the cloud sdk | |
uses: google-github-actions/auth@v2 | |
with: | |
credentials_json: ${{ secrets.GCP_SA_KEY }} | |
export_environment_variables: true | |
- name: Setup cloud sdk | |
uses: google-github-actions/setup-gcloud@v2 | |
with: | |
project_id: ${{ secrets.GCP_PROJECT_ID }} | |
- name: Deploy to GCS | |
run: | | |
BUCKET_NAME="$(echo ${BRANCH_NAME} | cut -d'-' -f 2)" | |
if [[ "$BUCKET_NAME" == "prod" ]]; then | |
BUCKET_NAME="www" | |
fi | |
BUCKET_NAME="${BUCKET_NAME}.baaahs.org" | |
gsutil -m rsync -r -d ./build gs://${BUCKET_NAME} | |
gcloud compute url-maps invalidate-cdn-cache lb-map --path=/* --async | |
env: | |
BRANCH_NAME: ${{ github.ref }} | |
shell: bash | |