Continuous Deployment using Woodpecker #2
2 changed files with 50 additions and 5 deletions
49
.woodpecker/.hugo-build.yml
Normal file
49
.woodpecker/.hugo-build.yml
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
pipeline:
|
||||||
|
build-stable:
|
||||||
|
image: code.cozy.town/vrifox/hugoci:latest
|
||||||
|
commands:
|
||||||
|
- hugo --destination /woodpecker/build/ --minify --cleanDestinationDir
|
||||||
|
when:
|
||||||
|
branch: main
|
||||||
|
|
||||||
|
upload-stable:
|
||||||
|
image: code.cozy.town/vrifox/hugoci:latest
|
||||||
|
commands:
|
||||||
|
- mkdir -p /root/.ssh
|
||||||
|
- echo "$SSH_KEY" > /root/.ssh/id_ed25519
|
||||||
|
- chmod 700 /root/.ssh/id_ed25519
|
||||||
|
- echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > /root/.ssh/config
|
||||||
|
- rsync -rv --delete -e "ssh -p $SSH_PORT -i /root/.ssh/id_ed25519" /woodpecker/build/ caddy@$SSH_HOST:/var/lib/caddy/woodpecker/cozy.town/ --mkpath --checksum
|
||||||
|
secrets:
|
||||||
|
- ssh_key
|
||||||
|
- ssh_port
|
||||||
|
- ssh_host
|
||||||
|
when:
|
||||||
|
branch: main
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
build-dev:
|
||||||
|
image: code.cozy.town/vrifox/hugoci:latest
|
||||||
|
commands:
|
||||||
|
- hugo --destination /woodpecker/build/ --baseURL "https://dev.vrifox.cc/${CI_COMMIT_BRANCH}/${CI_COMMIT_SHA}/" --cleanDestinationDir
|
||||||
|
when:
|
||||||
|
branch:
|
||||||
|
exclude: main
|
||||||
|
|
||||||
|
upload-dev:
|
||||||
|
image: code.cozy.town/vrifox/hugoci:latest
|
||||||
|
commands:
|
||||||
|
- mkdir -p /root/.ssh
|
||||||
|
- echo "$SSH_KEY" > /root/.ssh/id_ed25519
|
||||||
|
- chmod 700 /root/.ssh/id_ed25519
|
||||||
|
- echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > /root/.ssh/config
|
||||||
|
- rsync -rv --delete -e "ssh -p $SSH_PORT -i /root/.ssh/id_ed25519" /woodpecker/build/ caddy@$SSH_HOST:/var/lib/caddy/woodpecker/cozy.town-dev/${CI_COMMIT_BRANCH}/${CI_COMMIT_SHA}/ --mkpath --checksum
|
||||||
|
- echo "The preview is now available on https://dev.cozy.town/${CI_COMMIT_BRANCH}/${CI_COMMIT_SHA}/"
|
||||||
|
secrets:
|
||||||
|
- ssh_key
|
||||||
|
- ssh_port
|
||||||
|
- ssh_host
|
||||||
|
when:
|
||||||
|
branch:
|
||||||
|
exclude: main
|
|
@ -2,8 +2,4 @@ Website of Cozy Town written in HTML and SCSS using hugo.
|
||||||
|
|
||||||
# Deploy
|
# Deploy
|
||||||
|
|
||||||
``` bash
|
Auto-deploy using [Woodpecker](https://make.cozy.town/cozytown/website).
|
||||||
hugo && \
|
|
||||||
rsync -avz --delete public/ vri@cozy.town:/home/vrifox/upload/town.cozy/ && \
|
|
||||||
ssh vri@cozy.town "sudo /home/vrifox/deploy-cozy.town.sh"
|
|
||||||
```
|
|
Loading…
Reference in a new issue