-
Notifications
You must be signed in to change notification settings - Fork 1
55 lines (50 loc) · 1.79 KB
/
gcloud-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
# Deploy the production cloud function if pushing to the `main` branch or the test cloud function if pushing to the
# `test` branch.
name: gcloud-deploy
on:
push:
branches:
- main
- test
jobs:
get-prefix:
runs-on: ubuntu-latest
outputs:
name_prefix: ${{ steps.prefix.outputs.name_prefix }}
dataset_name_prefix: ${{ steps.prefix.outputs.dataset_name_prefix }}
steps:
- name: Get prefix (test- or nothing for production)
id: prefix
run: |
echo ${{ github.ref }}
if [ "${{ github.ref }}" = "refs/heads/main" ]; then
echo "name_prefix=" >> $GITHUB_OUTPUT
echo "dataset_name_prefix=" >> $GITHUB_OUTPUT
else
echo "name_prefix=test-" >> $GITHUB_OUTPUT
echo "dataset_name_prefix=test_" >> $GITHUB_OUTPUT
fi
deploy:
permissions:
contents: "read"
id-token: "write"
runs-on: ubuntu-latest
needs: get-prefix
steps:
- id: checkout
uses: actions/checkout@v2
- id: auth
uses: google-github-actions/auth@v0
with:
workload_identity_provider: "projects/885434704038/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider"
service_account: "[email protected]"
- uses: google-github-actions/deploy-cloud-functions@v0
with:
name: ${{ needs.get-prefix.outputs.name_prefix }}data-gateway-sessions
source_dir: data_gateway_sessions
entry_point: extract_and_add_new_measurement_sessions
memory_mb: 8192
region: europe-west6
runtime: python39
timeout: 540
service_account_email: [email protected]