Skip to content

Fix DB Deployment Connection #4

Fix DB Deployment Connection

Fix DB Deployment Connection #4

Workflow file for this run

---
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# GitHub recommends pinning actions to a commit SHA.
# To get a newer version, you will need to update the SHA.
# You can also reference a tag or branch, but the action may change without warning.
name: Deploy API
on:
push:
branches: [main]
paths:
- 'api/**'
pull_request:
branches: [main]
jobs:
push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
attestations: write
id-token: write
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Log in to Docker Hub
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: noremacskich/expressedrealms-api
- name: Build and push Docker image
id: push
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
with:
context: ./api
file: ./api/Dockerfile
push: true
tags: noremacskich/expressedrealms-api:${{ github.sha }}
labels: ${{ steps.meta.outputs.labels }}
# - name: Generate artifact attestation
# uses: actions/attest-build-provenance@v1
# with:
# subject-name: noremacskich/expressedrealms-frontend
# subject-digest: ${{ steps.push.outputs.digest }}
# push-to-registry: true
- name: Azure Login
uses: azure/login@v1
with:
client-id: ${{ secrets.EXPRESSEDREALMSAPI_AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.EXPRESSEDREALMSAPI_AZURE_TENANT_ID }}
subscription-id: ${{ secrets.EXPRESSEDREALMSAPI_AZURE_SUBSCRIPTION_ID }}
- name: Build and push container image to registry
uses: azure/container-apps-deploy-action@v2
with:
registryUrl: ${{ vars.EXPRESSEDREALMSFRONTEND_REGISTRY_URL }}
registryUsername: ${{ secrets.EXPRESSEDREALMSFRONTEND_REGISTRY_USERNAME }}
registryPassword: ${{ secrets.EXPRESSEDREALMSAPI_REGISTRY_PASSWORD }}
imageToDeploy: ${{ vars.EXPRESSEDREALMSFRONTEND_REGISTRY_URL }}/noremacskich/expressedrealms-api:${{ github.sha }}
containerAppName: ca-expressedrealms-api
resourceGroup: RG_ExpressedRealms