1- name : github pages
1+ name : Deploy website to GitHub Pages
22
33env :
44 WC_HUGO_VERSION : ' 0.147.9'
55
66on :
7+ # Trigger the workflow every time you push to the `main` branch
78 push :
8- branches :
9- - src # Set a branch name to trigger deployment
10- # Allows you to run this workflow manually from the Actions tab on GitHub.
11- workflow_dispatch :
9+ branches : ["src"]
10+ # Allows you to run this workflow manually from the Actions tab on GitHub.
11+ workflow_dispatch :
1212
1313# Provide permission to clone the repo and deploy it to GitHub Pages
1414permissions :
@@ -21,71 +21,48 @@ concurrency:
2121 cancel-in-progress : false
2222
2323jobs :
24- deploy :
24+ # Build website
25+ build :
2526 runs-on : ubuntu-latest
2627 steps :
27- - uses : actions/checkout@v4
28+ - name : Checkout
29+ uses : actions/checkout@v4
2830 with :
29- # submodules: true # Fetch Hugo themes (true OR recursive)
30- fetch-depth : 0 # Fetch all history for .GitInfo and .Lastmod
31+ # Fetch history for Hugo's .GitInfo and .Lastmod
32+ fetch-depth : 0
3133 - name : Setup Hugo
3234 uses : peaceiris/actions-hugo@v3
3335 with :
3436 hugo-version : ${{ env.WC_HUGO_VERSION }}
3537 extended : true
36- - name : Build
37- run : hugo --minify
38- - name : Deploy
39- uses : peaceiris/actions-gh-pages@v3
38+ - uses : actions/cache@v4
39+ with :
40+ path : /tmp/hugo_cache_runner/
41+ key : ${{ runner.os }}-hugomod-${{ hashFiles('**/go.mod') }}
42+ restore-keys : |
43+ ${{ runner.os }}-hugomod-
44+ - name : Setup Pages
45+ id : pages
46+ uses : actions/configure-pages@v5
47+ - name : Build with Hugo
48+ env :
49+ HUGO_ENVIRONMENT : production
50+ run : |
51+ echo "Hugo Cache Dir: $(hugo config | grep cachedir)"
52+ hugo --minify --baseURL "${{ steps.pages.outputs.base_url }}/"
53+ - name : Upload artifact
54+ uses : actions/upload-pages-artifact@v3
4055 with :
41- github_token : ${{ secrets.GITHUB_TOKEN }}
42- publish_branch : master
43- # build:
44- # runs-on: ubuntu-latest
45- # steps:
46- # - name: Checkout
47- # uses: actions/checkout@v4
48- # with:
49- # # Fetch history for Hugo's .GitInfo and .Lastmod
50- # fetch-depth: 0
51- # - name: Setup Hugo
52- # uses: peaceiris/actions-hugo@v3
53- # with:
54- # hugo-version: ${{ env.WC_HUGO_VERSION }}
55- # extended: true
56- # - uses: actions/cache@v4
57- # with:
58- # path: /tmp/hugo_cache_runner/
59- # key: ${{ runner.os }}-hugomod-${{ hashFiles('**/go.mod') }}
60- # restore-keys: |
61- # ${{ runner.os }}-hugomod-
62- # - name: Setup Pages
63- # id: pages
64- # uses: actions/configure-pages@v5
65- # - name: Build with Hugo
66- # env:
67- # HUGO_ENVIRONMENT: production
68- # run: |
69- # echo "Hugo Cache Dir: $(hugo config | grep cachedir)"
70- # hugo --minify --baseURL "${{ steps.pages.outputs.base_url }}/"
71- # - name: Upload artifact
72- # uses: actions/upload-pages-artifact@v3
73- # with:
74- # path: ./public
75- #
76- # # Deploy website to GitHub Pages hosting
77- # deploy:
78- # environment:
79- # name: github-pages
80- # url: ${{ steps.deployment.outputs.page_url }}
81- # runs-on: ubuntu-latest
82- # needs: build
83- # steps:
84- # - name: Deploy to GitHub Pages
85- # id: deployment
86- # uses: actions/deploy-pages@v4
87- # - name: Deploy
88- # uses: peaceiris/actions-gh-pages@v3
89- # with:
90- # github_token: ${{ secrets.GITHUB_TOKEN }}
91- # publish_branch: master
56+ path : ./public
57+
58+ # Deploy website to GitHub Pages hosting
59+ deploy :
60+ environment :
61+ name : github-pages
62+ url : ${{ steps.deployment.outputs.page_url }}
63+ runs-on : ubuntu-latest
64+ needs : build
65+ steps :
66+ - name : Deploy to GitHub Pages
67+ id : deployment
68+ uses : actions/deploy-pages@v4
0 commit comments