Deploy script

This commit is contained in:
David Eisinger
2023-11-16 09:53:31 -05:00
parent f6673d0c47
commit 5dad07d32a
2 changed files with 19 additions and 1 deletions

View File

@@ -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

15
bin/deploy Executable file
View File

@@ -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