diff --git a/.github/workflows/deploy-vps.yml b/.github/workflows/deploy-vps.yml new file mode 100644 index 0000000..a16d675 --- /dev/null +++ b/.github/workflows/deploy-vps.yml @@ -0,0 +1,36 @@ +name: Deploy to VPS (eclipse-forge.ru) + +on: + push: + branches: [main, master] + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: deploy-vps + cancel-in-progress: true + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 20 + cache: npm + - name: Install dependencies + run: | + if [ -f package-lock.json ]; then npm ci; else npm install; fi + - name: Build + run: npm run build + - name: Setup SSH + run: | + mkdir -p ~/.ssh + printf '%s\n' "${{ secrets.VPS_SSH_KEY }}" > ~/.ssh/id_deploy + chmod 600 ~/.ssh/id_deploy + - name: Deploy dist via rsync + run: | + rsync -avz --delete -e "ssh -i ~/.ssh/id_deploy -o StrictHostKeyChecking=no" dist/ "${{ secrets.VPS_USER }}@${{ secrets.VPS_HOST }}:${{ secrets.VPS_PATH }}/" \ No newline at end of file