deps(dev): bump the safe-dependencies group with 5 updates #85
Workflow file for this run
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: Push Events | |
on: | |
push: | |
paths: | |
- 'src/**' | |
- '.github/workflows/push.yml' | |
- 'package-lock.json' | |
- 'firebase.json' | |
- '.firebaserc' | |
workflow_dispatch: | |
permissions: | |
id-token: write | |
contents: read | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
name: 🏗 Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: ⬇️ Set up code | |
uses: actions/checkout@v4 | |
with: | |
show-progress: false | |
- name: ⎔ Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: lts/* | |
cache: npm | |
- name: 📥 Download dependencies | |
run: npm ci | |
- name: 🏗 Run build script | |
run: npm run build:vite | |
unit-test: | |
name: 🧪 Unit tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: ⬇️ Set up code | |
uses: actions/checkout@v4 | |
with: | |
show-progress: false | |
- name: ⎔ Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: lts/* | |
cache: npm | |
- name: 📥 Download dependencies | |
run: npm ci | |
- name: 🧪 Run tests | |
run: npm test | |
deploy-demo-dev: | |
name: Deploy preview to firebase | |
runs-on: ubuntu-latest | |
environment: | |
name: dev | |
url: https://ut-dts-agrc-plpco-rdcc-dev.web.app/ | |
if: github.ref == 'refs/heads/dev' | |
steps: | |
- name: ⬇️ Set up code | |
uses: actions/checkout@v4 | |
with: | |
show-progress: false | |
- name: ⎔ Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: lts/* | |
cache: npm | |
- name: 📥 Download dependencies | |
run: npm ci | |
- name: 🏗 Run build script | |
run: npm run build:vite | |
- name: 🪣 Cache firebase | |
uses: actions/cache@v3 | |
with: | |
path: ./.firebase | |
key: ${{ runner.OS }}-firebase-${{ hashFiles('**/*.cache') }} | |
restore-keys: | | |
${{ runner.OS }}-firebase- | |
${{ runner.OS }}- | |
- name: 🗝️ Authenticate to Google Cloud | |
id: auth | |
uses: google-github-actions/auth@v1 | |
with: | |
access_token_scopes: 'email, openid, https://www.googleapis.com/auth/cloud-platform, https://www.googleapis.com/auth/firebase' | |
workload_identity_provider: ${{ secrets.IDENTITY_PROVIDER }} | |
service_account: ${{ secrets.SERVICE_ACCOUNT_EMAIL }} | |
create_credentials_file: true | |
- name: 🚀 Firebase Deploy | |
run: > | |
npx firebase-tools deploy | |
--only hosting | |
--project ${{ secrets.PROJECT_ID }} | |
env: | |
FIREBASE_CLI_PREVIEWS: hostingchannels | |
deploy-gcp-dev: | |
name: Deploy dev GCP infrastructure | |
runs-on: ubuntu-latest | |
needs: [build, unit-test] | |
environment: | |
name: dev | |
if: github.ref == 'refs/heads/dev' | |
steps: | |
- name: ⬇️ Set up code | |
uses: actions/checkout@v4 | |
with: | |
show-progress: false | |
- name: 🗝️ Authenticate to Google Cloud | |
id: auth | |
uses: google-github-actions/auth@v1 | |
with: | |
access_token_scopes: 'email, openid, https://www.googleapis.com/auth/cloud-platform, https://www.googleapis.com/auth/firebase' | |
workload_identity_provider: ${{ secrets.IDENTITY_PROVIDER }} | |
service_account: ${{ secrets.SERVICE_ACCOUNT_EMAIL }} | |
token_format: 'access_token' | |
create_credentials_file: true | |
- name: ☁️ Set up Cloud SDK | |
uses: google-github-actions/setup-gcloud@v1 | |
with: | |
install_components: 'beta' | |
- name: 🗝️ Authenticate Docker to Google Cloud | |
uses: docker/login-action@v3 | |
with: | |
registry: us-central1-docker.pkg.dev | |
username: oauth2accesstoken | |
password: ${{ steps.auth.outputs.access_token }} | |
- name: 🏷️ Extract tags from GitHub | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: us-central1-docker.pkg.dev/${{ secrets.PROJECT_ID }}/images/job | |
tags: | | |
latest | |
- name: 🔰 Setup pack | |
uses: buildpacks/github-actions/[email protected] | |
- name: 📦 Build image | |
shell: bash | |
run: pack build job --builder gcr.io/buildpacks/builder -t ${{ steps.meta.outputs.tags }} | |
- name: 🏺 Push images to artifact registry | |
shell: bash | |
run: docker push ${{ steps.meta.outputs.tags }} | |
- name: 🚀 Deploy to Cloud Run | |
run: | | |
if [ ! "$(gcloud beta run jobs list | grep notify)" ]; then | |
gcloud beta run jobs create notify \ | |
--region us-central1 \ | |
--image us-central1-docker.pkg.dev/${{ secrets.PROJECT_ID }}/images/job:latest \ | |
--service-account cloud-run-sa@${{ secrets.PROJECT_ID }}.iam.gserviceaccount.com \ | |
--set-secrets=/secrets/email/key=sendgrid-api:latest \ | |
--set-env-vars SENDGRID_TEMPLATE=${{ secrets.SENDGRID_TEMPLATE }},EMAIL_RECIPIENT=${{ secrets.EMAIL_RECIPIENT }} \ | |
--tasks 1 \ | |
--max-retries 3 \ | |
--parallelism 1 | |
else | |
gcloud beta run jobs update notify \ | |
--region us-central1 \ | |
--image us-central1-docker.pkg.dev/${{ secrets.PROJECT_ID }}/images/job:latest \ | |
--service-account cloud-run-sa@${{ secrets.PROJECT_ID }}.iam.gserviceaccount.com \ | |
--update-secrets=/secrets/email/key=sendgrid-api:latest \ | |
--set-env-vars SENDGRID_TEMPLATE=${{ secrets.SENDGRID_TEMPLATE }},EMAIL_RECIPIENT=${{ secrets.EMAIL_RECIPIENT }} \ | |
--tasks 1 \ | |
--max-retries 3 \ | |
--parallelism 1 | |
fi | |
- name: 🕰️ Create Cloud Scheduler | |
run: | | |
if [ ! "$(gcloud scheduler jobs list --location=us-central1 | grep rdcc-weekly-email)" ]; then | |
gcloud scheduler jobs create http rdcc-weekly-email \ | |
--description="Trigger the rdcc-weekly-email bot once a week on monday morning" \ | |
--schedule="0 5 * * MON" \ | |
--time-zone=America/Denver \ | |
--uri="https://us-central1-run.googleapis.com/apis/run.googleapis.com/v1/namespaces/${{ secrets.PROJECT_ID }}/jobs/notify:run" \ | |
--oauth-service-account-email=cloud-scheduler-sa@${{ secrets.PROJECT_ID }}.iam.gserviceaccount.com \ | |
--location=us-central1 \ | |
--max-retry-attempts=0 \ | |
--quiet | |
else | |
gcloud scheduler jobs update http rdcc-weekly-email \ | |
--description="Trigger the rdcc-weekly-email bot once a week on monday morning" \ | |
--schedule="0 5 * * MON" \ | |
--time-zone=America/Denver \ | |
--uri="https://us-central1-run.googleapis.com/apis/run.googleapis.com/v1/namespaces/${{ secrets.PROJECT_ID }}/jobs/notify:run" \ | |
--oauth-service-account-email=cloud-scheduler-sa@${{ secrets.PROJECT_ID }}.iam.gserviceaccount.com \ | |
--location=us-central1 \ | |
--max-retry-attempts=0 \ | |
--quiet | |
fi | |
deploy-gcp-prod: | |
name: Deploy prod GCP infrastructure | |
runs-on: ubuntu-latest | |
needs: [build, unit-test] | |
environment: | |
name: prod | |
if: github.ref == 'refs/heads/main' | |
steps: | |
- name: ⬇️ Set up code | |
uses: actions/checkout@v4 | |
with: | |
show-progress: false | |
- name: 🗝️ Authenticate to Google Cloud | |
id: auth | |
uses: google-github-actions/auth@v1 | |
with: | |
access_token_scopes: 'email, openid, https://www.googleapis.com/auth/cloud-platform, https://www.googleapis.com/auth/firebase' | |
workload_identity_provider: ${{ secrets.IDENTITY_PROVIDER }} | |
service_account: ${{ secrets.SERVICE_ACCOUNT_EMAIL }} | |
token_format: 'access_token' | |
create_credentials_file: true | |
- name: ☁️ Set up Cloud SDK | |
uses: google-github-actions/setup-gcloud@v1 | |
with: | |
install_components: 'beta' | |
- name: 🗝️ Authenticate Docker to Google Cloud | |
uses: docker/login-action@v3 | |
with: | |
registry: us-central1-docker.pkg.dev | |
username: oauth2accesstoken | |
password: ${{ steps.auth.outputs.access_token }} | |
- name: 🏷️ Extract tags from GitHub | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: us-central1-docker.pkg.dev/${{ secrets.PROJECT_ID }}/images/job | |
tags: | | |
latest | |
- name: 🔰 Setup pack | |
uses: buildpacks/github-actions/[email protected] | |
- name: 📦 Build image | |
shell: bash | |
run: pack build job --builder gcr.io/buildpacks/builder -t ${{ steps.meta.outputs.tags }} | |
- name: 🏺 Push images to artifact registry | |
shell: bash | |
run: docker push ${{ steps.meta.outputs.tags }} | |
- name: 🚀 Deploy to Cloud Run | |
run: | | |
if [ ! "$(gcloud beta run jobs list | grep notify)" ]; then | |
gcloud beta run jobs create notify \ | |
--region us-central1 \ | |
--image us-central1-docker.pkg.dev/${{ secrets.PROJECT_ID }}/images/job:latest \ | |
--service-account cloud-run-sa@${{ secrets.PROJECT_ID }}.iam.gserviceaccount.com \ | |
--set-secrets=/secrets/email/key=sendgrid-api:latest \ | |
--set-env-vars SENDGRID_TEMPLATE=${{ secrets.SENDGRID_TEMPLATE }},EMAIL_RECIPIENT=${{ secrets.EMAIL_RECIPIENT }} \ | |
--tasks 1 \ | |
--max-retries 3 \ | |
--parallelism 1 | |
else | |
gcloud beta run jobs update notify \ | |
--region us-central1 \ | |
--image us-central1-docker.pkg.dev/${{ secrets.PROJECT_ID }}/images/job:latest \ | |
--service-account cloud-run-sa@${{ secrets.PROJECT_ID }}.iam.gserviceaccount.com \ | |
--update-secrets=/secrets/email/key=sendgrid-api:latest \ | |
--set-env-vars SENDGRID_TEMPLATE=${{ secrets.SENDGRID_TEMPLATE }},EMAIL_RECIPIENT=${{ secrets.EMAIL_RECIPIENT }} \ | |
--tasks 1 \ | |
--max-retries 3 \ | |
--parallelism 1 | |
fi | |
- name: 🕰️ Create Cloud Scheduler | |
run: | | |
if [ ! "$(gcloud scheduler jobs list --location=us-central1 | grep rdcc-weekly-email)" ]; then | |
gcloud scheduler jobs create http rdcc-weekly-email \ | |
--description="Trigger the rdcc-weekly-email bot once a week on monday morning" \ | |
--schedule="0 5 * * MON" \ | |
--time-zone=America/Denver \ | |
--uri="https://us-central1-run.googleapis.com/apis/run.googleapis.com/v1/namespaces/${{ secrets.PROJECT_ID }}/jobs/notify:run" \ | |
--oauth-service-account-email=cloud-scheduler-sa@${{ secrets.PROJECT_ID }}.iam.gserviceaccount.com \ | |
--location=us-central1 \ | |
--max-retry-attempts=0 \ | |
--quiet | |
else | |
gcloud scheduler jobs update http rdcc-weekly-email \ | |
--description="Trigger the rdcc-weekly-email bot once a week on monday morning" \ | |
--schedule="0 5 * * MON" \ | |
--time-zone=America/Denver \ | |
--uri="https://us-central1-run.googleapis.com/apis/run.googleapis.com/v1/namespaces/${{ secrets.PROJECT_ID }}/jobs/notify:run" \ | |
--oauth-service-account-email=cloud-scheduler-sa@${{ secrets.PROJECT_ID }}.iam.gserviceaccount.com \ | |
--location=us-central1 \ | |
--max-retry-attempts=0 \ | |
--quiet | |
fi |