Skip to content

Merge pull request #34 from Altinn/chore/workflow-permissions #34

Merge pull request #34 from Altinn/chore/workflow-permissions

Merge pull request #34 from Altinn/chore/workflow-permissions #34

# 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 ASP.Net Core app to Azure Web App - dialogporten-serviceprovider
on:
push:
branches:
- master
workflow_dispatch:
permissions: {}
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: Set up .NET Core
uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # v4.3.1
with:
dotnet-version: '9.x'
- name: Build with dotnet
run: dotnet build --configuration Release
- name: dotnet publish
run: dotnet publish -c Release -o ${{env.DOTNET_ROOT}}/myapp
- name: Upload artifact for deployment job
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: .net-app
path: ${{env.DOTNET_ROOT}}/myapp
deploy:
runs-on: ubuntu-latest
needs: build
environment:
name: 'production'
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
permissions:
id-token: write #This is required for requesting the JWT
steps:
- name: Download artifact from build job
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: .net-app
- name: Login to Azure
uses: azure/login@a457da9ea143d694b1b9c7c869ebb04ebe844ef5 # v2.3.0
with:
client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_54A0AC1A3CDB48A4BFE050DF2628200E }}
tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_FC6ACA5C0C1943B0ADCD19B98DD4FED8 }}
subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_4D83923A91564AC0B6363F5D9BBC7F0A }}
- name: Deploy to Azure Web App
id: deploy-to-webapp
uses: azure/webapps-deploy@45c7df8f6a4fe841b67ff88920b33f4f8328f8d9 # v3.0.8
with:
app-name: 'dialogporten-serviceprovider'
slot-name: 'Production'
package: .