fediparty/.woodpecker.yml
2023-01-26 21:48:01 +03:00

71 lines
2.3 KiB
YAML

pipeline:
# Build step: generates the files for Hexo site
build:
image: node:16.14.0
commands:
- npm install gulp -g
- npm install hexo-cli -g
- test -e package.json && npm install
- gulp build --cwd ./themes/starter
- hexo generate
when:
branch:
include: [ main ]
event: [push, deployment]
htmlproofer:
image: olikami/htmlproofer:3
commands:
- apk add git
- ( git show --no-patch --format=format:%B | grep htmlproofer >/dev/null ) && htmlproofer public/ --external-only --checks-to-ignore ScriptCheck,ImageCheck || true
when:
status: success
branch:
include: [ main ]
event: [push, deployment]
deploy:
image: alpine
secrets: [ deploy_key ]
commands:
- apk add rsync openssh
- mkdir ~/.ssh
- printf '%s\n' "$${DEPLOY_KEY}" > ~/.ssh/deploy_key
- printf "Host alexandria.debiania.in.ua\n\tIdentityFile ~/.ssh/deploy_key\n\tUserKnownHostsFile=/dev/null\n\tStrictHostKeyChecking=no\n" > ~/.ssh/config
- chmod -R u=rwX,go= ~/.ssh
- rsync -rPvce ssh --chmod=ugo=rwX --no-times public/ www-fediparty@alexandria.debiania.in.ua:www/
when:
# Only try to deploy if previous step is successful
status: success
branch:
include: [ main ]
event: [push, deployment]
commit:
image: alpine
secrets: [ ssh_key ]
commands:
- apk add git openssh
# configure git
- git config --global user.email "nonexistent@example.com"
- git config --global user.name "Codeberg CI"
- 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
- git checkout -b pages
# deploy changes
- git add -A
- git commit -m "Woodpecker build ${CI_COMMIT_SHA}"
- printf '%s\n' "$${SSH_KEY}" > key
- chmod 600 key
- git remote set-url origin git@codeberg.org:fediverse/fediparty.git
- GIT_SSH_COMMAND='ssh -i ./key -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' git push --force origin pages
when:
# Only try to commit if previous step is successful
status: success
branch:
include: [ main ]
event: [push, deployment]