-
Notifications
You must be signed in to change notification settings - Fork 31
54 lines (44 loc) · 1.25 KB
/
main.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
name: main
on:
push:
branches: ["main"]
env:
REGISTRY: docker.io
IMAGE: ${{ github.repository }}
SERVICE: web
jobs:
deploy:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
# Only one release at a time and cancel prior releases
concurrency:
group: release
cancel-in-progress: true
steps:
- uses: actions/checkout@v3
# I'm paying for Depot for faster ARM builds.
- uses: depot/setup-action@v1
# Log into the docker registry via the GCP token
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
# Build and push Docker image with Depot
- uses: depot/build-push-action@v1
with:
project: hppp3x0qjc
context: .
push: true
tags: ${{env.REGISTRY}}/${{env.IMAGE}}
# Log in to GCP
- uses: google-github-actions/auth@v1
with:
credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT_KEY }}
# Deploy to cloud run
- uses: google-github-actions/deploy-cloudrun@v1
with:
service: ${{env.SERVICE}}
image: ${{env.REGISTRY}}/${{env.IMAGE}}