GitHub action to build and audit a Hugo site https://www.audit-build-action-default.wtg-demos.ca
  • Shell 92.5%
  • PowerShell 7.5%
Find a file
Daniel F. Dickinson 128b3493fe
Update Hugo modules for demo site fixes
Signed-off-by: Daniel F. Dickinson <dfdpublic@wildtechgarden.ca>
2023-09-26 22:06:22 -04:00
.github/workflows Fix the artifact call of validator action 2023-09-12 03:58:57 -04:00
content Tweak index page for repo's docs 2023-09-10 00:00:14 -04:00
content-drafts/doc/audit-build-action-hugo Remove relref as our render-link resolves the path 2023-09-10 07:18:56 -04:00
content-future/content/doc/audit-build-action-hugo Remove relref as our render-link resolves the path 2023-09-10 07:18:56 -04:00
scripts Fix path to this repo in config-*.toml 2023-09-10 01:32:57 -04:00
tests Update Hugo modules for demo site fixes 2023-09-26 22:06:22 -04:00
.editorconfig Add initial action and tests 2023-09-09 21:42:09 -04:00
.gitignore Add initial action and tests 2023-09-09 21:42:09 -04:00
.markdownlint.json Update pre-commit hooks 2023-09-16 05:48:01 -04:00
.pre-commit-config.yaml Update pre-commit hooks 2023-09-26 22:03:41 -04:00
.stylelintrc.json Initial commit 2023-09-09 16:52:22 -04:00
.yamllint.yaml Initial commit 2023-09-09 16:52:22 -04:00
action.yml Add initial action and tests 2023-09-09 21:42:09 -04:00
audit-build-action-hugo.code-workspace Add initial action and tests 2023-09-09 21:42:09 -04:00
cspell.json Add initial action and tests 2023-09-09 21:42:09 -04:00
go.mod Remove Hugo module dependencies in wrong dir 2023-09-26 22:04:11 -04:00
go.sum Remove Hugo module dependencies in wrong dir 2023-09-26 22:04:11 -04:00
hugo.toml Initial commit 2023-09-09 16:52:22 -04:00
LICENSE Initial commit 2023-09-09 16:52:22 -04:00
package-lock.json Add initial action and tests 2023-09-09 21:42:09 -04:00
package.json Initial commit 2023-09-09 16:52:22 -04:00
README.fr.md Fix ToC in README 2023-09-10 07:37:00 -04:00
README.md Fix ToC in README 2023-09-10 07:37:00 -04:00
words-fr-project.txt Add initial action and tests 2023-09-09 21:42:09 -04:00
words-project.txt Add initial action and tests 2023-09-09 21:42:09 -04:00

GitHub action to audit a Hugo site build

Description: Build a Hugo website and audit for silent errors. Optionally generate output and/or an artifact for use by other jobs in a GitHub Actions Workflow (e.g. for other tests or deployment).
Repository URL: https://github.com/wildtechgarden/audit-build-action-hugo
Site: https://www.audit-build-action-default.wtg-demos.ca
CI Status: pre-commit.ci status test-build-audit

Contents

  1. Contents
  2. Configuration and Usage
    1. Action inputs variables
    2. Action outputs variables
    3. Sample usage
      1. Single hugo.toml
      2. With an extra configuration file
  3. Development
  4. Colophon

Configuration and Usage

Action inputs variables

Input Description Required Default
base-url Set the baseURL for the site (for this build only) false
build-for-downstream Build for use by another action or step (aka bundle) without an artifact (string: "true" or "false" true "false"
checkout-fetch-depth Fetch depth (recommend using 0 to fetch all history if using .GitInfo or .Lastmod) true 0
checkout-submodules Fetch git submodules: false, true, or recursive true false
code-directory Directory under which repo and modules will live true ${{ github.workspace }}/code
config-file Hugo configuration file to use for the build(s) (may be a comma-separated list of files, relative to the 'source' dir) true "config.toml"
do-minify-audit If present, minify site using --minify before audit false
do-minify-bundle If present, minify site using --minify before last build false
hugo-cache-directory Where to place the Hugo module cache, under the code-directory true hugo_cache
hugo-env Hugo environment (production, development, etc) true production
hugo-extended Hugo Extended true true
hugo-version Hugo Version true 'latest'
image-formats Image formats to include in resource hash key true ['webp', 'svg', 'png', 'jpg', 'jpeg','gif', 'tiff', 'tif', 'bmp']
include-drafts-audit Build with --buildDrafts during audit true true
include-future-audit Build with --buildFuture during audit true true
include-drafts-artifact Build with --buildDrafts when building for another stage (generating an artifact) true false
include-future-artifact Build with --buildFuturewhen building for another stage (generating an artifact) true false
output-directory Location of the site output by Hugo, relative to the workspace true public
repo-directory Where to checkout the repo, under the code-directory true repo
source-directory Where the source for the site lives, within the repo false
upload-site-as Artifact to create containing the Hugo site false
upload-site-filename Filename for tarball of site to upload to artifact true hugo-site.tar
upload-site-retention Retention period in days for Hugo site artifact true 1
use-lfs Use LFS when checking out out repo true false

Action outputs variables

None

Sample usage

Single hugo.toml

name: test-build-on-pr
on:
  pull_request:
    types:
    - assigned
    - opened
    - synchronize
    - reopened
  push:
    branches:
    - main
jobs:
  build-unminified-site:
    runs-on: ubuntu-22.04
    steps:
     - name: "Build site with Hugo and audit"
       uses: wildtechgarden/audit-build-action-hugo
       with:
         base-url: https://www.example.com/
         build-for-downstream: "true"
         use-lfs: true

With an extra configuration file

Create hugo.toml as usual, except put all site-wide parameters in config-params.toml (beside hugo.toml in the directory structure; includes [params] top-level key).

This can be useful for passing information into the build (e.g. for unit tests).

name: test-build-on-pr
on:
  pull_request:
    types:
    - assigned
    - opened
    - synchronize
    - reopened
  push:
    branches:
    - main
jobs:
  build-unminified-site:
    runs-on: ubuntu-22.04
    steps:
    - name: "Build site with Hugo and audit"
      uses: wildtechgarden/audit-build-action-hugo
      with:
        base-url: https://www.example.com/
        build-for-downstream: "true"
        config-file: hugo.toml,hugo.params.toml
        use-lfs: true

Development

TBD


Colophon

Copyright © 2023 Wild Tech 'Garden'
Released under an MIT License