-
Notifications
You must be signed in to change notification settings - Fork 195
106 lines (94 loc) · 3.33 KB
/
pr_check_windows_container_pubprofile.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
name: pr_check_windows_container_publishprofile
on:
push:
branches:
- master
- releases/*
paths-ignore:
- '**.md'
pull_request:
branches:
- master
- 'releases/*'
permissions:
id-token: write
env:
AZURE_WEBAPP_NAME: wincontainerswebapp # set this to your application's name
CONTAINER_REGISTRY: webdeployprtestscontainerregistry.azurecr.io # set secret with Container Registry URL, example : xyz.azurecr.io
jobs:
build-and-deploy:
environment: automation test
name: Validate PR
runs-on: windows-latest
steps:
# checkout the repo
- name: 'Checkout Github Action'
uses: actions/checkout@master
with:
repository: GH-ACE/python_container_App
ref: main
path: 'python_container_App'
- name: Azure authentication
uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: Logout from Azure Container Registry
run: |
docker logout env.CONTAINER_REGISTRY
- name: Login to Azure Container Registry
uses: azure/docker-login@v1
with:
login-server: ${{ env.CONTAINER_REGISTRY }}
username: ${{ secrets.WEBDEPLOY_TEST_ACR_USERNAME }}
password: ${{ secrets.WEBDEPLOY_TEST_ACR_PASSWORD }}
- name: Pull and tag an image and push it to ACR
run: |
pwd
cd python_container_App
docker pull mcr.microsoft.com/azure-app-service/windows/canary:5.0-nanoserver
docker tag mcr.microsoft.com/azure-app-service/windows/canary:5.0-nanoserver ${{ env.CONTAINER_REGISTRY }}/containerwebapp/canaryreplica:latest
docker push ${{ env.CONTAINER_REGISTRY }}/containerwebapp/canaryreplica:latest
- name: Set Web App ACR authentication
uses: Azure/appservice-settings@v1
with:
app-name: ${{ env.AZURE_WEBAPP_NAME }}
app-settings-json: |
[
{
"name": "DOCKER_REGISTRY_SERVER_PASSWORD",
"value": "${{ secrets.WEBDEPLOY_TEST_ACR_PASSWORD }}",
"slotSetting": false
},
{
"name": "DOCKER_REGISTRY_SERVER_URL",
"value": "https://${{ env.CONTAINER_REGISTRY }}",
"slotSetting": false
},
{
"name": "DOCKER_REGISTRY_SERVER_USERNAME",
"value": "${{ secrets.WEBDEPLOY_TEST_ACR_USERNAME }}",
"slotSetting": false
}
]
- name: Checkout from PR branch
uses: actions/checkout@v2
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
path: 'webapps-deploy'
ref: ${{ github.event.pull_request.head.sha }}
- name: Installing dependencies and building latest changes in action
run: |
cd webapps-deploy
if (-NOT(TEST-PATH node_modules))
{
npm install
npm run build
}
- name: 'Deploy to Azure WebApp'
uses: ./webapps-deploy/
with:
app-name: ${{ env.AZURE_WEBAPP_NAME }} # Replace with your app name
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }}
images: ${{ env.CONTAINER_REGISTRY }}/containerwebapp/canaryreplica:latest