name: CI on: push: branches: [main] pull_request: branches: [main] env: DEPLOY_HOST: "10.10.1.82" DEPLOY_PORT: "3010" jobs: build: runs-on: ubuntu-latest container: image: oven/bun:1 steps: - name: Checkout uses: actions/checkout@v4 - name: Install dependencies run: bun install --frozen-lockfile # Type check disabled until bits-ui/shadcn component types are fixed (run locally: bun run check) # - name: Type check # run: bun run check - name: Build run: bun run build env: PORT: ${{ env.DEPLOY_PORT }} VITE_POCKETBASE_URL: ${{ vars.VITE_POCKETBASE_URL || 'https://pocketbase.ccllc.pro' }} - name: Upload build artifact uses: actions/upload-artifact@v3 with: name: app path: | build package.json bun.lockb deploy: needs: build if: github.ref == 'refs/heads/main' && github.event_name == 'push' runs-on: ubuntu-latest steps: - name: Download build artifact uses: actions/download-artifact@v3 with: name: app - name: Install sshpass run: sudo apt-get update -qq && sudo apt-get install -y sshpass - name: Deploy to server env: DEPLOY_HOST: ${{ env.DEPLOY_HOST }} DEPLOY_PORT: ${{ env.DEPLOY_PORT }} DEPLOY_USER: ${{ secrets.DEPLOY_USER }} DEPLOY_PASSWORD: ${{ secrets.DEPLOY_PASSWORD }} run: | set -e ssh-keyscan -H $DEPLOY_HOST >> ~/.ssh/known_hosts 2>/dev/null || true sshpass -p "$DEPLOY_PASSWORD" ssh -o StrictHostKeyChecking=accept-new $DEPLOY_USER@$DEPLOY_HOST "mkdir -p /var/www/hrm" sshpass -p "$DEPLOY_PASSWORD" scp -o StrictHostKeyChecking=accept-new -r build package.json bun.lockb $DEPLOY_USER@$DEPLOY_HOST:/var/www/hrm/ sshpass -p "$DEPLOY_PASSWORD" ssh -o StrictHostKeyChecking=accept-new $DEPLOY_USER@$DEPLOY_HOST "cd /var/www/hrm && bun install --frozen-lockfile && pkill -f 'node build' || true; PORT=$DEPLOY_PORT nohup node build > /var/log/hrm.log 2>&1 &"