Skip to content

Merge pull request #36 from devopsabcs-engineering/feature/fix-crawl-… #49

Merge pull request #36 from devopsabcs-engineering/feature/fix-crawl-…

Merge pull request #36 from devopsabcs-engineering/feature/fix-crawl-… #49

Workflow file for this run

name: Build and Deploy to Azure
on:
push:
branches: [main]
workflow_dispatch:
env:
RESOURCE_GROUP: rg-a11y-scan-demo
APP_NAME: a11y-scan-demo
permissions:
id-token: write
contents: read
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Azure Login
uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: Deploy infrastructure
uses: azure/arm-deploy@v2
id: infra
with:
resourceGroupName: ${{ env.RESOURCE_GROUP }}
template: ./infra/main.bicep
parameters: appName=${{ env.APP_NAME }} imageTag=${{ github.sha }}
- name: Log in to ACR
run: |
ACR_NAME=${{ steps.infra.outputs.acrName }}
az acr login --name $ACR_NAME
- name: Build and push Docker image
run: |
ACR_LOGIN_SERVER=${{ steps.infra.outputs.acrLoginServer }}
IMAGE=$ACR_LOGIN_SERVER/${{ env.APP_NAME }}
docker build -t $IMAGE:${{ github.sha }} -t $IMAGE:latest .
docker push $IMAGE:${{ github.sha }}
docker push $IMAGE:latest
- name: Restart Web App
run: |
az webapp restart --name ${{ steps.infra.outputs.webAppName }} --resource-group ${{ env.RESOURCE_GROUP }}
- name: Add deployment link to summary
run: |
echo "## 🚀 Deployment Successful" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Site:** [${{ steps.infra.outputs.webAppUrl }}](${{ steps.infra.outputs.webAppUrl }})" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Commit:** \`${{ github.sha }}\`" >> $GITHUB_STEP_SUMMARY