Skip to content

Commit 29dc792

Browse files
committed
cicd: Init
1 parent 182f320 commit 29dc792

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

.github/workflows/ci-cd.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Build and Deploy to Azure Web App
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- ci-cd-init
8+
9+
env:
10+
AZURE_WEBAPP_NAME: "dssa-business"
11+
IMAGE_NAME: "business"
12+
TAG: "latest"
13+
14+
permissions:
15+
id-token: write
16+
contents: read
17+
18+
jobs:
19+
build_and_deploy:
20+
runs-on: ubuntu-latest
21+
22+
steps:
23+
- name: Checkout repository
24+
uses: actions/checkout@v4
25+
26+
# Log in to Azure via OIDC
27+
- name: Azure Login
28+
uses: azure/login@v2
29+
with:
30+
client-id: ${{ secrets.AZURE_CLIENT_ID }}
31+
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
32+
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
33+
34+
- name: Docker Login to ACR using Workload Identity Federation
35+
uses: docker/login-action@v3
36+
with:
37+
registry: ${{ secrets.ACR_LOGIN_SERVER }}
38+
workload_identity_token: ${{ steps.azure_login.outputs.id-token }}
39+
40+
- name: Build and Push Docker Image
41+
uses: docker/build-push-action@v6
42+
with:
43+
context: .
44+
file: DocuSign.MyBusiness/DocuSign.MyBusiness/Dockerfile
45+
push: true
46+
tags: ${{ secrets.ACR_LOGIN_SERVER }}/${{ env.IMAGE_NAME }}:${{ env.TAG }}
47+
48+
- name: Restart Azure Web App
49+
run: |
50+
az webapp restart --name ${{ env.AZURE_WEBAPP_NAME }} --resource-group ${{ secrets.AZURE_RESOURCE_GROUP }}

0 commit comments

Comments
 (0)