-
Notifications
You must be signed in to change notification settings - Fork 0
53 lines (50 loc) · 2.03 KB
/
cloud-run.yaml
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
name: Deploy to Cloud Run
on:
workflow_dispatch:
inputs:
tag:
description: 'Tag to deploy'
required: true
jobs:
deploy:
name: Deploy to Cloud Run
runs-on: ubuntu-latest
strategy:
matrix:
app: ["contract_service", "block_info_service", "analytics_service", "transaction_service", "user_service"]
fail-fast: false
steps:
- uses: actions/checkout@v3
- name: Login to GCP
uses: google-github-actions/auth@v0
with:
credentials_json: ${{ secrets.GCP_CREDENTIALS }}
- name: Configure Docker for GCP
run: gcloud auth configure-docker --quiet
- name: Pull image from GitHub Container Registry
run: docker pull ghcr.io/${{ github.repository }}/${{ matrix.app }}:${{ github.event.inputs.tag }}
- name: Tag image for GCR
run: docker tag ghcr.io/${{ github.repository }}/${{ matrix.app }}:${{ github.event.inputs.tag }} gcr.io/${{ secrets.GCP_PROJECT_ID }}/${{ matrix.app }}:${{ github.event.inputs.tag }}
- name: Push image to GCR
run: docker push gcr.io/${{ secrets.GCP_PROJECT_ID }}/${{ matrix.app }}:${{ github.event.inputs.tag }}
- uses: frabert/[email protected]
id: runner
with:
pattern: '_'
string: ${{matrix.app}}
replace-with: '-'
flags: "g"
- id: 'deploy'
uses: 'google-github-actions/deploy-cloudrun@v0'
with:
service: ${{ steps.runner.outputs.replaced }}
image: gcr.io/${{ secrets.GCP_PROJECT_ID }}/${{ matrix.app }}:${{ github.event.inputs.tag }}
env_vars:
DATABASE_URL=${{ secrets.DATABASE_TEST_URL }},
JWT_SECRET=${{ secrets.JWT_SECRET }},
RPC_URL=${{secrets.RPC_TEST_URL}},
REDIS_URL=${{secrets.REDIS_TEST_URL}},
USER_SERVICE_URL=https://user.test.etdstatsapi.net,
SOLIDITY_SERVICE_URL=https://functions.etdstatsapi.net/api/solidity/compile
region: asia-southeast1
flags: --allow-unauthenticated