@@ -3,60 +3,45 @@ name: Build GH-Pages
33
44on :
55 pull_request :
6- branches : [master]
7- types : [opened, synchronize, reopened]
6+ branches :
7+ - master
8+ types :
9+ - opened
10+ - synchronize
11+ - reopened
812 push :
9- branches : [master]
13+ branches :
14+ - master
1015 workflow_dispatch :
1116
1217concurrency :
1318 group : " ${{ github.workflow }}-${{ github.ref }}"
1419 cancel-in-progress : true
1520
1621jobs :
17- update_pages :
22+ prep :
1823 runs-on : ubuntu-latest
19-
2024 steps :
2125 - name : Checkout
2226 uses : actions/checkout@v4
2327
24- - name : Checkout gh-pages
25- uses : actions/checkout@v4
26- with :
27- ref : gh-pages
28- path : gh-pages
29- persist-credentials : false # otherwise, the token used is the GITHUB_TOKEN, instead of the personal token
30- fetch-depth : 0 # otherwise, will fail to push refs to dest repo
31-
32- - name : Prepare gh-pages
33- run : |
34- # empty contents
35- rm -f -r ./gh-pages/*
36-
37- # copy template back to pages
38- cp -f -r ./gh-pages-template/. ./gh-pages/
39-
40- - name : Upload Artifacts
41- if : ${{ github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' }}
28+ - name : Upload artifact
4229 uses : actions/upload-artifact@v4
4330 with :
44- name : gh-pages
45- if-no-files-found : error # 'warn' or 'ignore' are also available, defaults to `warn`
46- path : |
47- ${{ github.workspace }}/gh-pages
48- !**/*.git
49-
50- - name : Deploy to gh-pages
51- if : >-
52- (github.event_name == 'push' && github.ref == 'refs/heads/master') ||
53- (github.event_name == 'workflow_dispatch')
54- uses :
actions-js/[email protected] 55- with :
56- github_token : ${{ secrets.GH_BOT_TOKEN }}
57- author_email : ${{ secrets.GH_BOT_EMAIL }}
58- author_name : ${{ secrets.GH_BOT_NAME }}
59- directory : gh-pages
60- branch : gh-pages
61- force : false
62- message : sync gh-pages to ${{ github.sha }}
31+ name : prep
32+ path : gh-pages-template/
33+ if-no-files-found : error
34+ include-hidden-files : true
35+ retention-days : 1
36+
37+ call-jekyll-build :
38+ needs : prep
39+ uses : LizardByte/LizardByte.github.io/.github/workflows/jekyll-build.yml@master
40+ with :
41+ site_artifact : ' prep'
42+ target_branch : ' gh-pages'
43+ clean_gh_pages : true
44+ secrets :
45+ GH_BOT_EMAIL : ${{ secrets.GH_BOT_EMAIL }}
46+ GH_BOT_NAME : ${{ secrets.GH_BOT_NAME }}
47+ GH_BOT_TOKEN : ${{ secrets.GH_BOT_TOKEN }}
0 commit comments