1
mirror of https://github.com/jakejarvis/hugo-docker.git synced 2025-06-30 20:56:38 -04:00

Compare commits

..

4 Commits

Author SHA1 Message Date
03b1766d3a Update Dockerfile 2023-03-15 09:58:18 -04:00
b30a0a27a4 Update renovate.json 2023-03-15 09:57:43 -04:00
11f87f7979 Update renovate.json 2023-03-15 09:51:50 -04:00
f9afc458d0 Add renovate.json 2023-03-15 13:45:56 +00:00
4 changed files with 49 additions and 68 deletions

View File

@ -4,89 +4,79 @@ on:
push:
branches:
- master
pull_request:
branches:
- master
merge_group:
tags:
- 'v*'
workflow_dispatch:
# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-only-cancel-in-progress-jobs-or-runs-for-the-current-workflow
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
env:
HUB_IMAGE: jakejarvis/hugo-extended
GHCR_IMAGE: ghcr.io/jakejarvis/hugo-extended
jobs:
docker:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[skip ci]')"
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
with:
fetch-depth: 0
uses: actions/checkout@v3
- name: Prepare tags
id: tag
env:
HUB_IMAGE: jakejarvis/hugo-extended
GHCR_IMAGE: ghcr.io/jakejarvis/hugo-extended
run: |
TAGS="${HUB_IMAGE}:latest,${GHCR_IMAGE}:latest"
# If triggered by a new tag, add a version tag to the image
if [[ $GITHUB_REF == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/v}
TAGS="$TAGS,${HUB_IMAGE}:${VERSION},${GHCR_IMAGE}:${VERSION}"
fi
# Set output parameters
echo ::set-output name=tags::${TAGS}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
uses: docker/setup-qemu-action@v2
with:
platforms: linux/amd64,linux/arm64
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
if: ${{ github.ref == 'refs/heads/master' }}
uses: docker/login-action@v3
with:
username: jakejarvis
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Login to GitHub Container Registry
if: ${{ github.ref == 'refs/heads/master' }}
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GHCR_PAT }}
uses: docker/setup-buildx-action@v2
- name: Cache Docker layers
uses: actions/cache@v4
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Parse Hugo version
id: parse_version
run: |
HUGO_VERSION="$(grep -oP '(?<=^ARG HUGO_VERSION=).+$' Dockerfile)"
echo "HUGO_VERSION=$HUGO_VERSION" >> $GITHUB_OUTPUT
- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
username: jakejarvis
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Login to GitHub Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GHCR_PAT }}
- name: Build and push
id: build
uses: docker/build-push-action@v5
uses: docker/build-push-action@v3
with:
builder: ${{ steps.buildx.outputs.name }}
context: .
context: ./
file: ./Dockerfile
platforms: linux/amd64,linux/arm64
push: ${{ github.ref == 'refs/heads/master' }}
tags: "${{ env.HUB_IMAGE }}:latest,${{ env.GHCR_IMAGE }}:latest,${{ env.HUB_IMAGE }}:${{ steps.parse_version.outputs.HUGO_VERSION }},${{ env.GHCR_IMAGE }}:${{ steps.parse_version.outputs.HUGO_VERSION }}"
push: true
tags: ${{ steps.tag.outputs.tags }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
- name: Image digest
run: echo ${{ steps.build.outputs.digest }}
- name: Update hub description
uses: peter-evans/dockerhub-description@v4
if: ${{ github.ref == 'refs/heads/master' }}
with:
username: jakejarvis
password: ${{ secrets.DOCKER_HUB_TOKEN }}
repository: ${{ env.HUB_IMAGE }}
short-description: "✏️ Hugo Extended for x64 and ARM64 with PostCSS, Babel, Pandoc, and more baked in."
readme-filepath: ./README.md
enable-url-completion: true

View File

@ -1,6 +1,6 @@
# the following version can be overridden at image build time with --build-arg
# renovate: datasource=github-releases depName=gohugoio/hugo
ARG HUGO_VERSION=0.124.1
ARG HUGO_VERSION=0.111.3
# remove/comment the following line completely to compile vanilla Hugo:
ARG HUGO_BUILD_TAGS=extended
@ -8,7 +8,7 @@ ARG HUGO_BUILD_TAGS=extended
# ---
# Hugo >= v0.81.0 requires Go 1.16+ to build
FROM golang:1.22-alpine3.18 AS build
FROM golang:1.19-alpine3.17 AS build
# renew global args from above
# https://docs.docker.com/engine/reference/builder/#scope
@ -47,16 +47,16 @@ RUN go install github.com/yaegashi/muslstack@latest && \
# ---
FROM alpine:3.18
FROM alpine:3.17
# renew global args from above & pin any dependency versions
ARG HUGO_VERSION
# https://github.com/jgm/pandoc/releases
# renovate: datasource=github-releases depName=jgm/pandoc
ARG PANDOC_VERSION=3.1.13
ARG PANDOC_VERSION=2.19.2
# https://github.com/sass/dart-sass-embedded/releases
# renovate: datasource=github-releases depName=sass/dart-sass-embedded
ARG DART_SASS_VERSION=1.62.1
ARG DART_SASS_VERSION=1.59.3
LABEL version="${HUGO_VERSION}"
LABEL repository="https://github.com/jakejarvis/hugo-docker"

View File

View File

@ -3,8 +3,7 @@
"extends": [
"config:base"
],
"automerge": true,
"platformAutomerge": true,
"automerge": false,
"regexManagers": [
{
"fileMatch": [
@ -15,13 +14,5 @@
],
"versioningTemplate": "{{#if versioning}}{{{versioning}}}{{else}}semver{{/if}}"
}
],
"packageRules": [
{
"matchFiles": [
"^Dockerfile$"
],
"extractVersion": "^v(?<version>.*)$"
}
]
}