Deploy to Dev #727
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Deploy to Dev | |
| on: | |
| workflow_run: | |
| workflows: ["CI"] | |
| types: [completed] | |
| branches: [main] | |
| jobs: | |
| deploy: | |
| runs-on: self-hosted | |
| if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
| defaults: | |
| run: | |
| working-directory: /home/jin/dev/imajin-ai | |
| env: | |
| PATH: /home/jin/.nvm/versions/node/v22.22.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin | |
| steps: | |
| - name: Pull latest | |
| run: | | |
| git fetch origin main | |
| git reset --hard origin/main | |
| - name: Install dependencies | |
| run: pnpm install --no-frozen-lockfile | |
| - name: Build changed apps | |
| run: ./scripts/build-changed.sh | |
| - name: Run migrations | |
| run: node scripts/migrate.mjs | |
| - name: Restart dev services | |
| run: | | |
| DEV_PROCS=$(pm2 jlist | node -e "const procs = JSON.parse(require('fs').readFileSync(0)); console.log(procs.filter(p => p.name && p.name.startsWith('dev-')).map(p => p.name).join(' '));") | |
| if [ -z "$DEV_PROCS" ]; then | |
| echo "⚠️ No dev-* pm2 processes found to restart" | |
| exit 0 | |
| fi | |
| echo "Restarting: $DEV_PROCS" | |
| pm2 restart $DEV_PROCS | |
| echo "✅ Dev services restarted" |