Skip to content

chore(ci): Bug fix in workflow #26

chore(ci): Bug fix in workflow

chore(ci): Bug fix in workflow #26

Workflow file for this run

name: Deploy Web
on:
workflow_dispatch:
push:
branches:
- main
- develop
paths: ['apps/web/**', '.github/workflows/deploy-web.yml', 'package.json']
jobs:
build:
runs-on: ubuntu-latest
environment: ${{ github.ref == 'refs/heads/main' && 'alpha' || 'stage' }}
name: Build and push Web docker image for release
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Docker Login
uses: azure/docker-login@v2
with:
login-server: ${{ vars.ACR_REGISTRY_URL }}
username: ${{ secrets.ACR_USERNAME }}
password: ${{ secrets.ACR_PASSWORD }}
- name: Build Docker image
id: build
env:
ACR_REGISTRY_URL: ${{ vars.ACR_REGISTRY_URL }}
REPOSITORY_NAME: web
run: |
# Build a docker container and push it to ACR
docker build -t $ACR_REGISTRY_URL/$REPOSITORY_NAME:${GITHUB_SHA::6} -t $ACR_REGISTRY_URL/$REPOSITORY_NAME:latest -f ./apps/web/Dockerfile .
echo "Pushing image to ACR..."
docker push $ACR_REGISTRY_URL/$REPOSITORY_NAME:latest
docker push $ACR_REGISTRY_URL/$REPOSITORY_NAME:${GITHUB_SHA::6}
echo "name=image::$ACR_REGISTRY_URL/$REPOSITORY_NAME:latest" >> $GITHUB_OUTPUT
deploy:
runs-on: ubuntu-latest
environment: ${{ github.ref == 'refs/heads/main' && 'alpha' || 'stage' }}
name: Restart Web container app
needs: build
steps:
- name: Azure Login action
uses: azure/login@v2
with:
creds: ${{ secrets.CONTAINER_APP_SP_CREDENTIALS }}
enable-AzPSSession: true
- name: Azure CLI script
uses: azure/cli@v2
env:
WEB_CONTAINER: ${{ vars.WEB_CONTAINER }}
WEB_CONTAINER_RG: ${{ vars.WEB_CONTAINER_RG }}
with:
azcliversion: latest
inlineScript: |
az container restart --name $WEB_CONTAINER --resource-group $WEB_CONTAINER_RG