-
Notifications
You must be signed in to change notification settings - Fork 0
69 lines (58 loc) · 1.88 KB
/
release.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
64
65
66
67
68
69
name: Release and Deploy API
on:
push:
branches:
- main
jobs:
release:
name: Create Release
runs-on: ubuntu-latest
outputs:
new_release_published: ${{ steps.semantic.outputs.new_release_published }}
new_release_version: ${{ steps.semantic.outputs.new_release_version }}
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to Google Artifact Registry
uses: docker/login-action@v3
with:
registry: europe-west6-docker.pkg.dev
username: _json_key
password: ${{ secrets.GOOGLE_DEPLOYER }}
- name: Semantic Release
id: semantic
uses: cycjimmy/semantic-release-action@v3
with:
semantic_version: 19
extra_plugins: |
@codedependant/semantic-release-docker
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
deploy:
name: Deploy API on Google Cloud Platform
runs-on: ubuntu-latest
needs:
- release
if: needs.release.outputs.new_release_published == 'true'
steps:
- uses: actions/checkout@v4
- name: Google Cloud Credentials
uses: google-github-actions/auth@v2
with:
credentials_json: "${{ secrets.GOOGLE_DEPLOYER }}"
- uses: hashicorp/setup-terraform@v3
- run: terraform init
working-directory: infrastructure
- run: terraform apply -auto-approve
working-directory: infrastructure
env:
TF_VAR_release_version: ${{ needs.release.outputs.new_release_version }}
TF_VAR_zitadel_auth: ${{ secrets.ZITADEL_DEPLOYER }}