60 lines
1.9 KiB
YAML
60 lines
1.9 KiB
YAML
# NodeJS / 11ty on Woodpecker to codeberg pages
|
|
#
|
|
# 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
|
|
# CBEMAIL 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
|
|
|
|
steps:
|
|
- name: build
|
|
when:
|
|
- branch: pages
|
|
event: push
|
|
- event: manual
|
|
image: node
|
|
environment:
|
|
CBUSERNAME: inherentlee
|
|
SOURCEREPO: fedi-skillshares-src
|
|
DESTREPO: fedi-skillshares
|
|
CBTOKEN:
|
|
from_secret: CBTOKEN
|
|
CBEMAIL:
|
|
from_secret: CBEMAIL
|
|
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 "$CBEMAIL"
|
|
- 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-codeberg
|
|
# 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
|