diff --git a/.woodpecker.yml b/.woodpecker.yml index 5f320f9..d8dae43 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -15,3 +15,4 @@ pipeline: - woodpecker-cli lint Rust/ - woodpecker-cli lint Python/ - woodpecker-cli lint tectonic/ + - woodpecker-cli lint NodeJS/11ty.yml \ No newline at end of file diff --git a/NodeJS/11ty.yml b/NodeJS/11ty.yml new file mode 100644 index 0000000..ed85385 --- /dev/null +++ b/NodeJS/11ty.yml @@ -0,0 +1,51 @@ +# NodeJS / 11ty on Woodpecker to codeberg pages +# +# https://cjerrington.codeberg.page/eleventy-base-blog-site/blog/codebergpagesbuild/ +# +# This file would typically be .woodpecker.yml in the root of your repository. +# +# Takes a repository with 11ty source, generates the static site and +# pushes the result to codeberg pages +# +# +# SECRETS +# https://woodpecker-ci.org/docs/usage/secrets +# CBTOKEN needs a codeberg access token as secret in woodpecker config +# CBMAIL with email address for git config +# SOURCEREPO must be replaced with the source repo +# DESTREPO must be replaced with the target codeberg pages repo +# CBUSERNAME must be replaced with the user/org +# +# +# 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: node + secrets: [ cbtoken, cbmail, cbusername, sourcerepo, destrepo ] + 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/$CBUSERNAME/$SOURCEREPO/_site + - git config --global user.email "$CBMAIL" + - git config --global user.name "CI Builder" + # clone and move the target repo + - git clone -b pages https://codeberg.org/$CBUSERNAME/$DESTREPO.git _site + - chmod -R a+w _site + - cd _site + # Prepare for push + - git remote set-url origin https://$CBTOKEN@codeberg.org/$CBUSERNAME/$DESTREPO.git + - cd .. + # Run 11ty build stage + - npm install + - npm run build + # Only needed for custom domains + #- cp domains _site/.domains + # Push to target + - cd _site + - git add --all + - git commit -m "Woodpecker CI 11ty Build at $( env TZ=America/Chicago date +"%Y-%m-%d %X %Z" )" + - git push -u origin pages \ No newline at end of file diff --git a/README.md b/README.md index 7f8e23b..96ce89f 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,7 @@ Pull requests are accepted/welcome. | [Python/.woodpecker.yml](Python) | Python | Python venv | Standard CI pipeline to test Python packages code on multiple Python distributions. For details check [serial-sphinx](https://codeberg.org/sail.black/serial-sphinx.git) | | [Rust/.woodpecker.yml](Rust) | Rust | cargo | Simple CI pipeline to run cargo commands | | [tectonic/.woodpecker.yml](tectonic/.woodpecker.yml) | LaTeX | Tectonic | Builds a TeX file and pushes the resulting PDF file to a given repository. | +| [NodeJS/11ty.yml](NodeJS/11ty.yml) | JavaScript | NodeJS | CI to build static websites files and publish them to Codeberg Pages with 11ty | # More: