2022-01-19 17:23:21 +00:00
|
|
|
|
2023-08-25 19:02:35 +00:00
|
|
|
steps:
|
2022-01-19 17:46:12 +00:00
|
|
|
# Build step: generates the files for Hexo site
|
|
|
|
build:
|
2022-02-17 16:01:12 +00:00
|
|
|
image: node:16.14.0
|
2022-01-19 17:46:12 +00:00
|
|
|
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-19 18:07:40 +00:00
|
|
|
when:
|
|
|
|
branch:
|
|
|
|
include: [ main ]
|
|
|
|
event: [push, deployment]
|
2022-01-19 17:23:21 +00:00
|
|
|
|
2022-02-07 19:22:40 +00:00
|
|
|
htmlproofer:
|
2022-12-01 20:12:21 +00:00
|
|
|
image: olikami/htmlproofer:3
|
2022-02-07 19:22:40 +00:00
|
|
|
commands:
|
2022-02-07 19:29:30 +00:00
|
|
|
- apk add git
|
2022-02-07 19:22:40 +00:00
|
|
|
- ( 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]
|
|
|
|
|
2022-01-29 13:43:26 +00:00
|
|
|
deploy:
|
|
|
|
image: alpine
|
|
|
|
secrets: [ deploy_key ]
|
|
|
|
commands:
|
2022-01-30 09:29:43 +00:00
|
|
|
- apk add rsync openssh
|
2022-01-29 18:24:04 +00:00
|
|
|
- mkdir ~/.ssh
|
2022-01-29 13:43:26 +00:00
|
|
|
- printf '%s\n' "$${DEPLOY_KEY}" > ~/.ssh/deploy_key
|
2023-02-27 21:21:02 +00:00
|
|
|
- printf "Host fediverse.party\n\tIdentityFile ~/.ssh/deploy_key\n\tUserKnownHostsFile=/dev/null\n\tStrictHostKeyChecking=no\n" > ~/.ssh/config
|
2022-01-29 13:43:26 +00:00
|
|
|
- chmod -R u=rwX,go= ~/.ssh
|
2023-02-27 21:21:02 +00:00
|
|
|
- rsync -rPvce ssh --chmod=ugo=rwX --no-times public/ www-fediparty@fediverse.party:www/
|
2022-01-29 13:43:26 +00:00
|
|
|
when:
|
|
|
|
# Only try to deploy if previous step is successful
|
|
|
|
status: success
|
|
|
|
branch:
|
|
|
|
include: [ main ]
|
|
|
|
event: [push, deployment]
|
|
|
|
|
2022-01-22 10:40:28 +00:00
|
|
|
commit:
|
2022-01-19 17:46:12 +00:00
|
|
|
image: alpine
|
2022-01-22 12:51:40 +00:00
|
|
|
secrets: [ ssh_key ]
|
2022-01-19 17:46:12 +00:00
|
|
|
commands:
|
2022-01-22 12:51:40 +00:00
|
|
|
- apk add git openssh
|
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"
|
2022-01-29 13:43:26 +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-22 10:27:40 +00:00
|
|
|
- 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 12:57:47 +00:00
|
|
|
- printf '%s\n' "$${SSH_KEY}" > key
|
|
|
|
- chmod 600 key
|
2022-01-22 12:51:40 +00:00
|
|
|
- git remote set-url origin git@codeberg.org:fediverse/fediparty.git
|
2023-01-26 18:48:01 +00:00
|
|
|
- GIT_SSH_COMMAND='ssh -i ./key -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' git push --force origin pages
|
2022-01-22 10:40:28 +00:00
|
|
|
when:
|
|
|
|
# Only try to commit if previous step is successful
|
|
|
|
status: success
|
|
|
|
branch:
|
|
|
|
include: [ main ]
|
2022-01-22 12:51:40 +00:00
|
|
|
event: [push, deployment]
|