Skip to content

Merge branch 'main' into prod #37

Merge branch 'main' into prod

Merge branch 'main' into prod #37

Workflow file for this run

name: Firebase Deploy to GCP
on:
push:
branches: [prod]
pull_request:
branches: [prod]
jobs:
deploy:
permissions:
contents: "read"
id-token: "write"
environment: prod
name: Setup Gcloud Account
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install Firebase CLI
run: |
npm install -g firebase-tools
- id: auth
name: Login
uses: google-github-actions/auth@v1
with:
workload_identity_provider: ${{ secrets.WORKLOAD_IDENTITY_PROVIDER_ID }}
service_account: ${{ secrets.WIP_EMAIL }}
create_credentials_file: true
- name: Configure gcloud
uses: google-github-actions/setup-gcloud@v1
with:
project_id: ${{ secrets.GCP_PROJECT_ID }}
- name: create env file
run: |
cd functions
touch .env
echo "DISCORD_SERVER_ID=${{ secrets.DISCORD_SERVER_ID }}" >> .env
echo "DISCORD_CHANNEL_ID=${{ secrets.DISCORD_CHANNEL_ID }}" >> .env
echo "DISCORD_SALAI_TOKEN=${{ secrets.DISCORD_SALAI_TOKEN }}" >> .env
- name: Use NPM to install dependencies
uses: actions/setup-node@v1
with:
node-version: "18.x"
- run: |
cd functions
npm install
- name: Build
run: |
cd functions
npm run build
- name: Deploy to Firebase
run: |
cd functions
npm run deploy
# - name: deploy
# uses: "google-github-actions/deploy-cloud-functions@v2"
# with:
# # Name of the Cloud Function, same as the entry point name
# name: "onGenerationCreated"
# source_dir: "functions"
# # Runtime to use for the function
# runtime: "nodejs18"
# event_trigger_type: 'providers/cloud.firestore/eventTypes/document.create'
# event_trigger_resource: 'projects/${{ secrets.GCP_PROJECT_ID }}/databases/(default)/documents/users/{userId}/locations/{locationId}/generations/{generationId}'