2525 push :
2626 branches :
2727 - main # Set a branch to deploy
28+
2829 schedule :
2930 - cron : " 0 3 * * *"
3031
32+ workflow_dispatch :
33+
34+ permissions :
35+ contents : read
36+ pages : write
37+ id-token : write
38+
39+ defaults :
40+ run :
41+ shell : bash
42+
3143env :
3244 # ----------------------------------------------------------------------------
3345 # Specify the deployment environment: staging or production
34- hugoEnvironment : production
46+ HUGO_ENVIRONMENT : staging
47+ HUGO_VERSION : 0.133.1
3548
3649jobs :
3750 # ----------------------------------------------------------------------------
4255 outputs :
4356 zoteroVersion : ${{ fromJson(steps.zoteroVersion.outputs.headers).last-modified-version }}
4457 cacheHit : ${{ steps.cache-zotero-bib.outputs.cache-hit }}
58+
4559 runs-on : ubuntu-latest
4660 concurrency :
4761 group : ${{ github.workflow }}-${{ github.ref }}
@@ -66,19 +80,18 @@ jobs:
6680 ${{ fromJson(steps.zoteroVersion.outputs.headers).last-modified-version }}
6781
6882 # ----------------------------------------------------------------------------
69- # Deploy the website. This job is conditional, we will always run it on a
83+ # Build the website. This job is conditional, we will always run it on a
7084 # push or if on a scheduled run the cache was determined to be out of date.
7185 #
72- deploy :
86+ build :
7387 needs : check
7488 runs-on : ubuntu-latest
7589 if : github.event_name == 'push' || needs.check.outputs.cacheHit != 'true'
7690 steps :
77- - uses : actions/setup-go@v5
78- with :
79- go-version : ' 1.18.1'
80-
8191 - uses : actions/checkout@v4
92+ with :
93+ submodules : recursive
94+ fetch-depth : 0
8295
8396 - name : Cache Zotero Bibliography
8497 id : cache-zotero-bib
@@ -106,13 +119,17 @@ jobs:
106119 ./update_bibliography.sh
107120 sudo cp --recursive ${GITHUB_WORKSPACE}/static/data ~/data
108121 fi
109- shell : bash
110122
111- - name : Setup Hugo
112- uses : peaceiris/actions-hugo@v3
113- with :
114- hugo-version : ' 0.133.1'
115- extended : true
123+ # Install Hugo Extended
124+ #
125+ - name : Install Hugo CLI
126+ run : |
127+ wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
128+ && sudo dpkg -i ${{ runner.temp }}/hugo.deb
129+
130+ - name : Setup Pages
131+ id : pages
132+ uses : actions/configure-pages@v5
116133
117134 - name : Setup Node
118135 uses : actions/setup-node@v4
@@ -124,12 +141,26 @@ jobs:
124141 - run : npm install --verbose
125142
126143 - name : Build
127- run : hugo -e $hugoEnvironment -d ~/temp/deploy
144+ env :
145+ # HUGO_ENVIRONMENT: staging
146+ HUGO_CACHEDIR : ${{ runner.temp }}/hugo_cache
147+ TZ : America/New York
148+ run : hugo -d "./public" --cleanDestinationDir -e staging
149+
150+ - name : Upload artifact
151+ uses : actions/upload-pages-artifact@v3
152+ with :
153+ path : ./public
128154
155+ deploy :
156+ environment :
157+ name : github-pages
158+ url : ${{ steps.deployment.outputs.page_url }}
159+ runs-on : ubuntu-latest
160+ needs : build
129161
130- # - name: Deploy
131- # uses: peaceiris/actions-gh-pages@v4
132- # if: github.ref == 'refs/heads/main'
133- # with:
134- # github_token: ${{ secrets.GITHUB_TOKEN }}
135- # publish_dir: ./public
162+ steps :
163+ - name : Deploy to GitHub Pages
164+ id : deployment
165+ uses : actions/deploy-pages@v4
166+
0 commit comments