├── .dockerignore ├── .github └── workflows │ └── build-docs.yml ├── Dockerfile ├── LICENSE.md ├── README.md └── action.yml /.dockerignore: -------------------------------------------------------------------------------- 1 | # Ignore all files... 2 | * 3 | 4 | # ...except readme and licenses: 5 | !LICENSE.md 6 | !README.md 7 | !THIRD_PARTY_NOTICE.md 8 | -------------------------------------------------------------------------------- /.github/workflows/build-docs.yml: -------------------------------------------------------------------------------- 1 | name: Build example site 2 | 3 | on: [push, pull_request] 4 | 5 | jobs: 6 | build: 7 | runs-on: ubuntu-latest 8 | steps: 9 | - name: Checkout action 10 | uses: actions/checkout@master 11 | with: 12 | fetch-depth: 1 13 | - name: Checkout gohugoio/hugoBasicExample 14 | uses: actions/checkout@master 15 | with: 16 | repository: gohugoio/hugoBasicExample 17 | path: example/ 18 | fetch-depth: 1 19 | - name: Build site 20 | uses: ./ 21 | with: 22 | args: --source example/ --minify --verbose 23 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | # https://github.com/jakejarvis/hugo-docker 2 | FROM ghcr.io/jakejarvis/hugo-extended:0.111.3 3 | 4 | ENTRYPOINT ["hugo"] 5 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019-present Jake Jarvis 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # GitHub Action for [Hugo](https://github.com/gohugoio/hugo) ✏️ 2 | 3 | ![Build example site](https://github.com/jakejarvis/hugo-build-action/workflows/Build%20example%20site/badge.svg) 4 | 5 | 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. 6 | 7 | ## Usage 8 | 9 | ### `workflow.yml` Example 10 | 11 | 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. 12 | 13 | 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 `hugo-build-action@v0.27`. 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). 14 | 15 | The `with: args:` portion holds any [optional flags](https://gohugo.io/commands/hugo/). You can remove those two lines for a vanilla build. 16 | 17 | ```yaml 18 | jobs: 19 | build: 20 | runs-on: ubuntu-latest 21 | steps: 22 | - uses: actions/checkout@master 23 | - uses: jakejarvis/hugo-build-action@master # ...or replace 'master' with a full version tag, such as: v0.64.1 24 | with: 25 | args: --minify --buildDrafts 26 | - uses: actions/upload-artifact@master 27 | with: 28 | name: website 29 | path: './public' 30 | ``` 31 | 32 | ## Included Software 33 | 34 | Just in case, the final container includes a few small third-party tools that are required by certain optional Hugo features: 35 | 36 | - [PostCSS](https://github.com/postcss/postcss-cli) 37 | - [Autoprefixer](https://github.com/postcss/autoprefixer) 38 | - [Babel](https://babeljs.io/) 39 | - [Pygments](https://pygments.org/) 40 | - [Asciidoctor](https://asciidoctor.org/) 41 | - [Pandoc](https://pandoc.org/) 42 | - [Docutils](https://docutils.sourceforge.io/) / [RST](https://docutils.sourceforge.io/rst.html) 43 | - [Embedded Dart Sass](https://github.com/sass/dart-sass-embedded) 44 | 45 | Node (with NPM and Yarn), Go (for [Hugo Modules](https://gohugo.io/hugo-modules/) support), and Python are also pre-installed. 46 | 47 | ## Licenses 48 | 49 | 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). 50 | -------------------------------------------------------------------------------- /action.yml: -------------------------------------------------------------------------------- 1 | name: "Hugo Build" 2 | description: "Hugo as an action, with extended support and legacy versions" 3 | author: jakejarvis 4 | runs: 5 | using: docker 6 | image: docker://ghcr.io/jakejarvis/hugo-extended:0.111.3 7 | branding: 8 | icon: edit 9 | color: gray-dark 10 | --------------------------------------------------------------------------------