Skip to content
This repository has been archived by the owner on Aug 20, 2024. It is now read-only.

Merge pull request #2185 from sue445/dependabot/npm_and_yarn/frontend… #1043

Merge pull request #2185 from sue445/dependabot/npm_and_yarn/frontend…

Merge pull request #2185 from sue445/dependabot/npm_and_yarn/frontend… #1043

name: frontend-deploy
on:
push:
branches:
- "master"
- "deploy/**"
paths-ignore:
# Ignore files that are not used in production
- "**.md"
- "LICENSE"
- ".github/workflows/dependabot-auto-merge.yml"
- ".github/dependabot.yml"
- ".github/dependabot-auto-merge.yml"
# Ignore files used only by the function
- "function/**"
- ".github/workflows/function-*.yml"
workflow_dispatch:
env:
# e.g. projects/123456789/locations/global/workloadIdentityPools/github-actions/providers/github-actions
WORKLOAD_IDENTITY_PROVIDER: "projects/659376400894/locations/global/workloadIdentityPools/primap/providers/github-actions"
# e.g. terraform@GCP_PROJECT_ID.iam.gserviceaccount.com
SERVICE_ACCOUNT_EMAIL: "deployer@primap.iam.gserviceaccount.com"
permissions:
contents: read
id-token: write
defaults:
run:
working-directory: frontend
jobs:
firebase:
name: firebase
runs-on: ubuntu-latest
concurrency: frontend-production
environment:
name: frontend-production
url: https://primap.web.app/
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
cache: "npm"
cache-dependency-path: "frontend/package-lock.json"
- run: npm install
- run: npm run build
env:
NODE_ENV: production
REACT_APP_GOOGLE_BROWSER_API_KEY: ${{ secrets.REACT_APP_GOOGLE_BROWSER_API_KEY }}
REACT_APP_SENTRY_DSN: ${{ secrets.REACT_APP_SENTRY_DSN }}
REACT_APP_SENTRY_RELEASE: ${{ github.sha }}
- name: public/ should have been created
run: |
set -xe
ls -l public/build/
ls -l public/index.html
- id: auth
uses: google-github-actions/auth@v2
with:
workload_identity_provider: ${{ env.WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ env.SERVICE_ACCOUNT_EMAIL }}
- name: GCP Authenticate
uses: google-github-actions/setup-gcloud@v2
- name: Install firebase
run: |
set -xe
npm install -g firebase-tools
- run: firebase deploy
- name: Create Sentry release
uses: getsentry/action-release@v1
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT_FRONTEND }}
with:
environment: production
- name: Slack Notification
uses: act10ns/slack@v2
if: always()
continue-on-error: true
with:
status: ${{ job.status }}
webhook-url: ${{ secrets.SLACK_WEBHOOK }}