Skip to content

Build and deploy MHA to Azure Test Slot #30

Build and deploy MHA to Azure Test Slot

Build and deploy MHA to Azure Test Slot #30

# 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@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
with:
egress-policy: audit
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
- name: Set up Node.js
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
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
- name: Upload artifact for deployment job
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
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@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
with:
egress-policy: audit
- name: Download artifact from build job
uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4
with:
name: mha-assets
- name: Deploy to Azure Web App
id: deploy-to-webapp
uses: azure/webapps-deploy@de617f46172a906d0617bb0e50d81e9e3aec24c8 # v3.0.1
with:
app-name: 'mha'
slot-name: 'test'
publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_8B9270081C8C4359868F6FB6FC30EF71 }}
package: .