diff --git a/Jekyll/.woodpecker/jekyll.yaml b/Jekyll/.woodpecker/jekyll.yaml index 9089440..1e0627c 100644 --- a/Jekyll/.woodpecker/jekyll.yaml +++ b/Jekyll/.woodpecker/jekyll.yaml @@ -5,61 +5,55 @@ # Takes a repository with jekyll source, generates the static site and # pushes the result to codeberg pages # -# Needs a ssh key as secret in woodpecker config +# Needs a codeberg access token (cbtoken) as secret in woodpecker config +# Also uses another secret (cbmail) with email address for git config +# +# CBIN must be replaced with the source repo +# CBOUT must be replaced with the target codeberg pages repo +# CBUSER must be replaced with the user/org # # See the _config.yml file for the important keep_files: line to preserve # git metadata during build # # We also assume a domains file in the source repo that gets copied to # .domains in the target repo so codeberg pages works for custom domains -# for more information, https://docs.codeberg.org/codeberg-pages/ - -when: - branch: main - event: [push, pull_request] - -clone: - - name: clone - image: docker.io/woodpeckerci/plugin-git - # clone the static page repository - - name: clone-page - image: docker.io/woodpeckerci/plugin-git - settings: - partial: false - remote: https://codeberg.org/Colgrave/.git - path: _site - # clone the pages branch - # - name: clone-page - # image: woodpeckerci/plugin-git - # settings: - # branch: pages - # partial: false - # path: _site +# steps: - - name: build - image: docker.io/bretfisher/jekyll:latest + build: + when: + event: [push, pull_request] + # Use the official jekyll build container + image: jekyll/jekyll + environment: + # secrets must be set in Woodpecker configuration + CBMAIL: + from_secret: cbmail + CBTOKEN: + from_secret: cbtoken commands: + # Avoid permission denied errors + - chmod -R a+w . + # Set up git in a working way + - git config --global --add safe.directory /woodpecker/src/codeberg.org/CBUSER/CBIN/_site + - git config --global user.email "$CBMAIL" + - git config --global user.name "CI Builder" + - git config --global init.defaultBranch pages + # clone and move the target repo + - git clone -b pages https://codeberg.org/CBUSER/CBOUT.git + - mv CBOUT _site + - chmod -R a+w _site + - cd _site + # Prepare for push + - git remote set-url origin https://$CBTOKEN@codeberg.org/CBUSER/CBOUT.git + - cd .. # Run Jekyll build stage - bundle install - bundle exec jekyll build # Only needed for custom domains - # - cp .domains _site/.domains - - - name: push - # for more information about plugin settings, please refer to - # https://github.com/appleboy/drone-git-push/blob/master/DOCS.md - image: docker.io/appleboy/drone-git-push:latest - settings: - ssh_key: - from_secret: codeberg_ssh - # push to your static page repository, change it to your need - remote: git@codeberg.org:Colgrave/pages.git - # if you are using a branch rather than a repo, change `remote` setting - # and change `branch` to `pages` - branch: main - path: _site - commit: true - # force: boolean, force push using the `--force` flag, defaults to false - # commit_message: add a custom message for commit, if it is omitted, it will be `[skip ci] Commit dirty state` - # empty_commit: boolean, if you only want generate an empty commit, you can do it using this option + - cp domains _site/.domains + # Push to target + - cd _site + - git add --all + - git commit -m "Woodpecker CI Jekyll Build at $( env TZ=Europe/Berlin date +"%Y-%m-%d %X %Z" ) [SKIP CI]" + - git push