docs: access and ZITADEL #7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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@v3 | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Login to Google Artifact Registry | |
uses: docker/login-action@v2 | |
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@v3 | |
- name: Google Cloud Credentials | |
uses: google-github-actions/auth@v0 | |
with: | |
credentials_json: "${{ secrets.GOOGLE_DEPLOYER }}" | |
- uses: hashicorp/setup-terraform@v2 | |
- 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 }} |