1+ on : [push]
2+
3+ jobs :
4+ build-and-deploy :
5+ runs-on : ubuntu-latest
6+ steps :
7+ - name : ' Checkout Github Action'
8+ uses : actions/checkout@master
9+
10+ - name : ' Login via Azure CLI'
11+ uses : azure/login@v1
12+ with :
13+ creds : ${{ secrets.AZURE_CREDENTIALS }}
14+
15+ - uses : azure/docker-login@v1
16+ with :
17+ login-server : bcdemo.azurecr.io
18+ username : ${{ secrets.acr_bcdemo_username }}
19+ password : ${{ secrets.acr_bcdemo_password }}
20+
21+ - name : Build and push image to ACR
22+ id : build-image
23+ run : |
24+ docker build "$GITHUB_WORKSPACE/" -f "Dockerfile" -t bcdemo.azurecr.io/pythondemoapp-img:${{ github.sha }}
25+ docker push bcdemo.azurecr.io/pythondemoapp-img:${{ github.sha }}
26+
27+ - name : Set Web App ACR authentication
28+ uses : Azure/appservice-settings@v1
29+ with :
30+ app-name : python-demoapp
31+ app-settings-json : |
32+ [
33+ {
34+ "name": "DOCKER_REGISTRY_SERVER_URL",
35+ "value": "bcdemo.azurecr.io",
36+ "slotSetting": false
37+ },
38+ {
39+ "name": "DOCKER_REGISTRY_SERVER_USERNAME",
40+ "value": "${{ secrets.acr_bcdemo_username }}",
41+ "slotSetting": false
42+ },
43+ {
44+ "name": "DOCKER_REGISTRY_SERVER_PASSWORD",
45+ "value": "${{ secrets.acr_bcdemo_password }}",
46+ "slotSetting": false
47+ }
48+ ]
49+
50+ - uses : azure/webapps-deploy@v2
51+ with :
52+ app-name : python-demoapp
53+ images : bcdemo.azurecr.io/pythondemoapp-img:${{ github.sha }}
0 commit comments