diff --git a/.woodpecker.yml b/.woodpecker.yml index bd4e0ba..ada1416 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -10,7 +10,8 @@ steps: from_secret: container_registry_username password: from_secret: container_registry_password - build-args: "BASE_URL=https://minimal-setups.hottis.de" + build-args: "BASE_URL=https://minimal-setups.hottis.de, RELEASETAG=${CI_COMMIT_SHA}" + dockerfile: Dockerfile when: - event: [push,tag] diff --git a/Dockerfile b/Dockerfile index 2c737b7..aed9120 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,11 @@ # builder FROM hugomods/hugo:base-non-root AS builder ARG BASE_URL "" +ARG RELEASETAG "unset" # --chown is required since kaniko in woodpecker otherwise copies as root and # the hugo command below fails since it is executed as hugo COPY --chown=hugo:hugo content/ /src +RUN sed -i 's/%RELEASETAG%/'${RELEASETAG}'/' /src/content/about.md RUN if [ "$BASE_URL" = ""]; then hugo; else hugo -b $BASE_URL; fi # server diff --git a/content/content/about.md b/content/content/about.md index 25b8923..1c40a5f 100644 --- a/content/content/about.md +++ b/content/content/about.md @@ -3,13 +3,12 @@ title: "About" menu: main: weight: 1 -releasetag: '{{ getenv "HUGO_RELEASETAG"}}' --- ## About This is the about page -{{ .Params.releasetag }} +%RELEASETAG% diff --git a/content/hugo.toml b/content/hugo.toml index 8f5daaa..cbbb72b 100644 --- a/content/hugo.toml +++ b/content/hugo.toml @@ -1,6 +1,6 @@ baseURL = 'https://example.org/' languageCode = 'en-us' -title = 'Minimal Setups {{ getenv "HUGO_RELEASETAG }}' +title = 'Minimal Setups {{ getenv "HUGO_RELEASETAG" }}' theme = "ananke" sectionPagesMenu = "main"