diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..3e7be1d --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,28 @@ +name: Deploy to VPS + +on: + push: + branches: ["main"] + workflow_dispatch: + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - name: Checkout (optional) + uses: actions/checkout@v4 + + - name: Deploy to VPS via SSH + uses: appleboy/ssh-action@v1.0.0 + with: + host: idc.upsense.co.id + username: root + port: 22 + key: ${{ secrets.SSH_KEY }} + script_stop: true + envs: PROJECT_DIR,REPO_SSH + script: | + PROJECT_DIR="/var/www/html/xpendify.upsense.co.id" + REPO_SSH="git@github.com:upsense-id/TIA-Xpendify.git" + mkdir -p "$PROJECT_DIR" + /root/deploy.sh "$PROJECT_DIR" "$REPO_SSH"