Skip to content

Update package.json #244

Update package.json

Update package.json #244

name: pr_check_windows_container_publishprofile
on:
push:
branches:
- master
- releases/*
paths-ignore:
- '**.md'
pull_request_target:
branches:
- master
- 'releases/*'
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@v1
with:
creds: ${{ secrets.AZURE_WEBAPP_SPN }}
- 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.ref }}
- name: Installing dependencies and building latest changes in action
run: |
cd webapps-deploy
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