From f51fe90a93c7dac5cbf3b0f5610fa01d9b852f31 Mon Sep 17 00:00:00 2001 From: Adora Laura Kalb Date: Thu, 4 Jul 2024 11:02:55 +0200 Subject: [PATCH] add rsync deployment --- .woodpecker/deploy-rsync.yml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .woodpecker/deploy-rsync.yml diff --git a/.woodpecker/deploy-rsync.yml b/.woodpecker/deploy-rsync.yml new file mode 100644 index 0000000..ec7aff0 --- /dev/null +++ b/.woodpecker/deploy-rsync.yml @@ -0,0 +1,31 @@ +steps: + build: + image: golang:1.21-bookworm + environment: + - HUGO_VERSION=0.123.4 + - TZ=Europe/Berlin + when: + - event: push + branch: [main, staging] + commands: + - wget https://github.com/gohugoio/hugo/releases/download/v$${HUGO_VERSION}/hugo_extended_$${HUGO_VERSION}_linux-amd64.deb && apt install ./hugo_extended_$${HUGO_VERSION}_linux-amd64.deb && rm -f hugo_extended_$${HUGO_VERSION}_linux-amd64.deb + - hugo --minify --destination ./public + + upload: + image: alpine:latest + secrets: + - RSYNC_SSHKEY + - RSYNC_TARGET_SERVER + - RSYNC_TARGET_USER + environment: + - TARGET_PATH=/webroot/certwarden-deploy.adora.codes + when: + - event: push + branch: main + commands: + - apk add --update --no-cache openssh rsync git + - mkdir -p $HOME/.ssh + - echo "$RSYNC_SSHKEY" > $HOME/.ssh/id_ed25519 + - chmod 0600 $HOME/.ssh/id_ed25519 + - ssh-keyscan -t ed25519 $RSYNC_TARGET_SERVER >> $HOME/.ssh/known_hosts + - rsync -avh --delete ./public/ $RSYNC_TARGET_USER@$RSYNC_TARGET_SERVER:$TARGET_PATH