@@ -16,6 +16,7 @@ concurrency:
1616
1717jobs :
1818 validate :
19+ if : github.event_name == 'pull_request' || github.ref != 'refs/heads/main'
1920 runs-on : blacksmith-2vcpu-ubuntu-2404
2021 timeout-minutes : 30
2122 env :
5051 with :
5152 path : node_modules/.vite/task-cache
5253 key : ${{ steps.vite-task-cache.outputs.cache-primary-key }}
54+
55+ deploy-production :
56+ if : github.ref == 'refs/heads/main' && github.event_name != 'pull_request'
57+ runs-on : blacksmith-2vcpu-ubuntu-2404
58+ timeout-minutes : 45
59+ environment :
60+ name : production
61+ url : https://thinkex.app
62+ concurrency :
63+ group : deploy-production
64+ cancel-in-progress : true
65+
66+ env :
67+ # Runtime and deploy secrets are synced into GitHub Actions secrets from Infisical.
68+ CLOUDFLARE_ACCOUNT_ID : ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
69+ CLOUDFLARE_API_TOKEN : ${{ secrets.CLOUDFLARE_API_TOKEN }}
70+ POSTHOG_API_KEY : ${{ secrets.POSTHOG_API_KEY }}
71+ POSTHOG_PROJECT_ID : ${{ secrets.POSTHOG_PROJECT_ID }}
72+ VITE_POSTHOG_FEEDBACK_SURVEY_ID : ${{ secrets.VITE_POSTHOG_FEEDBACK_SURVEY_ID }}
73+ VITE_POSTHOG_HOST : ${{ secrets.VITE_POSTHOG_HOST }}
74+ VITE_POSTHOG_PROJECT_TOKEN : ${{ secrets.VITE_POSTHOG_PROJECT_TOKEN }}
75+ CLOUDFLARE_VITE_FORCE_LOCAL : " true"
76+ DEPLOY_SHA : ${{ github.sha }}
77+ DEPLOY_REF : ${{ github.ref_name }}
78+ DEPLOY_ENVIRONMENT : production
79+ DEPLOY_URL : https://thinkex.app
80+ DEPLOY_WORKER : thinkex
81+
82+ steps :
83+ - uses : actions/checkout@v7
84+
85+ - uses : voidzero-dev/setup-vp@v1
86+ with :
87+ node-version-file : .node-version
88+ cache : true
89+
90+ - name : Install dependencies
91+ run : vp install --frozen-lockfile
92+
93+ - name : Verify branch quality gates
94+ run : vp run check && vp run test
95+
96+ - name : Build production bundle
97+ run : vp run build:production
98+
99+ - name : Apply production migrations
100+ run : vp run db:migrate
101+
102+ - name : Deploy production Worker
103+ run : vp run deploy:worker
104+
105+ - name : Write deployment summary
106+ run : |
107+ {
108+ echo "## Production deployment"
109+ echo
110+ echo "| Field | Value |"
111+ echo "| --- | --- |"
112+ echo "| Environment | ${DEPLOY_ENVIRONMENT} |"
113+ echo "| URL | [${DEPLOY_URL}](${DEPLOY_URL}) |"
114+ echo "| Cloudflare Worker | ${DEPLOY_WORKER} |"
115+ echo "| Ref | \`${DEPLOY_REF}\` |"
116+ echo "| Commit | \`${DEPLOY_SHA}\` |"
117+ echo "| Run | [${GITHUB_RUN_ID}](${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}) |"
118+ } >> "$GITHUB_STEP_SUMMARY"
0 commit comments