OpenMiInk/third_party/kde-ci-utilities/gitlab-templates/website-hugo.yml
Hellings b8c8ff98e2 Hi
2026-10-16 09:05:56 -04:00

57 lines
2 KiB
YAML

include: /gitlab-templates/blocks/workflow.yml
.hugo_post_build:
script:
- echo "No post-build hook configured"
hugo_website:
image: invent-registry.kde.org/sysadmin/ci-images/staticweb:latest
tags:
- Linux
stage: build
rules:
# Prevent branch pipelines if an MR is open on the branch.
- if: $CI_COMMIT_BRANCH && $CI_PIPELINE_SOURCE == "push" && $CI_OPEN_MERGE_REQUESTS
when: never
# Ensure we build with the correct parameters for Hugo builds on non-protected branches
- if: $CI_COMMIT_REF_PROTECTED != "true"
variables:
HUGO_BASEURL: https://$CI_PROJECT_NAMESPACE.local-kde.org/-/$CI_PROJECT_NAME/-/jobs/$CI_JOB_ID/artifacts/public/
HUGO_ADDITIONAL_ARGS: --buildFuture --buildDrafts --baseURL "$HUGO_BASEURL"
# Allow merge request pipelines.
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
# Build tags and branches too
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_BRANCH
variables:
LANG: en_US.UTF-8
before_script:
- git config --global --add safe.directory $CI_PROJECT_DIR
- git clone https://invent.kde.org/sysadmin/ci-utilities.git
- git clone https://invent.kde.org/sysadmin/ci-notary-service.git
script:
- |
if [ -f "scripts/custom_generation.py" ]; then
python3 scripts/custom_generation.py
elif [ -d "po" ]; then
export PACKAGE="$CI_PROJECT_PATH_SLUG"
hugoi18n compile po
hugoi18n generate
else
echo "No data processing"
fi
- hugo mod npm pack
- |
if [ -f "package.json" ]; then
npm install
fi
- echo "Running Hugo with:" $HUGO_ADDITIONAL_ARGS
- PATH=/opt/dart-sass:$PATH hugo --minify $HUGO_ADDITIONAL_ARGS
- !reference [.hugo_post_build, script]
- python3 -u ci-notary-service/publishwebsite.py --config ci-utilities/signing/publishwebsite.ini public/
- if [[ -e /tmp/task-debug.log ]]; then mv /tmp/task-debug.log $CI_PROJECT_DIR/; fi
artifacts:
expire_in: 2 days
paths:
- public/
- task-debug.log