@@ -2,6 +2,13 @@ name: Jekyll PR Previews
22
33on :
44 pull_request :
5+ types :
6+ - opened
7+ - reopened
8+ - synchronize
9+ - closed
10+
11+ concurrency : preview-${{ github.ref }}
512
613permissions :
714 contents : read
@@ -18,49 +25,21 @@ jobs:
1825 steps :
1926 - name : Checkout
2027 uses : actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
21-
2228 - name : Setup Ruby
2329 uses : ruby/setup-ruby@8aeb6ff8030dd539317f8e1769a044873b56ea71 # v1.268.0
2430 with :
2531 ruby-version : " 3.2"
2632 bundler-cache : true
27-
28- # Determine output folder: main → root, PR → /pr-<number>/
29- - name : Determine output path
30- id : setpath
31- run : |
32- echo "pr_path=pr-${{ github.event.pull_request.number }}" >> $GITHUB_OUTPUT
33-
34- # Build Jekyll
35- - name : Build Jekyll
36- run : |
37- DEST="./_site/${{ steps.setpath.outputs.pr_path }}"
38- mkdir -p "$DEST"
39- bundle exec jekyll build --destination "$DEST" --trace --baseurl "/pr-${{ github.event.pull_request.number }}/"
40-
41- # Upload the artifact for deployment
42- - name : Upload Pages Artifact
43- uses : actions/upload-pages-artifact@7b1f4a764d45c48632c6b24a0339c27f5614fb0b # v4.0.0
44- with :
45- path : _site
46-
47- deploy :
48- runs-on : ubuntu-latest
49- needs : build
50-
51- # Deploy for both PRs and main
52- steps :
53- - name : Deploy to GitHub Pages
54- id : deploy
55- uses : actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5
56-
57- # Comment PR preview URL
58- - name : Comment PR Preview URL
59- uses : peter-evans/create-or-update-comment@e8674b075228eee787fea43ef493e45ece1004c9 # v5.0.0
33+ - name : Setup Pages
34+ id : pages
35+ uses : actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5.0.0
36+ - name : Build with Jekyll
37+ # Outputs to the './_site' directory by default
38+ run : bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path }}"
39+ env :
40+ JEKYLL_ENV : production
41+ - name : Deploy preview
42+ uses : rossjrw/pr-preview-action@v1
6043 with :
61- issue-number : ${{ github.event.pull_request.number }}
62- body : |
63- 🔍 **Unique Jekyll PR Preview Ready**
64-
65- Preview URL:
66- **https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/pr-${{ github.event.pull_request.number }}/**
44+ source-dir : ./_site/
45+ preview-branch : main
0 commit comments