Files
blog/.woodpecker.yml
2023-12-25 04:21:04 +03:00

48 lines
1.2 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
commands:
- apk add zola
- zola build
when:
event: [ pull_request, push ]
publish:
image: bitnami/git
# Must be set in Woodpecker configuration
secrets: [ mail, codeberg_token ]
environment:
- ZOLA_OUTPUT=public
commands:
# Git configuration
- git config --global user.email $MAIL
- git config --global user.name "Woodpecker CI"
- git clone -b pages https://$CODEBERG_TOKEN@codeberg.org/$CI_REPO.git $CI_REPO_NAME
# Remove old files from repository
- ls # Debug
- git -C "$CI_REPO_NAME" rm -r *
- ls # Debug
# Copy build step output to repository folder
- cp -ar "$ZOLA_OUTPUT/." "$CI_REPO_NAME/"
- ls # Debug
# Commit and push all static files with pipeline started timestamp
- cd "$CI_REPO_NAME"
- git add .
- git commit -m "Woodpecker CI ${CI_COMMIT_SHA} [SKIP CI]"
- git push
when:
event: push