Files
blog/.woodpecker.yaml
2024-06-27 04:26:16 +03:00

48 lines
1.3 KiB
YAML

# Exclude page pipeline to be run on "pages" branch
when:
branch:
exclude: pages
# Recursive cloning is used 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
secrets: [mail, codeberg_token]
commands:
# Git configuration
- git config --global user.email $MAIL
- git config --global user.name "Woodpecker CI"
# Clone output branch
- git clone -b pages https://$CODEBERG_TOKEN@codeberg.org/$CI_REPO.git $CI_REPO_NAME
# Enter output branch folder
- cd $CI_REPO_NAME
# Remove old files
- git rm -r "*" || true # Ignore if it's empty
# Copy build step output
- cp -ar ../public/. .
# Needed for custom domains
- cp ../.domains . || true # Ignore if it doesn't exist
# Commit and push all static files with source commit SHA
- git add --all
- git commit -m "Woodpecker CI ${CI_COMMIT_SHA} [SKIP CI]" || true
- git push
when:
event: [push, manual]