-
Notifications
You must be signed in to change notification settings - Fork 0
63 lines (55 loc) · 2.19 KB
/
app-gcp-api-CD.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
name: api-CD
on:
workflow_dispatch:
push:
branches: [master]
paths: 'api/**'
env:
REGION: ${{ secrets.REGION }}
SERVICE: ${{ secrets.CLOUD_RUN_API_SERVICE}}
jobs:
api-CD:
name: api-CD
permissions:
contents: 'read'
id-token: 'write'
runs-on: ubuntu-latest
environment: gcp-deploy
defaults:
run:
working-directory: ./api/
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Google Auth
id: auth
uses: 'google-github-actions/auth@v1'
with:
workload_identity_provider: '${{ secrets.WIF_PROVIDER }}' # e.g. - projects/123456789/locations/global/workloadIdentityPools/my-pool/providers/my-provider
service_account: '${{ secrets.WIF_SERVICE_ACCOUNT }}' # e.g. - [email protected]
- name: Deploy to Cloud Run
id: deploy
uses: google-github-actions/deploy-cloudrun@v1
with:
service: ${{ env.SERVICE }}
region: ${{ env.REGION }}
env_vars: |
DATABASE_URI=${{ secrets.DATABASE_URI }}
MYSQL_DATABASE_URI=${{ secrets.MYSQL_DATABASE_URI }}
REDIS_URI=${{ secrets.REDIS_URI }}
JWT_SECRET=${{ secrets.JWT_SECRET }}
JWT_EXPIRES_IN=${{ secrets.JWT_EXPIRES_IN }}
JWT_REFRESH_EXPIRES_IN=${{ secrets.JWT_REFRESH_EXPIRES_IN }}
AWS_REGION=${{ secrets.AWS_REGION }}
AWS_S3_IMAGE_MAIN_BUCKET=${{ secrets.AWS_S3_IMAGE_MAIN_BUCKET }}
MEMORY_CACHE_DEFAULT_TTL=${{ secrets.MEMORY_CACHE_DEFAULT_TTL }}
MEMORY_CACHE_DEFAULT_MAX=${{ secrets. MEMORY_CACHE_DEFAULT_MAX }}
IMAGE_PROCESS_SERVICE_URL=${{ secrets.IMAGE_PROCESS_SERVICE_URL }}
SESSION_EXPIRES_IN=${{ secrets.SESSION_EXPIRES_IN }}
FIREBASE_PROJECT_ID=${{ secrets.FIREBASE_PROJECT_ID }}
FIREBASE_CLIENT_EMAIL=${{ secrets.FIREBASE_CLIENT_EMAIL }}
FIREBASE_PRIVATE_KEY=${{ secrets.FIREBASE_PRIVATE_KEY }}
image: ${{ secrets.DOCKER_IMAGE_API_TAG }}
# If required, use the Cloud Run url output in later steps
- name: Show Output
run: echo ${{ steps.deploy.outputs.url }}