2022-01-19 17:23:21 +00:00
|
|
|
|
|
|
|
pipeline:
|
2022-01-19 17:46:12 +00:00
|
|
|
# Build step: generates the files for Hexo site
|
|
|
|
build:
|
|
|
|
image: node:12.22.1
|
|
|
|
commands:
|
2022-01-22 10:27:40 +00:00
|
|
|
- npm install gulp -g
|
|
|
|
- npm install hexo-cli -g
|
|
|
|
- test -e package.json && npm install
|
|
|
|
- gulp build --cwd ./themes/starter
|
|
|
|
- hexo generate
|
2022-01-22 10:40:28 +00:00
|
|
|
- find -maxdepth 1 ! -name .git ! -name .domains ! -name public ! -name . -exec rm -rf {} \;
|
|
|
|
# This only copies non-hidden files; those whose names start with period WOULD NOT be copied
|
|
|
|
- mv public/* .
|
|
|
|
- rm -rf public
|
2022-01-19 18:07:40 +00:00
|
|
|
when:
|
|
|
|
branch:
|
|
|
|
include: [ main ]
|
|
|
|
event: [push, deployment]
|
2022-01-19 17:23:21 +00:00
|
|
|
|
2022-01-22 10:40:28 +00:00
|
|
|
commit:
|
2022-01-19 17:46:12 +00:00
|
|
|
image: alpine
|
|
|
|
commands:
|
2022-01-22 10:27:40 +00:00
|
|
|
- apk add git
|
2022-01-19 17:46:12 +00:00
|
|
|
# configure git
|
2022-01-22 10:27:40 +00:00
|
|
|
- git config --global user.email "nonexistent@example.com"
|
|
|
|
- git config --global user.name "Codeberg CI"
|
|
|
|
- git checkout -b pages
|
2022-01-19 17:46:12 +00:00
|
|
|
# deploy changes
|
2022-01-22 10:27:40 +00:00
|
|
|
- git add -A
|
|
|
|
- git commit -m "Woodpecker build ${CI_COMMIT_SHA}"
|
2022-01-22 10:40:28 +00:00
|
|
|
|
|
|
|
# Push step: it pushes the build output to "pages" branch
|
|
|
|
push:
|
|
|
|
image: appleboy/drone-git-push
|
2022-01-22 10:49:40 +00:00
|
|
|
secrets: [ ssh_key ]
|
2022-01-22 10:40:28 +00:00
|
|
|
settings:
|
|
|
|
branch: pages
|
|
|
|
remote: git@codeberg.org:fediverse/fediparty.git
|
|
|
|
# To work around "rejected...fetch first" error
|
|
|
|
force: true
|
|
|
|
ssh_key:
|
|
|
|
from_secret: ssh_key
|
|
|
|
when:
|
|
|
|
# Only try to commit if previous step is successful
|
|
|
|
status: success
|
|
|
|
branch:
|
|
|
|
# Only run on these branches
|
|
|
|
include: [ main ]
|
|
|
|
# ...and never on pages branch (to ignore build triggered by CI commits)
|
|
|
|
exclude: pages
|
|
|
|
# Execute on every event except "pull_request"
|
|
|
|
event: [push, tag, deployment]
|