1- name : Deploy Jekyll site to GitHub Pages
1+ name : Deploy to GitHub Pages
22
33on :
44 push :
55 branches :
66 - main
7- pull_request :
8- types : [opened, synchronize, reopened]
97
108permissions :
11- contents : read
12- pages : write
13- id-token : write
14- pull-requests : write
15-
16- concurrency :
17- group : " pages-${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.pull_request.number) || 'main' }}"
18- cancel-in-progress : true
9+ contents : write
1910
2011jobs :
21- build :
12+ deploy :
2213 runs-on : ubuntu-latest
2314 steps :
2415 - name : Checkout
@@ -30,63 +21,15 @@ jobs:
3021 ruby-version : ' 3.2'
3122 bundler-cache : true
3223
33- - name : Setup Pages
34- id : pages
35- uses : actions/configure-pages@v4
36-
3724 - name : Build with Jekyll
38- run : |
39- if [ "${{ github.event_name }}" == "pull_request" ]; then
40- # For PRs, build with baseurl pointing to PR-specific folder
41- bundle exec jekyll build --baseurl "/pr-${{ github.event.pull_request.number }}"
42- else
43- # For main branch, build to root
44- bundle exec jekyll build
45- fi
25+ run : bundle exec jekyll build
4626 env :
4727 JEKYLL_ENV : production
4828
49- - name : Upload artifact
50- uses : actions/upload-pages-artifact@v3
51- with :
52- path : _site
53-
54- # Deploy to main domain when merged into main
55- deploy-main :
56- if : github.event_name == 'push' && github.ref == 'refs/heads/main'
57- environment :
58- name : github-pages
59- url : ${{ steps.deployment.outputs.page_url }}
60- runs-on : ubuntu-latest
61- needs : build
62- steps :
6329 - name : Deploy to GitHub Pages
64- id : deployment
65- uses : actions/deploy-pages@v4
66-
67- # Deploy to PR-specific folder on pull requests
68- deploy-pr :
69- if : github.event_name == 'pull_request'
70- runs-on : ubuntu-latest
71- needs : build
72- permissions :
73- contents : write
74- pull-requests : write
75- steps :
76- - name : Download artifact
77- uses : actions/download-artifact@v4
78- with :
79- name : github-pages
80- path : ./artifact
81-
82- - name : Extract artifact
83- run : |
84- mkdir -p preview
85- tar -xvf ./artifact/artifact.tar -C preview
86-
87- - name : Deploy PR Preview
88- uses : rossjrw/pr-preview-action@v1
30+ uses : JamesIves/github-pages-deploy-action@v4
8931 with :
90- source-dir : preview
91- preview-branch : gh-pages
92- umbrella-dir : pr-preview
32+ folder : _site
33+ branch : gh-pages
34+ clean-exclude : pr-preview
35+ force : false
0 commit comments