This repository has been archived by the owner on Aug 20, 2024. It is now read-only.
Merge pull request #1921 from sue445/dependabot/npm_and_yarn/frontend… #867
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: 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@v3 | |
with: | |
node-version-file: "frontend/.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@v1 | |
with: | |
workload_identity_provider: ${{ env.WORKLOAD_IDENTITY_PROVIDER }} | |
service_account: ${{ env.SERVICE_ACCOUNT_EMAIL }} | |
- name: GCP Authenticate | |
uses: google-github-actions/setup-gcloud@v1 | |
- name: Install firebase | |
run: | | |
set -xe | |
sudo wget https://firebase.tools/bin/linux/latest -O /usr/local/bin/firebase | |
sudo chmod 755 /usr/local/bin/firebase | |
- 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: lazy-actions/slatify@master | |
if: always() | |
continue-on-error: true | |
with: | |
job_name: '*firebase*' | |
type: ${{ job.status }} | |
icon_emoji: ":octocat:" | |
url: ${{ secrets.SLACK_WEBHOOK }} | |
token: ${{ secrets.GITHUB_TOKEN }} |