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."