'Added Jekyll example with explanation' (#4)

Reviewed-on: https://codeberg.org/Codeberg-CI/examples/pulls/4
This commit is contained in:
6543 2022-07-24 20:18:09 +02:00
commit ab0c2ce5d7
2 changed files with 58 additions and 0 deletions

9
Jekyll/_config.yml Normal file
View File

@ -0,0 +1,9 @@
title: My Jekyll Site
url: https://www.myjekyllsite.TLD
description: This is a beautiful page.
remote_theme: pages-themes/cayman@v0.2.0
plugins:
- jekyll-remote-theme # add this line to the plugins list if you already have one
# The keep_files are needed to preserve git metadata when building
keep_files: [ .domains, LICENSE, .git, .gitignore ]
exclude: [ domains ]

49
Jekyll/cpages.yml Normal file
View File

@ -0,0 +1,49 @@
# cpages.yml
#
# Takes a repository with jekyll source, generates the static site and
# pushes the result to codeberg pages
#
# 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
#
pipeline:
build:
# Use the official jekyll build container
image: jekyll/jekyll
secrets: [ cbtoken, cbmail ]
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 taret 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
# Push to target
- cd _site
- git add --all
- git commit -m "Woodpecker CI Jekyll Build"
- git push