From a9785cf415076850f06bb6f942e7b4965b95ad04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Lohrer?= Date: Fri, 26 Apr 2024 11:46:03 +0000 Subject: [PATCH] =?UTF-8?q?.woodpecker.yml=20hinzugef=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .woodpecker.yml | 57 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 .woodpecker.yml diff --git a/.woodpecker.yml b/.woodpecker.yml new file mode 100644 index 0000000..a57455c --- /dev/null +++ b/.woodpecker.yml @@ -0,0 +1,57 @@ +# hugo.yml +# +# Takes a repository with Hugo source, generates the static site and +# pushes the result to Codeberg pages +# +# Needs a codeberg access token (codeberg_token) as a secret in Woodpecker config +# Also uses another secret (mail) with email address for git config +# +# .domains file in the repository is copied to the output branch so custom domains work +# +# The HUGO_OUTPUT variable must be set to the build output folder configured in Hugo +# + +# Exclude page pipeline to be run on "pages" branch +when: + branch: + exclude: pages + event: [push, pull_request] + +# Recursive cloning is used to fully clone the themes given as Git submodules +clone: + git: + image: woodpeckerci/plugin-git + settings: + recursive: true + +steps: + # Build hugo static files + build: + image: klakegg/hugo + commands: + - hugo --minify + when: + event: [pull_request, push] + + publish: + image: bitnami/git + # Must be set in Woodpecker configuration + secrets: [mail, codeberg_token] + environment: + - HUGO_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 + # Copy build step output to repository folder + - cp -ar $HUGO_OUTPUT/. $CI_REPO_NAME/ + # Needed for custom domains + - cp .domains $CI_REPO_NAME || true # Ignore if it doesn't exist + # Commit and push all static files with pipeline started timestamp + - cd $CI_REPO_NAME + - git add . + - git commit -m "Woodpecker CI ${CI_COMMIT_SHA}" + - git push + when: + event: push