web-archive/.woodpecker/upload.yml

25 lines
769 B
YAML
Raw Permalink Normal View History

2023-09-01 08:20:19 +02:00
when:
event: push
branch: main
2024-08-21 11:47:21 +02:00
variables:
- &SSH_PORT '2003'
2023-09-01 08:20:19 +02:00
steps:
upload:
image: alpine:latest
secrets:
2024-08-21 11:47:21 +02:00
- RSYNC_SSHKEY
- RSYNC_TARGET_SERVER
- RSYNC_TARGET_USER
2023-09-01 08:20:19 +02:00
environment:
2024-08-21 11:47:21 +02:00
TARGET_PATH: /webroot/web-archive.lauka.net
RSYNC_TARGET_PORT: *SSH_PORT
2023-09-01 08:20:19 +02:00
commands:
- apk add --update --no-cache openssh rsync git
- mkdir -p $HOME/.ssh
2024-08-21 11:47:21 +02:00
- echo "$RSYNC_SSHKEY" > $HOME/.ssh/id_ed25519
2023-09-01 08:20:19 +02:00
- chmod 0600 $HOME/.ssh/id_ed25519
2024-08-21 11:47:21 +02:00
- ssh-keyscan -t ed25519 -p $RSYNC_TARGET_PORT $RSYNC_TARGET_SERVER >> $HOME/.ssh/known_hosts
- rsync -avh -e "ssh -p $RSYNC_TARGET_PORT" --delete ./ $RSYNC_TARGET_USER@$RSYNC_TARGET_SERVER:$TARGET_PATH --exclude 'readme.md' --exclude '.woodpecker' --exclude '.git'