diff --git a/.github/workflows/pr_check_webapp_dotnet_windows.yml b/.github/workflows/pr_check_webapp_dotnet_windows.yml new file mode 100644 index 000000000..cc6d26e84 --- /dev/null +++ b/.github/workflows/pr_check_webapp_dotnet_windows.yml @@ -0,0 +1,83 @@ +name: pr_check_webapp_dotnet_windows + +on: + push: + branches: + - master + - releases/* + paths-ignore: + - '**.md' + pull_request_target: + branches: + - master + - 'releases/*' + +# CONFIGURATION +# For help, go to https://github.com/Azure/Actions +# +# 1. Set up the following secrets in your repository: +# AZURE_WEBAPP_PUBLISH_PROFILE +# +# 2. Change these variables for your configuration: +env: + AZURE_WEBAPP_NAME: dotnetwebapplima # set this to your application's name + AZURE_WEBAPP_PACKAGE_PATH: '.' # set this to the path to your web app project, defaults to the repository root + NUGET_VERSION: '5.3.1' # set this to the node version to use + +jobs: + run-integration-test: + environment: automation test + name: Validate PR + strategy: + matrix: + os: [windows-latest] + runs-on: ${{ matrix.os }} + steps: + - name: Checkout + uses: actions/checkout@v2 + + - uses: actions/checkout@master + with: + repository: Azure-Samples/dotnet-sample + ref: master + path: 'dotnetsample' + + - name: Install Nuget + uses: nuget/setup-nuget@v1 + with: + nuget-version: ${{ env.NUGET_VERSION}} + - name: NuGet to restore dependencies as well as project-specific tools that are specified in the project file + run: | + pwd + cd dotnetsample + nuget restore + + - name: Add msbuild to PATH + uses: microsoft/setup-msbuild@v1.0.2 + + - name: Run MSBuild + run: msbuild .\dotnetsample\SampleWebApplication.sln + + - uses: actions/checkout@v2 + name: Checkout from PR branch + with: + repository: Azure/webapps-deploy + path: 'webapps-deploy' + + - name: Installing dependencies and building latest changes + run: | + cd webapps-deploy + npm install + npm run build + + - name: Azure authentication + uses: azure/login@v1 + with: + creds: ${{ secrets.AZURE_WEBAPP_SPN }} + + - 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 }} # Define secret variable in repository settings as per action documentation + package: 'D:\a\webapps-deploy\webapps-deploy\dotnetsample\SampleWebApplication\' diff --git a/.github/workflows/pr_check_windows_container_pubprofile.yml b/.github/workflows/pr_check_windows_container_pubprofile.yml new file mode 100644 index 000000000..fc9aeb17f --- /dev/null +++ b/.github/workflows/pr_check_windows_container_pubprofile.yml @@ -0,0 +1,90 @@ +name: pr_check_windows_container_publishprofile + +on: + push: + branches: + - master + - releases/* + paths-ignore: + - '**.md' + pull_request_target: + branches: + - master + - 'releases/*' + +env: + AZURE_WEBAPP_NAME: windowscontainerwebapp # set this to your application's name + CONTAINER_REGISTRY: l2testscontainerregistry.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 }} + + - uses: azure/docker-login@v1 + with: + login-server: l2testscontainerregistry.azurecr.io + username: ${{ secrets.L2TEST_ACR_USERNAME }} + password: ${{ secrets.L2TEST_ACR_PASSWORD }} + + - 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.L2TEST_ACR_PASSWORD }}", + "slotSetting": false + }, + { + "name": "DOCKER_REGISTRY_SERVER_URL", + "value": "https://${{ env.CONTAINER_REGISTRY }}", + "slotSetting": false + }, + { + "name": "DOCKER_REGISTRY_SERVER_USERNAME", + "value": "${{ secrets.L2TEST_ACR_USERNAME }}", + "slotSetting": false + } + ] + - uses: actions/checkout@v2 + name: Checkout from PR branch + with: + repository: Azure/webapps-deploy + path: 'webapps-deploy' + + - 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