Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jakejarvis/hugo-build-action

✏️ Hugo as a GitHub Action. Supports legacy versions back to v0.27 for compatibility.
https://github.com/jakejarvis/hugo-build-action

actions ci deployment docker github-actions hugo

Last synced: about 2 months ago
JSON representation

✏️ Hugo as a GitHub Action. Supports legacy versions back to v0.27 for compatibility.

Awesome Lists containing this project

README

        

# GitHub Action for [Hugo](https://github.com/gohugoio/hugo) ✏️

![Build example site](https://github.com/jakejarvis/hugo-build-action/workflows/Build%20example%20site/badge.svg)

This is a simple GitHub Action that contains [Hugo](https://github.com/gohugoio/hugo), the popular static site generator. The [extended version](https://gohugo.io/troubleshooting/faq/#i-get-tocss-this-feature-is-not-available-in-your-current-hugo-version) is now bundled by default. Unlike other actions, this action includes releases going back to [v0.27](https://github.com/gohugoio/hugo/releases/tag/v0.27) (September 2017) for any compatibility requirements.

## Usage

### `workflow.yml` Example

This example simply uploads the `./public` directory (the built Hugo website) as an artifact. You can replace the last `actions/upload-artifact` step with another action, like James Ives' [GitHub Pages deploy action](https://github.com/JamesIves/github-pages-deploy-action) or my [S3 sync action](https://github.com/jakejarvis/s3-sync-action), to upload the built static site somewhere accessible.

Replace the `master` in `uses: jakejarvis/hugo-build-action@master` to specify the Hugo version, back to [v0.27](https://github.com/gohugoio/hugo/releases/tag/v0.27), like `[email protected]`. This might be necessary if a recent version broke compatibility with your site. Otherwise, you'll get the [latest version](https://github.com/gohugoio/hugo/releases).

The `with: args:` portion holds any [optional flags](https://gohugo.io/commands/hugo/). You can remove those two lines for a vanilla build.

```yaml
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: jakejarvis/hugo-build-action@master # ...or replace 'master' with a full version tag, such as: v0.64.1
with:
args: --minify --buildDrafts
- uses: actions/upload-artifact@master
with:
name: website
path: './public'
```

## Included Software

Just in case, the final container includes a few small third-party tools that are required by certain optional Hugo features:

- [PostCSS](https://github.com/postcss/postcss-cli)
- [Autoprefixer](https://github.com/postcss/autoprefixer)
- [Babel](https://babeljs.io/)
- [Pygments](https://pygments.org/)
- [Asciidoctor](https://asciidoctor.org/)
- [Pandoc](https://pandoc.org/)
- [Docutils](https://docutils.sourceforge.io/) / [RST](https://docutils.sourceforge.io/rst.html)
- [Embedded Dart Sass](https://github.com/sass/dart-sass-embedded)

Node (with NPM and Yarn), Go (for [Hugo Modules](https://gohugo.io/hugo-modules/) support), and Python are also pre-installed.

## Licenses

This action is distributed under the [MIT License](LICENSE.md). Hugo is distributed under the [Apache License 2.0](https://github.com/gohugoio/hugo/blob/master/LICENSE).