Skip to content

Commit d416363

Browse files
authored
Merge pull request #246 from UCL/saransh/fix-deployment
fix: split deployment job and give it write permission
2 parents 3a07da1 + a2282ec commit d416363

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

.github/workflows/build_site.yml

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1-
name: Build website
1+
name: Build and deploy website
22
on:
33
push:
44
branches:
55
- main
66
pull_request:
77
branches:
88
- main
9+
workflow_dispatch:
10+
911
jobs:
10-
Build-website:
12+
build:
1113
runs-on: ubuntu-latest
1214
steps:
1315
- uses: actions/checkout@v4
@@ -51,10 +53,20 @@ jobs:
5153
uses: actions/upload-pages-artifact@v3
5254
with:
5355
path: _site
56+
57+
deploy:
58+
if: >
59+
github.ref == 'refs/heads/main'
60+
&& github.repository == 'UCL/rsd-engineeringcourse'
61+
needs: build
62+
permissions:
63+
pages: write
64+
id-token: write
65+
environment:
66+
name: github-pages
67+
url: ${{ steps.deployment.outputs.page_url }}
68+
runs-on: ubuntu-latest
69+
steps:
5470
- name: Deploy to GitHub Pages
55-
if: >
56-
success()
57-
&& github.ref == 'refs/heads/main'
58-
&& github.repository == 'UCL/rsd-engineeringcourse'
5971
id: deployment
6072
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)