From 9e123b11244660e62a4fc18c38339eb4d3e27bf3 Mon Sep 17 00:00:00 2001 From: MattTheTekie <94870997+MattTheTekie@users.noreply.github.com> Date: Sat, 9 Mar 2024 17:11:41 -0500 Subject: [PATCH] Update push.yml --- .github/workflows/push.yml | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index ebc609f..4ef1bd6 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -11,9 +11,30 @@ jobs: steps: - name: Checkout Repository uses: actions/checkout@v2 - + +name: SSH Deployment + +on: + push: + branches: + - main + +jobs: + deploy: + runs-on: ubuntu-latest + + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Configure SSH + uses: webfactory/ssh-agent@v0.9.0 + with: + ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} + - name: Deploy run: | - TEMP=$(mktemp) - echo "${{ secrets.SSH_PRIVATE_KEY }}" > $TEMP - ssh -o 'StrictHostKeyChecking no' -i $TEMP mattthetekie@venith.net 'bash -s' < "mkdir /var/www/venith && rm -rf /var/www/venith && cd /var/www/ && git clone https://github.com/VenithNET/VENITH.NET/ && mv VENITH.NET venith" + cd ${{ github.workspace }} + ssh-keyscan -t rsa ${{ secrets.IP }} >> ~/.ssh/known_hosts + ssh ${{ secrets.SSH_USER }}@${{ secrets.SERVER_IP }} "cd /var/www/ & rm -rf venith & git clone https://github.com/VenithNET/VENITH.NET/ & mv VENITH.NET venith" + echo "Successfully pulled repo."