diff options
| author | Leander <80996591+schererleander@users.noreply.github.com> | 2025-05-30 01:22:40 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-05-30 01:22:40 +0200 |
| commit | 28ad8adb1a435103dba02cc61be3757d414ab632 (patch) | |
| tree | a94a3792d81c726e72d8e64e21fcb808544807d2 /.github/workflows/deploy.yml | |
| parent | 7a38aa816a68654b630226e238e79138b4f1ad5b (diff) | |
Create deploy.yml
Diffstat (limited to '.github/workflows/deploy.yml')
| -rw-r--r-- | .github/workflows/deploy.yml | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..88671f7 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,47 @@ +name: Deploy to VPS + +on: + push: + branches: + - main + +jobs: + build-and-deploy: + runs-on: ubuntu-latest + + steps: + # 1) Checkout your code + - uses: actions/checkout@v3 + + # 2) Set up Node.js + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: '18' + + # 3) Install dependencies & build + - name: Install & Build + run: | + npm ci + npm run build # Vite’s default output dir is `dist/` + + # 4) Copy build output to VPS via SCP + - name: Deploy build via SCP + uses: appleboy/scp-action@master + with: + host: ${{ secrets.VPS_HOST }} + username: ${{ secrets.VPS_USER }} + key: ${{ secrets.VPS_SSH_KEY }} + port: 22 + source: "dist/*" + target: ${{ secrets.VPS_DESTINATION }} + + # 5) Restart Nginx inside Docker on your VPS + - name: Restart Nginx (Docker) + uses: appleboy/ssh-action@master + with: + host: ${{ secrets.VPS_HOST }} + username: ${{ secrets.VPS_USER }} + key: ${{ secrets.VPS_SSH_KEY }} + script: | + docker restart nginx |
