Skip to content

Commit dd49c86

Browse files
authored
Fix robots.txt (#238)
Fix automatic generation of robots.txt. Validate on staging site and fix staging yaml code to work correctly with GitHub pages Update GitHub Action replacing PeaceIris actions with vanilla GitHub actions; align with Hugo's documented deployment process. --------- Signed-off-by: Bill Stumbo <wstumbo@charter.net>
1 parent 6375ef3 commit dd49c86

File tree

7 files changed

+61
-27
lines changed

7 files changed

+61
-27
lines changed

.github/workflows/gh-pages.yml

Lines changed: 51 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,26 @@ on:
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+
3143
env:
3244
# ----------------------------------------------------------------------------
3345
# Specify the deployment environment: staging or production
34-
hugoEnvironment: production
46+
HUGO_ENVIRONMENT: staging
47+
HUGO_VERSION: 0.133.1
3548

3649
jobs:
3750
# ----------------------------------------------------------------------------
@@ -42,6 +55,7 @@ jobs:
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+

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
_site
1313
.sass-cache
1414
.jekyll-metadata
15-
public/
1615
node_modules/
1716
_gen/
1817
.hugo_build.lock

config/_default/hugo.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ canonifyURLs: false
1717
# Default to false and set to true for production in config/production/hugo.yaml
1818
enableRobotsTXT: false
1919

20-
# aasetDir: Location where Hugo looks for assets
20+
# assetDir: Location where Hugo looks for assets
2121
assetDir: static
2222

2323
# Enable .GitInfo object for each page. This will give values to .Lastmod etc.

config/_default/markup.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ goldmark:
1414
# See: https://gohugo.io/getting-started/configuration-markup/#highlight
1515
# for additional information on configuration options.
1616
# https://www.docsy.dev/docs/adding-content/lookandfeel/#code-highlighting-with-chroma
17-
# contains Docsy specfiic code highlighting information
17+
# contains Docsy specfic code highlighting information
1818
highlight:
1919
# See a complete list of available styles at https://xyproto.github.io/splash/docs/all.html
2020
#style: solarized-dark

config/_default/params.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ github_branch: main
5353
github_subdir:
5454
github_project_repo: https://github.com/interlisp/medley
5555

56-
# Google custom seach engine configuration
56+
# Google custom search engine configuration
5757
# gcs_engine_id: search engine
5858
gcs_engine_id: 33ef4cbe0703b4f3a
5959

config/_default/privacy.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# See: https://gohugo.io/about/hugo-and-gdpr/
66
#
77
# googleAnalytics:
8-
# ananymizIP: Enable anonymiation of IP addresses
8+
# ananymizeIP: Enable anonymization of IP addresses
99
# disable: Set to true to disable googleAnalytics
1010
# respectDoNotTrack: Check for Do Not Track in headers
1111
# useSessionStorage: Store session information in storage and

config/staging/hugo.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
baseURL: https://wasm.interlisp.org
1+
baseURL: https://stumbo.github.io/InterlispDraft.github.io/
2+
23
languageCode: en-us
4+
5+
# title
6+
# Insert Staging Environment onto every page to make clear
7+
# this is not the production site
38
title: 'Staging Environment'
4-
publishDir: stage

0 commit comments

Comments
 (0)