Merge pull request #78 from Ridealist/codex/add-l5-t3-task-card #23
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 Production | |
| on: | |
| push: | |
| branches: [main] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: production | |
| cancel-in-progress: false | |
| jobs: | |
| client: | |
| name: Production / Client | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 25 | |
| env: | |
| NEXT_TELEMETRY_DISABLED: "1" | |
| defaults: | |
| run: | |
| working-directory: client | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: pnpm/action-setup@v4 | |
| with: | |
| version: 9.15.9 | |
| - name: Use Node.js 22 | |
| uses: actions/setup-node@v5 | |
| with: | |
| node-version: 22 | |
| cache: pnpm | |
| cache-dependency-path: client/pnpm-lock.yaml | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Test | |
| run: pnpm test | |
| - name: ESLint | |
| run: pnpm lint | |
| - name: Prettier | |
| run: pnpm format:check | |
| - name: Build | |
| run: pnpm build | |
| agent: | |
| name: Production / Agent | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| defaults: | |
| run: | |
| working-directory: agent | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| with: | |
| enable-cache: true | |
| cache-dependency-glob: agent/uv.lock | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: "3.12" | |
| - name: Install dependencies | |
| run: uv sync --dev --frozen | |
| - name: Run tests | |
| run: uv run pytest -v | |
| - name: Prune uv cache | |
| if: always() | |
| run: uv cache prune --ci | |
| deploy: | |
| name: Production / Deploy | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| needs: [client, agent] | |
| environment: production | |
| env: | |
| PROD_SSH_HOST: ${{ secrets.PROD_SSH_HOST }} | |
| PROD_SSH_USER: ${{ secrets.PROD_SSH_USER }} | |
| PROD_SSH_KEY: ${{ secrets.PROD_SSH_KEY }} | |
| PROD_SSH_PORT: ${{ secrets.PROD_SSH_PORT || '22' }} | |
| APP_DIR: ${{ vars.PROD_APP_DIR || '/opt/cscl-tblt' }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Check deployment settings | |
| run: | | |
| test -n "$PROD_SSH_HOST" | |
| test -n "$PROD_SSH_USER" | |
| test -n "$PROD_SSH_KEY" | |
| test -n "$PROD_SSH_PORT" | |
| test -n "$APP_DIR" | |
| - name: Configure SSH | |
| run: | | |
| install -m 700 -d ~/.ssh | |
| printf '%s\n' "$PROD_SSH_KEY" > ~/.ssh/production_key | |
| chmod 600 ~/.ssh/production_key | |
| ssh-keyscan -p "$PROD_SSH_PORT" "$PROD_SSH_HOST" >> ~/.ssh/known_hosts | |
| - name: Deploy to production | |
| run: | | |
| ssh -i ~/.ssh/production_key -p "$PROD_SSH_PORT" "$PROD_SSH_USER@$PROD_SSH_HOST" \ | |
| "APP_DIR='$APP_DIR' DEPLOY_REF='$GITHUB_SHA' bash -s" \ | |
| < scripts/deploy-production.sh |