From c98458b75e8cb48fdf4cf2f7dae26d52466f2713 Mon Sep 17 00:00:00 2001 From: Spythere Date: Thu, 4 Dec 2025 00:38:08 +0100 Subject: [PATCH] chore: added workflow for deploying to dedicated VPS --- .github/workflows/deploy.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 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..0b492f3 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,22 @@ +name: Build & Deploy to VPS +'on': + push: + branches: + - master +jobs: + build_and_deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Build the app + run: yarn && yarn build + - name: Setup SSH key for connection with the server + run: | + mkdir -p ~/.ssh + echo "${{ secrets.VPS_SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa && chmod 600 ~/.ssh/id_rsa + - name: Remove old assets + run: | + ssh -o StrictHostKeyChecking=no -i ~/.ssh/id_rsa ${{ secrets.VPS_USER }}@${{ secrets.VPS_HOST }} -p 2022 "rm -rf /var/www/pojazdownik/assets" + - name: Send the build files to web server + run: | + scp -o StrictHostKeyChecking=no -i ~/.ssh/id_rsa -P 2022 -r ./dist/* ${{ secrets.VPS_USER }}@${{ secrets.VPS_HOST }}:/var/www/pojazdownik \ No newline at end of file