-
Notifications
You must be signed in to change notification settings - Fork 0
56 lines (54 loc) · 1.9 KB
/
firebase-deploy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
name: Deploy NestJS API to Firebase
on:
push:
branches:
- main
- dev
jobs:
deploy:
runs-on: ubuntu-latest
permissions:
actions: write
checks: write
contents: write
deployments: write
id-token: write # This is required for requesting the JWT
issues: write
packages: write
pages: write
pull-requests: write
repository-projects: write
security-events: write
statuses: write
steps:
- uses: actions/checkout@v4
with:
repository: github/actions-oidc-debugger
ref: main
token: ${{ secrets.GITHUB_TOKEN }}
path: ./.github/actions/actions-oidc-debugger
- name: Debug OIDC Claims
uses: ./.github/actions/actions-oidc-debugger
with:
audience: 'projects/970886652672/locations/global/workloadIdentityPools/dev-ci-pool/providers/my-repo-oidc'
- name: Set correct firebase project based on git branch.
run: echo "FIREBASE_PROJECT=$(if [ ${{ github.ref }} == 'refs/heads/main' ]; then echo 'prod'; else echo 'dev'; fi)" >> $GITHUB_ENV
- id: 'auth'
name: 'Authenticate to Google Cloud'
uses: 'google-github-actions/auth@v2'
with:
project_id: ${{ env.FIREBASE_PROJECT }}
workload_identity_provider: 'projects/970886652672/locations/global/workloadIdentityPools/dev-ci-pool/providers/my-repo-oidc'
# service_account: '[email protected]'
- name: Use Node.js
uses: actions/setup-node@v2
with:
node-version: '20'
- name: Install dependencies.
run: npm install
- name: Deploy to firebase cloud functions.
uses: w9jds/[email protected]
with:
args: deploy --only functions --project ${{ env.FIREBASE_PROJECT }}
env:
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}