Skip to content

CD Pipeline

CD Pipeline #52

Workflow file for this run

name: CD Pipeline
on:
workflow_run:
workflows: ["CI Pipeline"]
types:
- completed
branches: [ main ]
jobs:
build-and-deploy:
name: Build and Deploy to Azure
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' && github.ref == 'refs/heads/main' }}
steps:
- name: Checkout the repository
uses: actions/checkout@v4
- name: Login to Azure
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Login to Azure Container Registry
uses: azure/docker-login@v1
with:
login-server: ${{ secrets.REGISTRY_NAME }}.azurecr.io
username: ${{ secrets.ACR_USERNAME }}
password: ${{ secrets.ACR_PASSWORD }}
- name: Build and push Docker image with ACR
run: |
az acr build --registry ${{ secrets.REGISTRY_NAME }} \
--image ${{ secrets.REGISTRY_NAME }}.azurecr.io/${{ secrets.IMAGE_NAME }}:${{ github.sha }} \
--platform linux/amd64 \
.
az acr build --registry ${{ secrets.REGISTRY_NAME }} \
--image ${{ secrets.REGISTRY_NAME }}.azurecr.io/${{ secrets.IMAGE_NAME }}:latest \
--platform linux/amd64 \
.