From b71f5d10dbde16d9797c151c8fb02aaa1337e6ac Mon Sep 17 00:00:00 2001 From: Saransh Chopra Date: Wed, 14 Aug 2024 15:49:40 +0100 Subject: [PATCH] fix: split deployment job and give it write permission --- .github/workflows/build_site.yml | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build_site.yml b/.github/workflows/build_site.yml index 0dc5c60d..78b08046 100644 --- a/.github/workflows/build_site.yml +++ b/.github/workflows/build_site.yml @@ -1,4 +1,4 @@ -name: Build website +name: Build and deploy website on: push: branches: @@ -6,8 +6,10 @@ on: pull_request: branches: - main + workflow_dispatch: + jobs: - Build-website: + build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -51,10 +53,20 @@ jobs: uses: actions/upload-pages-artifact@v3 with: path: _site + + deploy: + needs: build + permissions: + pages: write + id-token: write + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + steps: - name: Deploy to GitHub Pages if: > - success() - && github.ref == 'refs/heads/main' + github.ref == 'refs/heads/main' && github.repository == 'UCL/rsd-engineeringcourse' id: deployment uses: actions/deploy-pages@v4