diff --git a/.github/workflows/vps-deploy.yml b/.github/workflows/vps-deploy.yml new file mode 100644 index 0000000..462989a --- /dev/null +++ b/.github/workflows/vps-deploy.yml @@ -0,0 +1,23 @@ +name: Build & Deploy to VPS + +on: + push: + branches: + - main + +env: + PROJECT_NAME: generator-td2 + +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: Send new files + 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