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

Merge pull request #6 from mdaniels5757/dependabot/npm_and_yarn/globa… #10

Merge pull request #6 from mdaniels5757/dependabot/npm_and_yarn/globa…

Merge pull request #6 from mdaniels5757/dependabot/npm_and_yarn/globa… #10

Workflow file for this run

# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
name: Node.js CI + Deploy to Google Cloud Functions
on:
push:
branches:
- master
- main
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [22.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm ci
- run: npm run build --if-present
- run: npm run lint
- uses: actions/upload-artifact@v4
with:
path: .
name: built
deploy_notify:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/download-artifact@v4
with:
name: built
- id: 'auth'
uses: 'google-github-actions/auth@v2'
with:
project_id: ${{ secrets.GCP_PROJECT_ID }}
credentials_json: ${{ secrets.GCP_CREDENTIALS_JSON }}
- id: 'deploy_notify'
uses: 'google-github-actions/deploy-cloud-functions@v3'
timeout-minutes: 10
with:
name: notify
project_id: ${{ secrets.GCP_PROJECT_ID }}
runtime: 'nodejs22'
environment_variables: |-
GCLOUD_PROJECT=${{ secrets.GCP_PROJECT_ID }}
DATASTORE_PROJECT_ID=${{ secrets.GCP_PROJECT_ID }}
TOPIC_ID=${{ secrets.TOPIC_ID }}
GCF_REGION=${{ secrets.GCF_REGION }}
secrets: |-
GOOGLE_CLIENT_ID=projects/437124374582/secrets/GOOGLE_CLIENT_ID
GOOGLE_CLIENT_SECRET=projects/437124374582/secrets/GOOGLE_CLIENT_SECRET
PUSHOVER_USER_KEY=projects/437124374582/secrets/PUSHOVER_USER_KEY
PUSHOVER_API_KEY=projects/437124374582/secrets/PUSHOVER_API_KEY
min_instance_count: 0
max_instance_count: 1
max_instance_request_concurrency: 1
event_trigger_type: google.cloud.pubsub.topic.v1.messagePublished
event_trigger_pubsub_topic: projects/${{ secrets.GCP_PROJECT_ID }}/topics/${{ secrets.TOPIC_ID }}
event_trigger_retry: false
event_trigger_service_account: eventarctrigger@${{ secrets.GCP_PROJECT_ID }}.iam.gserviceaccount.com
service_account: notify@${{ secrets.GCP_PROJECT_ID }}.iam.gserviceaccount.com
deploy_watch:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/download-artifact@v4
with:
name: built
- id: 'auth'
uses: 'google-github-actions/auth@v2'
with:
project_id: ${{ secrets.GCP_PROJECT_ID }}
credentials_json: ${{ secrets.GCP_CREDENTIALS_JSON }}
- id: 'deploy_watch'
uses: 'google-github-actions/deploy-cloud-functions@v3'
timeout-minutes: 10
with:
name: watch
project_id: ${{ secrets.GCP_PROJECT_ID }}
runtime: 'nodejs22'
environment_variables: |-
GCLOUD_PROJECT=${{ secrets.GCP_PROJECT_ID }}
DATASTORE_PROJECT_ID=${{ secrets.GCP_PROJECT_ID }}
TOPIC_ID=${{ secrets.TOPIC_ID }}
GCF_REGION=${{ secrets.GCF_REGION }}
secrets: |-
GOOGLE_CLIENT_ID=projects/437124374582/secrets/GOOGLE_CLIENT_ID
GOOGLE_CLIENT_SECRET=projects/437124374582/secrets/GOOGLE_CLIENT_SECRET
min_instance_count: 0
max_instance_count: 1
max_instance_request_concurrency: 1
event_trigger_type: google.cloud.pubsub.topic.v1.messagePublished
event_trigger_pubsub_topic: projects/${{ secrets.GCP_PROJECT_ID }}/topics/${{ secrets.TOPIC_ID }}
event_trigger_retry: false
event_trigger_service_account: eventarctrigger@${{ secrets.GCP_PROJECT_ID }}.iam.gserviceaccount.com
service_account: watcher@${{ secrets.GCP_PROJECT_ID }}.iam.gserviceaccount.com