Installs Go + Hugo (extended edition) and builds a Hugo site. Preview mode includes drafts and future-dated posts; production mode does not.
- Sets up Go (for Hugo modules)
- Downloads and installs Hugo extended from GitHub releases
- Runs
hugo --gc --minify --baseURL <base-url>in the working directory, adding--buildDrafts --buildFuturewhenmode: preview
Output lands in <working-directory>/public.
- The caller must have already checked out the Hugo site source. This action
does not run
actions/checkout.
None.
| Permissions | contents: read (for checkout, not for this action) |
| Checkout | Caller must checkout before calling |
- uses: actions/checkout@v6
with:
submodules: recursive
fetch-depth: 0
- uses: modelcontextprotocol/actions/hugo-build@main
with:
working-directory: blog
mode: preview # or: production
base-url: /Then deploy blog/public however you like (Cloudflare Pages, GitHub Pages, etc.)
| Input | Required | Default | Description |
|---|---|---|---|
working-directory |
. |
Directory containing hugo.toml |
|
mode |
preview |
preview → development env, --buildDrafts --buildFuture. production → production env, no drafts/future. |
|
base-url |
/ |
Hugo --baseURL |
|
hugo-version |
0.148.0 |
Hugo extended version | |
go-version |
1.24 |
Go version for Hugo modules |
| Output | Description |
|---|---|
public-dir |
Path to built site (<working-directory>/public) |