Add just build target, use in CI

This commit is contained in:
Xiretza 2025-02-11 20:17:20 +00:00
parent 118746921e
commit 4686be04a1
3 changed files with 17 additions and 8 deletions

View file

@ -22,15 +22,9 @@ jobs:
- name: Check
run: just check
- name: Replace version and timestamp
run: |
sed -i -e "s#{{TAG}}#$GITHUB_REF_NAME#g" ./hugo.toml
sed -i -e "s/{{COMMIT}}/$GITHUB_SHA/g" ./hugo.toml
sed -i -e "s/show_version = false/show_version = true/g" ./hugo.toml
- name: Build website
run: |
hugo build --minify
run: just build
- name: Copy to server
if: github.ref == 'refs/heads/master'
run: |

View file

@ -5,5 +5,9 @@ check:
format:
clang-format -i assets/js/*.js
build:
./create_versioned_hugo_toml.sh hugo.toml hugo_versioned.toml
hugo build --config hugo_versioned.toml --minify
serve:
hugo serve

11
create_versioned_hugo_toml.sh Executable file
View file

@ -0,0 +1,11 @@
#!/usr/bin/env bash
set -euo pipefail
# Usage: ./create_versioned_hugo_toml.sh INFILE OUTFILE
# Replaces the version placeholders in hugo.toml with versions taken from
# $GITHUB_REF_NAME and $GITHUB_SHA environment variables.
cp "$1" "$2"
sed -i -e "s#{{TAG}}#$GITHUB_REF_NAME#g" "$2"
sed -i -e "s/{{COMMIT}}/$GITHUB_SHA/g" "$2"
sed -i -e "s/show_version = false/show_version = true/g" "$2"