From b3827ba136196ff3d762191399654a04f9c40c29 Mon Sep 17 00:00:00 2001 From: David Eisinger Date: Tue, 10 Jan 2023 21:39:09 -0500 Subject: [PATCH] Add deploy workflow --- .github/workflows/deploy.yml | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .github/workflows/deploy.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..f6af98a --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,34 @@ +name: Deploy +on: [push, workflow_dispatch] +jobs: + deploy: + runs-on: ubuntu-22.04 + steps: + - name: Git checkout + uses: actions/checkout@v2 + + - name: Setup hugo + uses: peaceiris/actions-hugo@v2 + with: + hugo-version: "0.109.0" + extended: true + + - name: Build + run: hugo + + - name: Install SSH deploy key + if: ${{ github.ref == 'refs/heads/main' }} + env: + DEPLOY_KEY: ${{ secrets.CI_DEPLOY_KEY }} + 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 + + - name: Deploy + if: ${{ github.ref == 'refs/heads/main' }} + run: | + cd public + scp -o PubkeyAcceptedKeyTypes=+ssh-rsa -r * www-data@107.170.116.37:/var/www/davideisinger.com