-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (45 loc) · 1.48 KB
/
deploy-functions.yml
File metadata and controls
52 lines (45 loc) · 1.48 KB
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
name: Deploy Python Firebase Functions
on:
push:
branches:
- add-deploy-workflow
workflow_dispatch:
inputs:
environment:
description: 'Environment to deploy to'
required: true
default: 'staging'
type: choice
options:
- staging
- prod
confirm_prod:
description: 'Type "yes" to confirm production deployment'
required: false
type: string
permissions:
contents: read
concurrency:
group: deploy-${{ github.ref }}
cancel-in-progress: false
env:
PROJECT_ID: ${{ github.event.inputs.environment == 'prod' && 'hello-wisdom-prod' || 'hello-wisdom-staging' }}
CREDENTIALS_JSON: ${{ github.event.inputs.environment == 'prod' && secrets.FIREBASE_PROD_SERVICE_ACCOUNT || secrets.FIREBASE_STAGING_SERVICE_ACCOUNT }}
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Validate production deployment
if: ${{ github.event.inputs.environment == 'prod' }}
run: |
if [[ "${{ github.event.inputs.confirm_prod }}" != "yes" ]]; then
echo "::error::Production deployment requires explicit confirmation. Please type 'yes' in the confirm_prod field."
exit 1
fi
- name: Deploy Firebase Functions
uses: ./
with:
project_id: ${{ env.PROJECT_ID }}
service_account_json: ${{ env.CREDENTIALS_JSON }}
deploy_command: "firebase deploy --only functions"