2021-09-11 17:10:32 +02:00
|
|
|
clone:
|
|
|
|
git:
|
|
|
|
image: plugins/git:next
|
|
|
|
|
|
|
|
pipeline:
|
2021-09-23 17:54:19 +02:00
|
|
|
build:
|
2021-09-11 17:10:32 +02:00
|
|
|
image: node:14-alpine
|
2021-09-23 17:54:19 +02:00
|
|
|
commands:
|
|
|
|
- cd docs/
|
|
|
|
- yarn install --frozen-lockfile
|
|
|
|
- yarn build
|
|
|
|
when:
|
|
|
|
event: [push, pull_request]
|
|
|
|
path: "docs/**"
|
|
|
|
|
|
|
|
deploy:
|
|
|
|
image: alpine:3.14.2
|
2021-09-11 17:10:32 +02:00
|
|
|
secrets:
|
|
|
|
- BOT_PRIVATE_KEY
|
|
|
|
commands:
|
2021-09-23 17:54:19 +02:00
|
|
|
- apk add openssh-client git rsync
|
2021-09-11 17:10:32 +02:00
|
|
|
- mkdir -p $HOME/.ssh
|
|
|
|
- ssh-keyscan -t rsa github.com >> $HOME/.ssh/known_hosts
|
2021-09-11 17:16:26 +02:00
|
|
|
- echo "$BOT_PRIVATE_KEY" > $HOME/.ssh/id_rsa
|
2021-09-11 17:10:32 +02:00
|
|
|
- chmod 0600 $HOME/.ssh/id_rsa
|
2021-09-11 18:48:52 +02:00
|
|
|
- git config --global user.email "woodpecker-bot@obermui.de"
|
|
|
|
- git config --global user.name "woodpecker-bot"
|
2021-09-23 17:54:19 +02:00
|
|
|
- git clone -b master --single-branch git@github.com:woodpecker-ci/woodpecker-ci.github.io.git /repo
|
|
|
|
# copy all docs files and delete all old ones, but leave CNAME and index.yaml untouched
|
|
|
|
- rsync -r --exclude .git --exclude CNAME --exclude index.yaml --exclude README.md --delete docs/build/ /repo
|
|
|
|
- cd /repo
|
|
|
|
- git add .
|
|
|
|
# exit successfully if nothing changed
|
|
|
|
- test -n "$(git status --porcelain)" || exit 0
|
2021-11-25 21:43:31 +02:00
|
|
|
- git commit -m "Deploy website - based on ${CI_COMMIT_SHA}"
|
2021-09-23 17:54:19 +02:00
|
|
|
- git push
|
2021-09-11 17:10:32 +02:00
|
|
|
when:
|
|
|
|
event: push
|
|
|
|
branch: master
|
2021-09-21 06:18:43 +02:00
|
|
|
path: "docs/**"
|
2021-09-11 17:10:32 +02:00
|
|
|
|