diff --git a/.github/workflows/azure-deployment.yml b/.github/workflows/azure-deployment.yml index 4b28db8..c320bc7 100644 --- a/.github/workflows/azure-deployment.yml +++ b/.github/workflows/azure-deployment.yml @@ -3,25 +3,17 @@ 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 @@ -29,14 +21,6 @@ jobs: 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 @@ -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