chore(workflows): changed sending files method to VPS

This commit is contained in:
2025-12-15 13:30:45 +01:00
parent c98458b75e
commit 8698a53caf
+12 -11
View File
@@ -1,22 +1,23 @@
name: Build & Deploy to VPS name: Build & Deploy to VPS
'on':
on:
push: push:
branches: branches:
- master - main
env:
PROJECT_NAME: pojazdownik-td2
jobs: jobs:
build_and_deploy: build_and_deploy:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Build the app - name: Build the app
run: yarn && yarn build run: yarn && yarn build
- name: Setup SSH key for connection with the server - name: Setup SSH key for connection with the server
run: | run: |
mkdir -p ~/.ssh mkdir -p ~/.ssh
echo "${{ secrets.VPS_SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa && chmod 600 ~/.ssh/id_rsa echo "${{ secrets.VPS_SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa && chmod 600 ~/.ssh/id_rsa
- name: Remove old assets - name: Send new files
run: | run: rsync -avP -e "ssh -o StrictHostKeyChecking=no -i ~/.ssh/id_rsa -p 2022" ./dist/ ${{ secrets.VPS_USER }}@${{ secrets.VPS_HOST }}:/var/www/$PROJECT_NAME --delete
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