Deploy script
This commit is contained in:
5
.github/workflows/deploy.yml
vendored
5
.github/workflows/deploy.yml
vendored
@@ -19,13 +19,16 @@ jobs:
|
|||||||
if: ${{ github.ref == 'refs/heads/main' }}
|
if: ${{ github.ref == 'refs/heads/main' }}
|
||||||
env:
|
env:
|
||||||
DEPLOY_KEY: ${{ secrets.CI_DEPLOY_KEY }}
|
DEPLOY_KEY: ${{ secrets.CI_DEPLOY_KEY }}
|
||||||
|
SERVER_IP: ${{ secrets.SERVER_IP }}
|
||||||
run: |
|
run: |
|
||||||
mkdir -p ~/.ssh
|
mkdir -p ~/.ssh
|
||||||
chmod 700 ~/.ssh
|
chmod 700 ~/.ssh
|
||||||
echo "$DEPLOY_KEY" > ~/.ssh/id_rsa
|
echo "$DEPLOY_KEY" > ~/.ssh/id_rsa
|
||||||
chmod 600 ~/.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
|
- name: Deploy
|
||||||
if: ${{ github.ref == 'refs/heads/main' }}
|
if: ${{ github.ref == 'refs/heads/main' }}
|
||||||
|
env:
|
||||||
|
SERVER_IP: ${{ secrets.SERVER_IP }}
|
||||||
run: bin/deploy
|
run: bin/deploy
|
||||||
|
|||||||
15
bin/deploy
Executable file
15
bin/deploy
Executable 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
|
||||||
Reference in New Issue
Block a user