Skip to content

Instantly share code, notes, and snippets.

@dlebauer
Last active June 4, 2025 21:47
Show Gist options
  • Save dlebauer/22902252977fe532ba0cae8b6f72e6cc to your computer and use it in GitHub Desktop.
Save dlebauer/22902252977fe532ba0cae8b6f72e6cc to your computer and use it in GitHub Desktop.
Errors & fixes during initial deploy of hugoblox website
# Category / File Symptom / Error (abridged) Root Cause / Context Fix applied (see commit/patch)
1 GitHub Pages deploy
.github/workflows/publish.yaml
deploy-pages 404 – “Getting signed artifact URL failed” Deploy job could not find a Pages‑type artifact Switched to actions/upload-artifact@v4 and named it github-pages, which deploy-pages@v4 accepts
2 Actions tag mismatch “Missing download info for actions/upload‑artifact@v3” Referenced tag never existed Bumped to upload-artifact@v4 (implicit in #1)
3 Out‑of‑date Actions Marketplace warnings Template shipped with old tags actions/checkout@v4, actions/setup-python@v5
4 PR label permission
import-publications.yml
create-pull-request can’t add automated-pr, content labels Labels absent in personal repo Pre‑created labels or removed labels: line
5 Deploy‑pages version Template pinned to actions/deploy-pages@v2 New features & fixes in v4 Upgraded to deploy-pages@v4
6 Docs vs UI confusion Docs say “GitHub Actions” source; UI also offers “Deploy from branch” Branch mode is only for pre‑built sites Confirmed GitHub Actions should stay selected
7 Duplicate publications
import-publications.yml
Old MD files linger; new import adds duplicates academic import … --compact kept originals Added --overwrite flag
8 Hugo front‑matter parse failed to parse page front matter … Invalid date: formats in pub MD Normalised to YYYY‑MM‑DD
9 Malformed BibTeX URLs Parser choked on & / stray spaces Typos & escaped chars in publications.bib Cleaned / decoded URLs
10 Encoding‑check exit code “Finding files with potential encoding issues:” step exited 123 grep … returns non‑zero when nothing found and set -e is on Appended || true to that check so workflow never hard‑fails
11 Repo docs No CONTRIBUTING.md; couldn’t find PR guidelines Project lacks contribution guide Sent summary + patch via Discord
diff --git a/.github/workflows/import-publications.yml b/.github/workflows/import-publications.yml
new file mode 100644
index 0000000..073e73e
--- /dev/null
+++ b/.github/workflows/import-publications.yml
@@ -0,0 +1,56 @@
+# Hugo Blox GitHub Action to convert Bibtex publications to Markdown-based webpages
+name: Import Publications From Bibtex
+
+# Require permission to create a PR
+permissions:
+ contents: write
+ pull-requests: write
+
+# Run workflow when a `.bib` file is added or updated in the `data/` folder
+on:
+ push:
+ branches: ['main']
+ paths: ['publications.bib']
+
+ # Allows you to run this workflow manually from the Actions tab
+ workflow_dispatch:
+
+jobs:
+ hugoblox:
+ if: github.repository_owner != 'HugoBlox'
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout the repo
+ uses: actions/checkout@v4
+ - name: Set up Python 3.12
+ uses: actions/setup-python@v5
+ with:
+ python-version: "3.12"
+ - name: Install dependencies
+ run: |
+ python -m pip install --upgrade pip
+ pip install academic==0.10.0
+ - name: Run Academic (Bibtex To Markdown Converter)
+ # Check `.bib` file exists for case when action runs on `.bib` deletion
+ # Note GH only provides hashFiles func in `steps.if` context, not `jobs.if` context
+ if: ${{ hashFiles('publications.bib') != '' }}
+ run: academic import publications.bib content/publication/ --compact --overwrite
+ - name: Create Pull Request
+ # Set ID for `Check outputs` stage
+ id: cpr
+ uses: peter-evans/create-pull-request@v5
+ with:
+ commit-message: 'content: import publications from Bibtex'
+ title: Hugo Blox Builder - Import latest publications
+ body: |
+ Import the latest publications from `publications.bib` to `content/publication/`.
+ [View Documentation](https://github.com/GetRD/academic-file-converter)
+ base: main
+ labels: automated-pr, content
+ branch: hugoblox-import-publications
+ delete-branch: true
+ - name: Check outputs
+ if: ${{ steps.cpr.outputs.pull-request-number }}
+ run: |
+ echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
+ echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"
diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml
new file mode 100644
index 0000000..7999f95
--- /dev/null
+++ b/.github/workflows/publish.yaml
@@ -0,0 +1,86 @@
+name: Deploy website to GitHub Pages
+
+env:
+ WC_HUGO_VERSION: '0.136.5'
+
+on:
+ # Trigger the workflow every time you push to the `main` branch
+ push:
+ branches: ["main"]
+ # Allows you to run this workflow manually from the Actions tab on GitHub.
+ workflow_dispatch:
+
+# Provide permission to clone the repo and deploy it to GitHub Pages
+permissions:
+ contents: read
+ pages: write
+ id-token: write
+
+concurrency:
+ group: "pages"
+ cancel-in-progress: false
+
+jobs:
+ # Build website
+ build:
+ if: github.repository_owner != 'HugoBlox'
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+ with:
+ # Fetch history for Hugo's .GitInfo and .Lastmod
+ fetch-depth: 0
+ - name: Setup Hugo
+ uses: peaceiris/actions-hugo@v2
+ with:
+ hugo-version: ${{ env.WC_HUGO_VERSION }}
+ extended: true
+ - uses: actions/cache@v3
+ with:
+ path: /tmp/hugo_cache_runner/
+ key: ${{ runner.os }}-hugomod-${{ hashFiles('**/go.mod') }}
+ restore-keys: |
+ ${{ runner.os }}-hugomod-
+ - name: Setup Pages
+ id: pages
+ uses: actions/configure-pages@v3
+ - name: Build with Hugo
+ env:
+ HUGO_ENVIRONMENT: production
+ run: |
+ echo "Hugo Cache Dir: $(hugo config | grep cachedir)"
+ hugo --minify --baseURL "${{ steps.pages.outputs.base_url }}/"
+ - name: Generate Pagefind search index
+ run: npx pagefind --site "public"
+ - name: Validate artifact
+ run: |
+ if find ./public -type l | grep -q '.'; then
+ echo "Error: Symlinks detected in the public directory. Remove symlinks before deployment."
+ exit 1
+ fi
+ size=$(du -sh ./public | cut -f1)
+ echo "Artifact size: $size"
+ max_size=10G
+ if [[ $size > $max_size ]]; then
+ echo "Error: Artifact size exceeds 10GB. Optimize the content before deployment."
+ exit 1
+ fi
+ - name: Upload artifact
+ uses: actions/upload-artifact@v4
+ with:
+ name: github-pages
+ path: ./public
+
+ # Deploy website to GitHub Pages hosting
+ deploy:
+ if: github.repository_owner != 'HugoBlox'
+ environment:
+ name: github-pages
+ url: ${{ steps.deployment.outputs.page_url }}
+ runs-on: ubuntu-latest
+ needs: build
+ steps:
+ - name: Deploy to GitHub Pages
+ id: deployment
+ uses: actions/deploy-pages@v4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment