|
| 1 | +name: pr_check_windows_container_publishprofile |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + - releases/* |
| 8 | + paths-ignore: |
| 9 | + - '**.md' |
| 10 | + pull_request_target: |
| 11 | + branches: |
| 12 | + - master |
| 13 | + - 'releases/*' |
| 14 | + |
| 15 | +env: |
| 16 | + AZURE_WEBAPP_NAME: wincontainerswebapp # set this to your application's name |
| 17 | + CONTAINER_REGISTRY: webdeploytestscontainerregistry.azurecr.io # set secret with Container Registry URL, example : xyz.azurecr.io |
| 18 | + |
| 19 | +jobs: |
| 20 | + build-and-deploy: |
| 21 | + environment: automation test |
| 22 | + name: Validate PR |
| 23 | + runs-on: windows-latest |
| 24 | + steps: |
| 25 | + # checkout the repo |
| 26 | + - name: 'Checkout Github Action' |
| 27 | + uses: actions/checkout@master |
| 28 | + with: |
| 29 | + repository: GH-ACE/python_container_App |
| 30 | + ref: main |
| 31 | + path: 'python_container_App' |
| 32 | + |
| 33 | + - name: Azure authentication |
| 34 | + uses: azure/login@v1 |
| 35 | + with: |
| 36 | + creds: ${{ secrets.AZURE_WEBAPP_SPN }} |
| 37 | + |
| 38 | + - uses: azure/docker-login@v1 |
| 39 | + with: |
| 40 | + login-server: webdeploytestscontainerregistry.azurecr.io |
| 41 | + username: ${{ secrets.WEBDEPLOY_TEST_ACR_USERNAME }} |
| 42 | + password: ${{ secrets.WEBDEPLOY_TEST_ACR_PASSWORD }} |
| 43 | + |
| 44 | + - run: | |
| 45 | + pwd |
| 46 | + cd python_container_App |
| 47 | + docker pull mcr.microsoft.com/azure-app-service/windows/canary:5.0-nanoserver |
| 48 | + docker tag mcr.microsoft.com/azure-app-service/windows/canary:5.0-nanoserver ${{ env.CONTAINER_REGISTRY }}/containerwebapp/canaryreplica:latest |
| 49 | + docker push ${{ env.CONTAINER_REGISTRY }}/containerwebapp/canaryreplica:latest |
| 50 | + |
| 51 | + - name: Set Web App ACR authentication |
| 52 | + uses: Azure/appservice-settings@v1 |
| 53 | + with: |
| 54 | + app-name: ${{ env.AZURE_WEBAPP_NAME }} |
| 55 | + app-settings-json: | |
| 56 | + [ |
| 57 | + { |
| 58 | + "name": "DOCKER_REGISTRY_SERVER_PASSWORD", |
| 59 | + "value": "${{ secrets.WEBDEPLOY_TEST_ACR_PASSWORD }}", |
| 60 | + "slotSetting": false |
| 61 | + }, |
| 62 | + { |
| 63 | + "name": "DOCKER_REGISTRY_SERVER_URL", |
| 64 | + "value": "https://${{ env.CONTAINER_REGISTRY }}", |
| 65 | + "slotSetting": false |
| 66 | + }, |
| 67 | + { |
| 68 | + "name": "DOCKER_REGISTRY_SERVER_USERNAME", |
| 69 | + "value": "${{ secrets.WEBDEPLOY_TEST_ACR_USERNAME }}", |
| 70 | + "slotSetting": false |
| 71 | + } |
| 72 | + ] |
| 73 | + - uses: actions/checkout@v2 |
| 74 | + name: Checkout from PR branch |
| 75 | + with: |
| 76 | + repository: ${{ github.event.pull_request.head.repo.full_name }} |
| 77 | + path: 'webapps-deploy' |
| 78 | + ref: ${{ github.event.pull_request.head.ref }} |
| 79 | + |
| 80 | + - name: Installing dependencies and building latest changes in action |
| 81 | + run: | |
| 82 | + cd webapps-deploy |
| 83 | + npm install |
| 84 | + npm run build |
| 85 | + |
| 86 | + - name: 'Deploy to Azure WebApp' |
| 87 | + uses: ./webapps-deploy/ |
| 88 | + with: |
| 89 | + app-name: ${{ env.AZURE_WEBAPP_NAME }} # Replace with your app name |
| 90 | + publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }} |
| 91 | + images: ${{ env.CONTAINER_REGISTRY }}/containerwebapp/canaryreplica:latest |
0 commit comments