Add gitlab-ci

This commit is contained in:
Savva 2023-11-05 16:23:42 +02:00
parent a2df0a58b1
commit 07b0ac0526

29
.gitlab-ci.yml Normal file
View File

@ -0,0 +1,29 @@
variables:
HUGO_VERSION: 0.120.3
GIT_DEPTH: 0
GIT_STRATEGY: clone
GIT_SUBMODULE_STRATEGY: recursive
image:
name: golang:1.21-bookworm
pages:
script:
# Install brotli
- apt-get update
- apt-get install -y brotli
# Install Hugo
- curl -LJO https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb
- apt-get install -y ./hugo_extended_${HUGO_VERSION}_linux-amd64.deb
- rm hugo_extended_${HUGO_VERSION}_linux-amd64.deb
# Build
- hugo --gc --minify
# Compress
- find public -type f -regex '.*\.\(css\|html\|js\|txt\|xml\)$' -exec gzip -f -k {} \;
- find public -type f -regex '.*\.\(css\|html\|js\|txt\|xml\)$' -exec brotli -f -k {} \;
artifacts:
paths:
- public
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH