Build and deploy MHA to Azure Test Slot #33
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy | |
# More GitHub Actions for Azure: https://github.com/Azure/actions | |
name: Build and deploy MHA to Azure Test Slot | |
on: | |
workflow_dispatch: | |
permissions: | |
contents: read | |
jobs: | |
build: | |
runs-on: windows-latest | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2 | |
with: | |
egress-policy: audit | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Set up Node.js | |
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
cache: 'npm' | |
- name: NPM install, build | |
env: | |
SCM_COMMIT_ID: ${{ github.sha }} | |
APPINSIGHTS_INSTRUMENTATIONKEY: ${{ secrets.APPINSIGHTS_INSTRUMENTATIONKEY }} | |
run: | | |
npm ci | |
npm run build --if-present | |
npm run test --if-present | |
- name: Upload artifact for deployment job | |
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 | |
with: | |
name: mha-assets | |
path: | | |
Pages | |
Resources | |
favicon.ico | |
Manifest* | |
LICENSE | |
README.md | |
package.json | |
.deployment | |
deploy.cmd | |
Web.config | |
deploy: | |
runs-on: windows-latest | |
needs: build | |
environment: | |
name: 'Production' | |
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }} | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2 | |
with: | |
egress-policy: audit | |
- name: Download artifact from build job | |
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 | |
with: | |
name: mha-assets | |
- name: Deploy to Azure Web App | |
id: deploy-to-webapp | |
uses: azure/webapps-deploy@2fdd5c3ebb4e540834e86ecc1f6fdcd5539023ee # v3.0.2 | |
with: | |
app-name: 'mha' | |
slot-name: 'test' | |
publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_8B9270081C8C4359868F6FB6FC30EF71 }} | |
package: . |