From dd76e71c0abf87d8591f931a9afac1c101601e26 Mon Sep 17 00:00:00 2001 From: Elizabeth Hunt Date: Sat, 9 Mar 2024 13:40:07 -0700 Subject: [PATCH] rsync --- .drone.yml | 6 +++--- README.md | 2 +- deploy.sh | 7 ++++++- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.drone.yml b/.drone.yml index 4cb1c6b..e821334 100644 --- a/.drone.yml +++ b/.drone.yml @@ -8,11 +8,11 @@ steps: image: alpine commands: - sh compile.sh - - apk add openssh + - apk add rsync openssh - sh deploy.sh environment: - SSH_CONNECTION_STRING: - from_secret: SSH_CONNECTION_STRING + RSYNC_DESTINATION: + from_secret: RSYNC_DESTINATION SSH_KEY: from_secret: SSH_KEY diff --git a/README.md b/README.md index 6427ebc..e42f443 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,6 @@ instructions: 1. generate a new ssh key with no password (i.e. @ /tmp/id_ed25519) 2. add the key to .ssh/authorized_keys @ tilde.club -3. set SSH_CONNECTION_STRING in drone.io worker secrets to "@tilde.club" +3. set RSYNC_DESTINATION in drone.io worker secrets to "@tilde.club:/home/" 4. set SSH_KEY to (echo /tmp/id_ed25519 | base64 -e --wrap=0) 5. profit (keep it simple! don't want env vars leaking for obvious reasons...) diff --git a/deploy.sh b/deploy.sh index 1799e5c..3cbfff1 100755 --- a/deploy.sh +++ b/deploy.sh @@ -4,6 +4,11 @@ set -e echo $SSH_KEY | base64 -d >> /tmp/key chmod -R 0600 /tmp/key -scp -o StrictHostKeyChecking=no -i /tmp/key -r dist/* $SSH_CONNECTION_STRING:~ + +for i in dist/*; do + echo "copying $i" + rsync -e "ssh -i /tmp/key -o StrictHostKeyChecking=no" -avz --delete $i $RSYNC_DESTINATION/$i +done +echo "finished copying to remote host..." rm /tmp/key