-
Notifications
You must be signed in to change notification settings - Fork 1
84 lines (82 loc) · 2.88 KB
/
Copy pathdeploy-cloudfunction.yaml
File metadata and controls
84 lines (82 loc) · 2.88 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
name: 'Reusable gcp cloud function deploy workflow'
on:
workflow_call:
secrets:
GH_AUTH_APP_SECRET:
description: >
GitHub App private key for generating tokens.
Used in pair with vars.GH_AUTH_APP_ID — set both or neither.
required: false
inputs:
function-name:
description: 'Name of the Cloud Function to deploy'
required: true
type: string
region:
description: 'GCP region for Cloud Function deployment (e.g., europe-west3)'
required: true
type: string
source-dir:
description: 'Directory containing the function source code'
type: string
default: '.'
entry-point:
description: 'Name of the function entry point (function name in code)'
required: true
type: string
runtime:
description: 'Runtime environment for the function (e.g., python311, nodejs22) see <https://docs.cloud.google.com/run/docs/runtimes/function-runtimes>'
required: true
type: string
memory:
description: 'Amount of memory allocated to the function'
type: string
default: '256Mi'
service-timeout:
description: 'Maximum execution time for the function in seconds'
type: number
default: 60
workload-identity-provider:
description: 'GCP Workload Identity Provider resource name'
required: true
type: string
workload-identity-service-account-mail:
description: 'GCP service account email for workload identity OIDC authentication'
required: true
type: string
jobs:
deploy:
name: Deploy
permissions:
contents: 'read'
id-token: 'write'
runs-on: ubuntu-latest
steps:
- name: GitHub App token
id: app-token
uses: verkstedt/actions/create-github-app-token@v1
with:
app-id: ${{ vars.GH_AUTH_APP_ID }}
private-key: ${{ secrets.GH_AUTH_APP_SECRET }}
- name: Checkout code
uses: actions/checkout@v7.0.0
with:
token: ${{ steps.app-token.outputs.token }}
submodules: recursive
- name: Google Auth
uses: 'google-github-actions/auth@v3.0.0'
with:
service_account: ${{ inputs.workload-identity-service-account-mail }}
workload_identity_provider: ${{ inputs.workload-identity-provider }}
- name: Set up gcloud-cli
uses: 'google-github-actions/setup-gcloud@v3.0.1'
- name: Deploy Cloud Function
uses: google-github-actions/deploy-cloud-functions@v4.0.0
with:
name: ${{ inputs.function-name }}
runtime: ${{ inputs.runtime }}
region: ${{ inputs.region }}
memory: ${{ inputs.memory }}
service_timeout: ${{ inputs.service-timeout }}
source_dir: ${{ inputs.source-dir }}
entry_point: ${{ inputs.entry-point }}