Skip to content

Commit a816cac

Browse files
committed
Merge branch 'main' into bibUpdates
2 parents 8822f2c + 44f0ed8 commit a816cac

File tree

177 files changed

+3799
-8337
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

177 files changed

+3799
-8337
lines changed

.github/workflows/gh-pages.yml

Lines changed: 141 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,138 @@
1+
#*******************************************************************************
2+
# gh-pages.yml
3+
#
4+
# Github Workflow to deploy Interlisp.org.
5+
#
6+
# Interlisp.org is a Hugo based static website that contains a
7+
# detailed bibliography maintained using Zotero (https://www.zotero.org/groups/2914042/interlispwww.zotero.org/).
8+
#
9+
# This workflow consists of two jobs, one to ensure that we have the latest
10+
# version of the Zotero bibliography and a second job to deploy the website.
11+
#
12+
# The workflow is executed either on a push or via scheduled run times. When
13+
# started at a scheduled run time we only do a deploy if the cached bibliography
14+
# is no longer current. On a push, we always verifty the the current
15+
# bibliography is loaded and deploy a new version of the website.
16+
#
17+
# 2023-10-20 Bill Stumbo
18+
#
19+
# Copyright 2023 by Interlisp.org
20+
#
21+
# ******************************************************************************
122
name: github pages
223

324
on:
425
push:
526
branches:
627
- main # Set a branch to deploy
7-
pull_request:
28+
29+
schedule:
30+
- cron: "0 3 * * *"
31+
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+
43+
env:
44+
# ----------------------------------------------------------------------------
45+
# Specify the deployment environment: staging or production
46+
HUGO_ENVIRONMENT: production
47+
HUGO_VERSION: 0.133.1
848

949
jobs:
10-
deploy:
11-
runs-on: ubuntu-22.04
50+
# ----------------------------------------------------------------------------
51+
# Use the Zotero REST API to get the current version of the Zotero Bibliography
52+
# Compare against a cached version of the bibliography.
53+
#
54+
check:
55+
outputs:
56+
zoteroVersion: ${{ fromJson(steps.zoteroVersion.outputs.headers).last-modified-version }}
57+
cacheHit: ${{ steps.cache-zotero-bib.outputs.cache-hit }}
58+
59+
runs-on: ubuntu-latest
1260
concurrency:
1361
group: ${{ github.workflow }}-${{ github.ref }}
1462
steps:
15-
- uses: actions/checkout@v3
1663

17-
- name: Setup Hugo
18-
uses: peaceiris/actions-hugo@v2
64+
- name: Get Zotero Version Information
65+
id: zoteroVersion
66+
uses: fjogeleit/http-request-action@v1
67+
with:
68+
url: "https://api.zotero.org/groups/2914042/items?format=versions"
69+
method: "GET"
70+
71+
- name: Cache Zotero Bibliography
72+
id: cache-zotero-bib
73+
uses: actions/cache@v4
74+
env:
75+
cache-name: cache-zotero_bib
76+
with:
77+
path: ~/data
78+
key: ${{ fromJson(steps.zoteroVersion.outputs.headers).last-modified-version }}
79+
restore-keys: |
80+
${{ fromJson(steps.zoteroVersion.outputs.headers).last-modified-version }}
81+
82+
# ----------------------------------------------------------------------------
83+
# Build the website. This job is conditional, we will always run it on a
84+
# push or if on a scheduled run the cache was determined to be out of date.
85+
#
86+
build:
87+
needs: check
88+
runs-on: ubuntu-latest
89+
if: github.event_name == 'push' || needs.check.outputs.cacheHit != 'true'
90+
steps:
91+
- uses: actions/checkout@v4
1992
with:
20-
hugo-version: 'latest'
21-
extended: true
93+
submodules: recursive
94+
fetch-depth: 0
95+
96+
- name: Cache Zotero Bibliography
97+
id: cache-zotero-bib
98+
uses: actions/cache@v4
99+
env:
100+
cache-name: cache-zotero_bib
101+
with:
102+
path: ~/data
103+
key: ${{ needs.check.outputs.zoteroVersion }}
104+
restore-keys: |
105+
${{ needs.check.outputs.zoteroVersion }}
106+
107+
- name: Install Bibliography
108+
env:
109+
CACHE_HIT: ${{ steps.cache-zotero-bib.outputs.cache-hit }}
110+
run: |
111+
if [[ "$CACHE_HIT" == 'true' ]]; then
112+
echo "Use Cache"
113+
sudo cp --recursive ~/data ${GITHUB_WORKSPACE}/static
114+
ls -la ${GITHUB_WORKSPACE}/static/data
115+
else
116+
echo "Retrieve bibliography"
117+
cd scripts
118+
chmod +x ./update_bibliography.sh
119+
./update_bibliography.sh
120+
sudo cp --recursive ${GITHUB_WORKSPACE}/static/data ~/data
121+
fi
122+
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
22133

23134
- name: Setup Node
24-
uses: actions/setup-node@v3
135+
uses: actions/setup-node@v4
25136
with:
26137
node-version: 18
27138

@@ -30,11 +141,25 @@ jobs:
30141
- run: npm install --verbose
31142

32143
- name: Build
33-
run: hugo
34-
35-
- name: Deploy
36-
uses: peaceiris/actions-gh-pages@v3
37-
if: github.ref == 'refs/heads/main'
144+
env:
145+
HUGO_CACHEDIR: ${{ runner.temp }}/hugo_cache
146+
TZ: America/New York
147+
run: hugo --cleanDestinationDir -e $HUGO_ENVIRONMENT
148+
149+
- name: Upload artifact
150+
uses: actions/upload-pages-artifact@v3
38151
with:
39-
github_token: ${{ secrets.GITHUB_TOKEN }}
40-
publish_dir: ./public
152+
path: ./public
153+
154+
deploy:
155+
environment:
156+
name: github-pages
157+
url: ${{ steps.deployment.outputs.page_url }}
158+
runs-on: ubuntu-latest
159+
needs: build
160+
161+
steps:
162+
- name: Deploy to GitHub Pages
163+
id: deployment
164+
uses: actions/deploy-pages@v4
165+

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# emacs detritus
66
*\#
77
\.\#*
8-
8+
.emacs*
99

1010
.jekyll-cache/
1111
*.swp
@@ -17,3 +17,4 @@ node_modules/
1717
_gen/
1818
.hugo_build.lock
1919
.idea
20+
data/bibliography.json

0 commit comments

Comments
 (0)