Refactor workspace content architecture #279
Workflow file for this run
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: CI | |
| on: | |
| pull_request: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| validate: | |
| if: github.event_name == 'pull_request' || github.ref != 'refs/heads/main' | |
| runs-on: blacksmith-2vcpu-ubuntu-2404 | |
| timeout-minutes: 30 | |
| env: | |
| CLOUDFLARE_VITE_FORCE_LOCAL: "true" | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - uses: voidzero-dev/setup-vp@v1 | |
| with: | |
| node-version-file: .node-version | |
| cache: true | |
| - name: Install dependencies | |
| run: vp install --frozen-lockfile | |
| - name: Restore Vite Task cache | |
| id: vite-task-cache | |
| uses: actions/cache/restore@v6 | |
| with: | |
| path: node_modules/.vite/task-cache | |
| key: vite-task-${{ runner.os }}-${{ runner.arch }}-${{ github.run_id }}-${{ github.run_attempt }} | |
| restore-keys: | | |
| vite-task-${{ runner.os }}-${{ runner.arch }}- | |
| - name: Verify | |
| run: vp run verify | |
| - name: Save Vite Task cache | |
| if: success() | |
| uses: actions/cache/save@v6 | |
| with: | |
| path: node_modules/.vite/task-cache | |
| key: ${{ steps.vite-task-cache.outputs.cache-primary-key }} | |
| deploy-production: | |
| if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request' | |
| runs-on: blacksmith-2vcpu-ubuntu-2404 | |
| timeout-minutes: 45 | |
| environment: | |
| name: production | |
| url: https://thinkex.app | |
| concurrency: | |
| group: deploy-production | |
| cancel-in-progress: true | |
| env: | |
| # Runtime and deploy secrets are synced into GitHub Actions secrets from Infisical. | |
| CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
| CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }} | |
| POSTHOG_PROJECT_ID: ${{ secrets.POSTHOG_PROJECT_ID }} | |
| VITE_POSTHOG_FEEDBACK_SURVEY_ID: ${{ secrets.VITE_POSTHOG_FEEDBACK_SURVEY_ID }} | |
| VITE_POSTHOG_HOST: ${{ secrets.VITE_POSTHOG_HOST }} | |
| VITE_POSTHOG_PROJECT_TOKEN: ${{ secrets.VITE_POSTHOG_PROJECT_TOKEN }} | |
| CLOUDFLARE_VITE_FORCE_LOCAL: "true" | |
| DEPLOY_SHA: ${{ github.sha }} | |
| DEPLOY_REF: ${{ github.ref_name }} | |
| DEPLOY_ENVIRONMENT: production | |
| DEPLOY_URL: https://thinkex.app | |
| DEPLOY_WORKER: thinkex | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - uses: voidzero-dev/setup-vp@v1 | |
| with: | |
| node-version-file: .node-version | |
| cache: true | |
| - name: Install dependencies | |
| run: vp install --frozen-lockfile | |
| - name: Verify branch quality gates | |
| run: vp run check && vp run test | |
| - name: Build production bundle | |
| run: vp run build:production | |
| - name: Apply production migrations | |
| run: vp run db:migrate | |
| - name: Deploy production Worker | |
| run: vp run deploy:worker | |
| - name: Write deployment summary | |
| run: | | |
| { | |
| echo "## Production deployment" | |
| echo | |
| echo "| Field | Value |" | |
| echo "| --- | --- |" | |
| echo "| Environment | ${DEPLOY_ENVIRONMENT} |" | |
| echo "| URL | [${DEPLOY_URL}](${DEPLOY_URL}) |" | |
| echo "| Cloudflare Worker | ${DEPLOY_WORKER} |" | |
| echo "| Ref | \`${DEPLOY_REF}\` |" | |
| echo "| Commit | \`${DEPLOY_SHA}\` |" | |
| echo "| Run | [${GITHUB_RUN_ID}](${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}) |" | |
| } >> "$GITHUB_STEP_SUMMARY" |