Build-and-push-v1.0-images #2
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: Build-and-push-v1.0-images | |
on: | |
workflow_dispatch: | |
permissions: | |
contents: write | |
pull-requests: write | |
id-token: write | |
jobs: | |
build-and-deploy-v1-image: | |
if: ${{ github.repository != 'microsoft/jumpstart-agora-apps' }} && github.event.pull_request.merged == true | |
runs-on: ubuntu-latest | |
steps: | |
# checkout the repo | |
- name: 'Checkout repository' | |
uses: actions/checkout@v4 | |
- name: 'Login to ACR' | |
uses: azure/docker-login@v1 | |
with: | |
login-server: "${{ secrets.ACR_NAME }}.azurecr.io" | |
username: ${{ secrets.SPN_CLIENT_ID }} | |
password: ${{ secrets.SPN_CLIENT_SECRET }} | |
- name: 'Build and push pos v1.0 images' | |
env: | |
latest_tag: "v1.0" | |
uses: nick-fields/retry@v3 | |
with: | |
timeout_minutes: 25 | |
retry_on: error | |
max_attempts: 3 | |
command: | | |
branches=("production" "staging" "canary" "main") | |
# Build pos image for each branch | |
for branch in "${branches[@]}"; do | |
if [ $branch == "main" ]; then | |
branch="dev" | |
fi | |
docker build ./contoso_supermarket/developer/pos/src -t "${{ secrets.ACR_NAME }}.azurecr.io/$branch/contoso-supermarket/pos:$latest_tag" | |
docker push ${{ secrets.ACR_NAME }}.azurecr.io/$branch/contoso-supermarket/pos:$latest_tag | |
done | |
- name: 'Build and push cloudSync v1.0 images' | |
env: | |
latest_tag: "v1.0" | |
uses: nick-fields/retry@v3 | |
with: | |
timeout_minutes: 25 | |
retry_on: error | |
max_attempts: 3 | |
command: | | |
# Build cloudSync image for each branch | |
branches=("production" "staging" "canary" "main") | |
for branch in "${branches[@]}"; do | |
if [ $branch == "main" ]; then | |
branch="dev" | |
fi | |
docker build ./contoso_supermarket/developer/pos/src/cloud_sync -t "${{ secrets.ACR_NAME }}.azurecr.io/$branch/contoso-supermarket/pos-cloudsync:v1.0" | |
docker push ${{ secrets.ACR_NAME }}.azurecr.io/$branch/contoso-supermarket/pos-cloudsync:v1.0 | |
done | |
- name: 'Build and push contosoAi v1.0 images' | |
env: | |
latest_tag: "v1.0" | |
uses: nick-fields/retry@v3 | |
with: | |
timeout_minutes: 25 | |
retry_on: error | |
max_attempts: 3 | |
command: | | |
# Build contosoAi image for each branch | |
branches=("production" "staging" "canary" "main") | |
for branch in "${branches[@]}"; do | |
if [ $branch == "main" ]; then | |
branch="dev" | |
fi | |
docker build ./contoso_supermarket/developer/ai/src -t "${{ secrets.ACR_NAME }}.azurecr.io/$branch/contoso-supermarket/contosoai:v1.0" | |
docker push ${{ secrets.ACR_NAME }}.azurecr.io/$branch/contoso-supermarket/contosoai:v1.0 | |
done | |
- name: 'Build and push queue monitoring backend v1.0 images' | |
env: | |
latest_tag: "v1.0" | |
uses: nick-fields/retry@v3 | |
with: | |
timeout_minutes: 25 | |
retry_on: error | |
max_attempts: 3 | |
command: | | |
# Build queue monitoring backend image for each branch | |
branches=("production" "staging" "canary" "main") | |
for branch in "${branches[@]}"; do | |
if [ $branch == "main" ]; then | |
branch="dev" | |
fi | |
docker build ./contoso_supermarket/developer/queue_monitoring_backend/src -t "${{ secrets.ACR_NAME }}.azurecr.io/$branch/contoso-supermarket/queue-monitoring-backend:v1.0" | |
docker push ${{ secrets.ACR_NAME }}.azurecr.io/$branch/contoso-supermarket/queue-monitoring-backend:v1.0 | |
done | |
- name: 'Build and push queue monitoring frontend v1.0 images' | |
env: | |
latest_tag: "v1.0" | |
uses: nick-fields/retry@v3 | |
with: | |
timeout_minutes: 25 | |
retry_on: error | |
max_attempts: 3 | |
command: | | |
# Build queue monitoring frontend image for each branch | |
branches=("production" "staging" "canary" "main") | |
for branch in "${branches[@]}"; do | |
if [ $branch == "main" ]; then | |
branch="dev" | |
fi | |
docker build ./contoso_supermarket/developer/queue_monitoring_frontend/src -t "${{ secrets.ACR_NAME }}.azurecr.io/$branch/contoso-supermarket/queue-monitoring-frontend:v1.0" | |
docker push ${{ secrets.ACR_NAME }}.azurecr.io/$branch/contoso-supermarket/queue-monitoring-frontend:v1.0 | |
done |