14
14
jobs :
15
15
build_site :
16
16
name : " Build site with Antora"
17
- runs-on : [ubuntu-latest ]
17
+ runs-on : [ubuntu-24.04 ]
18
18
steps :
19
19
- name : Checkout
20
20
uses : actions/checkout@v4
27
27
with :
28
28
name : site
29
29
path : " ${{ github.workspace }}/${{ env.SITE_DIR }}"
30
+
30
31
deploy_site :
31
- runs-on : [ubuntu-latest]
32
+ permissions :
33
+ contents : write
34
+ pull-requests : write
35
+ repository-projects : write
36
+ id-token : write
37
+ runs-on : [ubuntu-24.04]
32
38
needs : [build_site]
33
39
name : " Deploy GitHub Pages"
34
40
if : github.event_name != 'pull_request'
@@ -41,10 +47,65 @@ jobs:
41
47
name : site
42
48
path : " ${{ github.workspace }}/${{ env.SITE_DIR }}"
43
49
- name : Deploy to GitHub Pages
44
-
50
+ uses : JamesIves/github-pages-deploy-action@v4
51
+ with :
52
+ token : ${{ secrets.GITHUB_TOKEN }}
53
+ folder : " ${{ env.SITE_DIR }}"
54
+ commit-message : " [CI] Publish Documentation for ${{ github.sha }}"
55
+
56
+ deploy_preview :
57
+ permissions :
58
+ contents : write
59
+ pull-requests : write
60
+ repository-projects : write
61
+ id-token : write
62
+ env :
63
+ PR_PATH : pull-${{ github.event.number }}
64
+ runs-on : [ ubuntu-24.04 ]
65
+ needs : [ build_site ]
66
+ name : " Deploy preview for PR"
67
+ if : github.event_name == 'pull_request'
68
+ steps :
69
+ - name : Comment on PR
70
+
71
+ with :
72
+ github-token : ${{ secrets.GITHUB_TOKEN }}
73
+ repository : ${{ github.repository }}
74
+ number : ${{ github.event.number }}
75
+ id : deploy-preview
76
+ message : " Starting deployment of preview ⏳..."
77
+
78
+ - name : Set base URL for preview
79
+ run : echo "BASE_URL=https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/${{ env.PR_PATH }}/" >> $GITHUB_ENV
80
+
81
+ - name : Checkout
82
+ uses : actions/checkout@v4
83
+ - name : Download generated site
84
+ uses : actions/download-artifact@v4
85
+ with :
86
+ name : site
87
+ path : " ${{ github.workspace }}/${{ env.SITE_DIR }}"
88
+
89
+ - name : Deploy PR preview
90
+ uses : JamesIves/github-pages-deploy-action@v4
91
+ with :
92
+ token : ${{ secrets.GITHUB_TOKEN }}
93
+ folder : " ${{ env.SITE_DIR }}"
94
+ target-folder : " ${{ env.PR_PATH }}"
95
+ commit-message : " [CI] Publish Preview for PR #${{ github.event.number }}"
96
+
97
+ - name : Update comment
98
+
45
99
with :
46
- # ACCESS_TOKEN: # optional
47
- GITHUB_TOKEN : " ${{ github.token}}"
48
- FOLDER : " ${{ env.SITE_DIR }}"
49
- BRANCH : " gh-pages"
50
- COMMIT_MESSAGE : " [CI] Publish Documentation for ${{ github.sha }}"
100
+ github-token : ${{ secrets.GITHUB_TOKEN }}
101
+ repository : ${{ github.repository }}
102
+ number : ${{ github.event.number }}
103
+ id : deploy-preview
104
+ message : |
105
+ A preview of ${{ github.event.after }} is uploaded and can be seen here:
106
+
107
+ ✨ ${{ env.BASE_URL }} ✨
108
+
109
+ Changes may take a few minutes to propagate.
110
+
111
+ The source is here: https://github.com/${{ github.repository }}/tree/gh-pages/${{ env.PR_PATH }}/
0 commit comments