-
Notifications
You must be signed in to change notification settings - Fork 17
90 lines (81 loc) · 3.01 KB
/
onboarding-api.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
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
85
86
87
88
89
90
name: Onboarding API
on:
pull_request:
paths:
- 'onboarding-api/**'
- '.github/workflows/onboarding-api.yml'
- '.github/actions/deploy-gfunction'
- '.github/actions/build-function'
workflow_call:
inputs:
deploy_env:
type: string
required: false
env:
# This needs to match the env: settings in prod-deploy.yml
app_name: onboarding-api
function_handler: onboarding
artifact_name: "onboarding-api${{ inputs.deploy_env && format('-{0}', inputs.deploy_env) }}"
concurrency:
# Fancy concurrency group string to allow for multi-staging deployments
group: 'onboarding-api-${{ inputs.deploy_env || github.event.inputs.deploy_env }}@${{ github.event.name }}${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
cancel-in-progress: true
jobs:
build-onboarding-api:
if: ${{ inputs.deploy_env != 'production' }}
runs-on: ubuntu-latest
defaults:
run:
working-directory: onboarding-api
steps:
- name: Checkout
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: prepare env logic
id: prepare
uses: ./.github/actions/prepare-deploy
with:
app_base_name: ${{ env.app_name }}
deploy_to: ${{ inputs.deploy_env }}
- name: build function
uses: ./.github/actions/build-function
with:
app_name: ${{ env.app_name }}
artifact_name: ${{ env.artifact_name }}
- name: Archive staging artifacts
id: archive_staging
if: inputs.deploy_env == 'staging' && github.event_name == 'release'
uses: ./.github/actions/archive-release
with:
name: ${{ env.app_name }}
path: ./${{ env.app_name }}/dist
outputs:
gh_env: ${{ steps.prepare.outputs.gh_env }}
function_name: ${{ steps.prepare.outputs.function_name }}
deploy-onboarding-api:
concurrency:
# Don't try to deploy the same function in parallel
group: deploy-${{ needs.build-onboarding-api.outputs.function_name }}-${{ github.event.name}}
cancel-in-progress: true
needs: build-onboarding-api
runs-on: ubuntu-latest
environment: ${{ needs.build-onboarding-api.outputs.gh_env }}
permissions:
contents: 'read'
id-token: 'write'
steps:
- name: Checkout
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
with:
path: apps
- name: Deploy Gfunction
id: functionsdeploy
uses: ./apps/.github/actions/deploy-gfunction
with:
app_name: ${{ env.app_name }}
artifact_name: ${{ env.artifact_name }}
GWIP: ${{ secrets.GWIP }}
GSA: ${{ secrets.GSA }}
target: ${{ env.function_handler }}
service_account: "${{ vars.ONBOARDING_FUNCT_SA }}"
gcloud_region: ${{ vars.GCLOUD_REGION }}
deploy_env: ${{ inputs.deploy_env }}