From 145b34a5d2b8ac779439fef713e18c610f94aa3c Mon Sep 17 00:00:00 2001 From: Raj Date: Fri, 22 Dec 2023 18:23:21 +0530 Subject: [PATCH] Add dependency to build job and grant necessary permissions for Pages deployment --- .../blazor-client-helloworld-deploy.yml | 26 +++++++++++++------ 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/.github/workflows/blazor-client-helloworld-deploy.yml b/.github/workflows/blazor-client-helloworld-deploy.yml index 44c92c9..21b380e 100644 --- a/.github/workflows/blazor-client-helloworld-deploy.yml +++ b/.github/workflows/blazor-client-helloworld-deploy.yml @@ -33,17 +33,27 @@ jobs: path: ${{ env.PUBLISH_DIR }} deploy: - needs: build runs-on: ubuntu-latest - steps: - - name: Download artifacts - uses: actions/download-artifact@v2 - with: - name: published-app - path: ./published-app + # Add a dependency to the build job + needs: build + # Grant GITHUB_TOKEN the permissions required to make a Pages deployment + permissions: + pages: write # to deploy to Pages + id-token: write # to verify the deployment originates from an appropriate source + actions: read # to download an artifact uploaded by `actions/upload-pages-artifact@v3` + + # Deploy to the github-pages environment + environment: + name: github-pages + + steps: - name: Deploy to GitHub Pages + id: deployment uses: actions/deploy-pages@v4 with: - token: ${{ secrets.GH_PAT }} + token: ${{ secrets.GITHUB_TOKEN }} artifact_name: published-app + + - name: Update environment + run: echo "PAGE_URL=https://${{ github.repository_owner }}.github.io/${{ github.repository }}" >> $GITHUB_ENV