commit 5dad07d32a459aeac8357601fda9124841371d1b parent f6673d0c475c839275e4a71ab4afcb16d15d2bbc Author: David Eisinger <[email protected]> Date: Thu, 16 Nov 2023 09:53:31 -0500 Deploy script Diffstat:
| M | .github/workflows/deploy.yml | | | 5 | ++++- |
| A | bin/deploy | | | 15 | +++++++++++++++ |
2 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml @@ -19,13 +19,16 @@ jobs: if: ${{ github.ref == 'refs/heads/main' }} env: DEPLOY_KEY: ${{ secrets.CI_DEPLOY_KEY }} + SERVER_IP: ${{ secrets.SERVER_IP }} run: | mkdir -p ~/.ssh chmod 700 ~/.ssh echo "$DEPLOY_KEY" > ~/.ssh/id_rsa chmod 600 ~/.ssh/id_rsa - ssh-keyscan 107.170.116.37 > ~/.ssh/known_hosts + ssh-keyscan $SERVER_IP > ~/.ssh/known_hosts - name: Deploy if: ${{ github.ref == 'refs/heads/main' }} + env: + SERVER_IP: ${{ secrets.SERVER_IP }} run: bin/deploy diff --git a/bin/deploy b/bin/deploy @@ -0,0 +1,15 @@ +set -e + +rm -rf public + +source bin/get-last-commit.sh + +hugo --ignoreCache + +rsync \ + -v \ + -r \ + --delete \ + -e "ssh -o PubkeyAcceptedKeyTypes=+ssh-rsa" \ + public/* \ + www-data@$SERVER_IP:/var/www/davideisinger.com