forked from 3rd-Eden/memcached
-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (53 loc) · 1.96 KB
/
dev.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
name: Deploy API Gateway
on:
workflow_dispatch:
inputs:
environment:
description: "API Gateway Environment to deploy"
required: true
type: choice
options:
- dev
- staging
- prod
jobs:
deploy-api-gateway:
name: Deploy API Gateway
runs-on: ubuntu-latest
timeout-minutes: 20
env:
CONFIG_NAME: "api-${{ inputs.environment }}-${{ github.run_id }}-${{ github.run_attempt }}"
OPENAPI_SPEC_PATH: "${{ inputs.environment }}.yaml"
permissions:
contents: "write"
id-token: "write"
steps:
- name: Set Gateway Name environment variable
run: |
if [[ ${{ inputs.environment }} == prod ]]; then
echo "GATEWAY_NAME=binit-api-gateway" >> $GITHUB_ENV
elif [[ ${{ inputs.environment }} == staging ]]; then
echo "GATEWAY_NAME=binit-api-gateway-staging" >> $GITHUB_ENV
else
echo "GATEWAY_NAME=binit-api-gateway-dev" >> $GITHUB_ENV
fi
- name: Checkout Repo
id: "checkout"
uses: actions/checkout@v3
with:
persist-credentials: false
- name: Authenticate with GCloud
id: "auth"
uses: "google-github-actions/[email protected]"
with:
workload_identity_provider: "projects/354086251636/locations/global/workloadIdentityPools/gh-ci-pool/providers/gh-ci-provider"
service_account: "[email protected]"
- name: Create new API Config
run: |
gcloud api-gateway api-configs create $CONFIG_NAME \
--api=binit-api --openapi-spec=$OPENAPI_SPEC_PATH \
--project=binit-244703 --backend-auth-service-account=api-gateway@binit-244703.iam.gserviceaccount.com
- name: Update API Gateway
run: |
gcloud api-gateway gateways update $GATEWAY_NAME \
--api-config=$CONFIG_NAME --api=binit-api --location=us-east1 --project=binit-244703