48 lines
1.4 KiB
YAML
48 lines
1.4 KiB
YAML
# Exclude the pipeline to run on the pages branch
|
|
when:
|
|
branch:
|
|
exclude: pages
|
|
|
|
# Clone recursively to fully clone the themes given as Git submodules
|
|
clone:
|
|
git:
|
|
image: woodpeckerci/plugin-git
|
|
settings:
|
|
recursive: true
|
|
|
|
steps:
|
|
# Build Zola static files
|
|
build:
|
|
image: alpine:edge
|
|
commands:
|
|
- apk add zola
|
|
- zola --version
|
|
- zola build
|
|
when:
|
|
event: [push, pull_request, manual]
|
|
|
|
publish:
|
|
image: bitnami/git
|
|
# Must be set in Woodpecker configuration
|
|
# mail: Your email address used by Codebrg
|
|
# codeberg_token: Codeberg access token with "write:repository" permission
|
|
secrets: [mail, codeberg_token]
|
|
commands:
|
|
# Configure Git
|
|
- git config --global user.email $MAIL
|
|
- git config --global user.name "Woodpecker CI"
|
|
# Clone the output branch
|
|
- git clone --branch pages https://$CODEBERG_TOKEN@codeberg.org/$CI_REPO.git $CI_REPO_NAME
|
|
# Enter the output branch
|
|
- cd $CI_REPO_NAME
|
|
# Remove old files
|
|
- git rm -r "*" || true # Don't fail if there's nothing to remove
|
|
# Copy the output of the build step
|
|
- cp -ar ../public/. .
|
|
# Commit and push all static files with the source commit hash
|
|
- git add --all
|
|
- git commit -m "Woodpecker CI ${CI_COMMIT_SHA} [SKIP CI]" --allow-empty
|
|
- git push
|
|
when:
|
|
event: [push, manual]
|