1
mirror of https://github.com/jakejarvis/hugo-docker.git synced 2025-04-26 12:58:28 -04:00

Install extended Hugo by default (will take effect on next Hugo release)

This commit is contained in:
Jake Jarvis 2019-09-30 00:25:52 -04:00
parent 1f63c4e705
commit cf061dc841
Signed by: jake
GPG Key ID: 2B0C9CF251E69A39
2 changed files with 13 additions and 9 deletions

View File

@ -1,26 +1,30 @@
FROM alpine:latest FROM alpine:latest
ENV HUGO_VERSION 0.58.3 ENV HUGO_VERSION 0.58.3
# remove/comment the following line completely to build with vanilla Hugo:
ENV HUGO_EXTENDED 1
LABEL "com.github.actions.name"="Hugo Build" LABEL "com.github.actions.name"="Hugo Build"
LABEL "com.github.actions.description"="Hugo as an action. Includes legacy versions." LABEL "com.github.actions.description"="Hugo as an action, with extended support and legacy versions"
LABEL "com.github.actions.icon"="edit" LABEL "com.github.actions.icon"="edit"
LABEL "com.github.actions.color"="gray-dark" LABEL "com.github.actions.color"="gray-dark"
LABEL version="${HUGO_VERSION}" LABEL version="${HUGO_VERSION}${HUGO_EXTENDED:+-extended}"
LABEL repository="https://github.com/jakejarvis/hugo-build-action" LABEL repository="https://github.com/jakejarvis/hugo-build-action"
LABEL homepage="https://jarv.is/" LABEL homepage="https://jarv.is/"
LABEL maintainer="Jake Jarvis <jake@jarv.is>" LABEL maintainer="Jake Jarvis <jake@jarv.is>"
# only install libc6-compat & libstdc++ if we're building extended Hugo
# https://gitlab.com/yaegashi/hugo/commit/22f0d5cbd6114210ba7835468facbdee60609aa2
RUN apk update && \ RUN apk update && \
apk add --no-cache ca-certificates && \ apk add --no-cache ca-certificates ${HUGO_EXTENDED:+libc6-compat libstdc++} && \
update-ca-certificates && \ update-ca-certificates && \
wget https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_${HUGO_VERSION}_Linux-64bit.tar.gz && \ wget https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_${HUGO_EXTENDED:+extended_}${HUGO_VERSION}_Linux-64bit.tar.gz && \
wget https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_${HUGO_VERSION}_checksums.txt && \ wget https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_${HUGO_VERSION}_checksums.txt && \
grep hugo_${HUGO_VERSION}_Linux-64bit.tar.gz hugo_${HUGO_VERSION}_checksums.txt | sha256sum -c && \ grep hugo_${HUGO_EXTENDED:+extended_}${HUGO_VERSION}_Linux-64bit.tar.gz hugo_${HUGO_VERSION}_checksums.txt | sha256sum -c && \
tar xf hugo_${HUGO_VERSION}_Linux-64bit.tar.gz && \ tar xf hugo_${HUGO_EXTENDED:+extended_}${HUGO_VERSION}_Linux-64bit.tar.gz && \
mv ./hugo /usr/bin && \ mv ./hugo /usr/bin && \
chmod +x /usr/bin/hugo && \ chmod +x /usr/bin/hugo && \
rm -rf hugo_${HUGO_VERSION}_* rm -rf hugo_*
ENTRYPOINT ["hugo"] ENTRYPOINT ["hugo"]

View File

@ -2,13 +2,13 @@
> **⚠️ Note:** To use this action, you must have access to the [GitHub Actions](https://github.com/features/actions) feature. GitHub Actions are currently only available in public beta. You can [apply for the GitHub Actions beta here](https://github.com/features/actions/signup/). > **⚠️ Note:** To use this action, you must have access to the [GitHub Actions](https://github.com/features/actions) feature. GitHub Actions are currently only available in public beta. You can [apply for the GitHub Actions beta here](https://github.com/features/actions/signup/).
This is a simple GitHub Action that contains [Hugo](https://github.com/gohugoio/hugo), the popular static site generator. Unlike other actions, this action includes releases going back to [v0.27](https://github.com/gohugoio/hugo/releases/tag/v0.27) (Sept. 11, 2017) for any compatibility requirements. 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 ## Usage
### `workflow.yml` Example ### `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 my [s3-sync-action](https://github.com/jakejarvis/s3-sync-action), to upload the built static site somewhere accessible. 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 `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). 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).