fediparty/.woodpecker.yml
2022-01-22 16:13:05 +03:00

60 lines
1.8 KiB
YAML

pipeline:
key_check:
image: debian:testing-slim
secrets: [ ssh_key ]
commands:
- apt-get update
- apt-get -y -qq install --no-install-recommends ssh-client
- printf '%s\n' "$${SSH_KEY}" > key
- chmod 600 key
- wc -c key
- sha256sum key
- ssh-keygen -l -f key
when:
branch:
include: [ main ]
event: [push, deployment]
# Build step: generates the files for Hexo site
build:
image: node:12.22.1
commands:
- npm install gulp -g
- npm install hexo-cli -g
- test -e package.json && npm install
- gulp build --cwd ./themes/starter
- hexo generate
- 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
when:
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"
- 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
#- ssh-keygen -l -f key
- git remote set-url origin git@codeberg.org:fediverse/fediparty.git
- GIT_SSH_COMMAND='ssh -vvv -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]