-
Notifications
You must be signed in to change notification settings - Fork 0
62 lines (52 loc) · 1.64 KB
/
release.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
53
54
55
56
57
58
59
60
61
62
name: release
on:
push:
branches:
- main
env:
IMAGE_NAME: eu.gcr.io/rejsekort/rejsekort-python
jobs:
deploy:
# Add "id-token" with the intended permissions.
permissions:
contents: read
id-token: write
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Authenticate with Google Cloud
id: auth
uses: google-github-actions/auth@v2
with:
workload_identity_provider: ${{ secrets.WORKLOAD_IDENTITY_POOL_PROVIDER }}
service_account: ${{ secrets.REJSEKORT_SERVICE_ACCOUNT_EMAIL }}
# Setup gcloud CLI
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v2
# Configure Docker to use the gcloud command-line tool as a credential
# helper for authentication
- name: GCloud Docker Auth
run: |-
gcloud --quiet auth configure-docker
# - name: Get Version Tag
# id: get_release_tag
# run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- name: Build an image from Dockerfile
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: |
${{ env.IMAGE_NAME }}:${{ github.sha }}
${{ env.IMAGE_NAME }}:latest
- name: Deploy to Cloud Run
id: deploy
uses: google-github-actions/deploy-cloudrun@v2
with:
service: rejsekort
region: europe-west1
image: "${{ env.IMAGE_NAME }}:${{ github.sha }}"
env_vars: ENV=production
- name: Use output
run: curl ${{ steps.deploy.outputs.url }}