-
Notifications
You must be signed in to change notification settings - Fork 1
68 lines (57 loc) · 2.06 KB
/
deploy.yml
File metadata and controls
68 lines (57 loc) · 2.06 KB
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
on:
workflow_run:
workflows: ["Build and Prepare Docker Image"]
types:
- completed
workflow_dispatch:
name: Deploy to Cloud Run
env:
PROJECT_ID: able-balm-421213
GAR_LOCATION: europe-central2
SERVICE: ingreedio-api
REGION: europe-west1
REGISTRY: ghcr.io
IMAGE_NAME: java-dzgs/ingreedio-api
jobs:
deploy:
permissions:
contents: 'read'
id-token: 'write'
packages: 'write'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Docker auth for the GitHub Container registry
uses: docker/login-action@v3.1.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Pull latest develop Backend image
run: |-
docker pull ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:develop
docker tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:develop ${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/docker-dev/ingreedio-api
- name: Google auth
id: auth
uses: 'google-github-actions/auth@v2'
with:
workload_identity_provider: '${{ secrets.WIF_PROVIDER }}'
service_account: '${{ secrets.WIF_SERVICE_ACCOUNT }}'
- name: Set up Cloud SDK
uses: 'google-github-actions/setup-gcloud@v1'
with:
project_id: '${{ env.PROJECT_ID }}'
- name: Docker auth for Cloud
run: |-
gcloud auth configure-docker ${{ env.GAR_LOCATION }}-docker.pkg.dev
- name: Docker push image to Cloud
run: |-
docker push ${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/docker-dev/ingreedio-api
- name: Deploy image to Cloud Run
id: deploy
uses: google-github-actions/deploy-cloudrun@v2
with:
service: ${{ env.SERVICE }}
region: ${{ env.REGION }}
image: ${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/docker-dev/ingreedio-api:latest