Skip to content

Commit

Permalink
Change authentication in Azure deployment workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
dougwaldron committed Mar 4, 2024
1 parent 64fabfc commit c3337b1
Showing 1 changed file with 18 additions and 26 deletions.
44 changes: 18 additions & 26 deletions .github/workflows/azure-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,24 @@

name: Azure Deployment

env:
AZURE_WEBAPP_NAME: "podcast-rewind" # set this to the name of your Azure Web App
AZURE_WEBAPP_PACKAGE_PATH: "." # set this to the path to your web app project, defaults to the repository root
DOTNET_VERSION: "8" # set this to the .NET Core version to use

on:
push:
tags: [v*]
workflow_dispatch:

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
- name: Check out repository
uses: actions/checkout@v4

- name: Set up .NET
uses: actions/setup-dotnet@v4
with:
global-json-file: global.json

- name: Set up dependency caching for faster builds
uses: actions/cache@v4
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: Build with dotnet
run: dotnet build --configuration Release

Expand All @@ -50,26 +34,34 @@ jobs:
path: ${{env.DOTNET_ROOT}}/myapp

deploy:
permissions:
contents: none
runs-on: ubuntu-latest
needs: build

environment:
name: "Production"
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@v4
with:
name: .net-app

- name: Login to Azure
uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}

- name: Deploy to Azure Web App
id: deploy-to-webapp
uses: azure/webapps-deploy@v3
uses: azure/webapps-deploy@v2
with:
app-name: ${{ env.AZURE_WEBAPP_NAME }}
slot-name: "Production"
publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_C1896F072C044B3385AFFE24FD9DA74E }}
package: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }}
clean: false
app-name: "podcast-rewind"
slot-name: "production"
package: .
# clean: false # Be sure to set `clean: false` when upgrading from webapps-deploy@v2 to v3

0 comments on commit c3337b1

Please sign in to comment.