Skip to content

Commit 2c2e8d9

Browse files
authored
Add GitHub Actions workflow for Azure deployment
1 parent 71dc0e6 commit 2c2e8d9

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Deploy specific image tag to Azure Web App (Container)
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
image_tag:
7+
description: "Container tag to deploy (e.g., v1.2.3)"
8+
required: true
9+
10+
permissions:
11+
id-token: write # needed for OIDC login [oai_citation:0‡GitHub](https://github.com/Azure/login)
12+
contents: read
13+
14+
env:
15+
RESOURCE_GROUP: students-new-lab-rg
16+
WEBAPP_NAME: python-lidor
17+
ACR_LOGIN_SERVER: index.docker.io
18+
IMAGE_NAME: lidorlg/lidor-python-sce
19+
20+
jobs:
21+
deploy:
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: Azure login (OIDC)
25+
uses: azure/login@v2
26+
with:
27+
client-id: ${{ secrets.AZURE_CLIENT_ID }}
28+
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
29+
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} # [oai_citation:1‡GitHub](https://github.com/Azure/login)
30+
31+
# (Recommended) Ensure the Web App is configured to pull from your private registry
32+
# If you already configured this in Azure Portal / IaC, you can remove this step.
33+
- name: Point Web App to the requested image tag
34+
run: |
35+
az webapp config container set \
36+
--resource-group "${{ env.RESOURCE_GROUP }}" \
37+
--name "${{ env.WEBAPP_NAME }}" \
38+
--container-image-name "${{ env.ACR_LOGIN_SERVER }}/${{ env.IMAGE_NAME }}:${{ inputs.image_tag }}" \
39+
--container-registry-url "https://${{ env.ACR_LOGIN_SERVER }}" \
40+
az webapp restart --resource-group "${{ env.RESOURCE_GROUP }}" --name "${{ env.WEBAPP_NAME }}"

0 commit comments

Comments
 (0)