Open History to see the last commit
1name: Deploy T3 Connect relay
2
3on:
4 push:
5 branches:
6 - main
7 # Redeploys main after a variable or secret change. Alchemy redeploys the
8 # Worker when a value it reads changes, so force is rarely needed.
9 workflow_dispatch:
10 inputs:
11 force:
12 description: Redeploy every resource, including ones with no detected changes.
13 type: boolean
14 default: false
15
16permissions:
17 contents: read
18 id-token: none
19
20concurrency:
21 group: relay-production
22 cancel-in-progress: false
23
24jobs:
25 deploy_relay:
26 name: Deploy production relay
27 # A manual run from another branch would deploy that branch to production.
28 if: github.repository == 'pingdotgg/t3code' && github.ref == 'refs/heads/main'
29 runs-on: blacksmith-8vcpu-ubuntu-2404
30 timeout-minutes: 15
31 permissions:
32 contents: read
33 statuses: write
34 environment:
35 name: production
36 env:
37 CLOUDFLARE_ACCOUNT_ID: ${{ vars.CLOUDFLARE_ACCOUNT_ID }}
38 PLANETSCALE_ORGANIZATION: ${{ vars.PLANETSCALE_ORGANIZATION }}
39 AXIOM_ORG_ID: ${{ vars.AXIOM_ORG_ID }}
40 RELAY_DOMAIN: ${{ vars.RELAY_DOMAIN }}
41 RELAY_API_ZONE_NAME: ${{ vars.RELAY_API_ZONE_NAME }}
42 RELAY_TUNNEL_ZONE_NAME: ${{ vars.RELAY_TUNNEL_ZONE_NAME }}
43 RELAY_TUNNEL_CLEANUP_MODE: ${{ vars.RELAY_TUNNEL_CLEANUP_MODE }}
44 RELAY_LEGACY_TUNNEL_CLEANUP_MODE: ${{ vars.RELAY_LEGACY_TUNNEL_CLEANUP_MODE }}
45 RELAY_ALERT_NOTIFIER_ID: ${{ vars.RELAY_ALERT_NOTIFIER_ID }}
46 RELAY_WARNING_NOTIFIER_ID: ${{ vars.RELAY_WARNING_NOTIFIER_ID }}
47 CLERK_PUBLISHABLE_KEY: ${{ vars.CLERK_PUBLISHABLE_KEY }}
48 CLERK_JWT_AUDIENCE: ${{ vars.CLERK_JWT_AUDIENCE }}
49 APNS_ENVIRONMENT: ${{ vars.APNS_ENVIRONMENT }}
50 APNS_TEAM_ID: ${{ vars.APNS_TEAM_ID }}
51 APNS_KEY_ID: ${{ vars.APNS_KEY_ID }}
52 APNS_BUNDLE_ID: ${{ vars.APNS_BUNDLE_ID }}
53 ALCHEMY_TELEMETRY_DISABLED: "1"
54 steps:
55 - name: Checkout
56 uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
57 with:
58 sparse-checkout: |
59 /*
60 !/.repos/
61 sparse-checkout-cone-mode: false
62
63 - name: Setup Vite+
64 uses: voidzero-dev/setup-vp@250f29ce396baf5e8f24498e17c0dfdebabc26eb # v1.15.0
65 with:
66 node-version-file: package.json
67 cache: true
68 run-install: |
69 args:
70 - --filter=t3code-relay...
71
72 - name: Deploy production relay stage
73 run: vp run --filter t3code-relay deploy --stage prod --yes --no-input ${{ inputs.force && '--force' || '' }}
74 env:
75 # The PublishClientConfig action writes the client env here instead
76 # of the repo-root .env; nothing on the runner reads it.
77 T3CODE_RELAY_CLIENT_CONFIG_ENV: ${{ runner.temp }}/relay-client-config.env
78 CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
79 PLANETSCALE_API_TOKEN_ID: ${{ secrets.PLANETSCALE_API_TOKEN_ID }}
80 PLANETSCALE_API_TOKEN: ${{ secrets.PLANETSCALE_API_TOKEN }}
81 AXIOM_TOKEN: ${{ secrets.AXIOM_TOKEN }}
82 CLERK_SECRET_KEY: ${{ secrets.CLERK_SECRET_KEY }}
83 # Unset leaves the Clerk account-deletion webhook route off.
84 CLERK_WEBHOOK_SIGNING_SECRET: ${{ secrets.CLERK_WEBHOOK_SIGNING_SECRET }}
85 APNS_PRIVATE_KEY: ${{ secrets.APNS_PRIVATE_KEY }}
86 FCM_SERVICE_ACCOUNT: ${{ secrets.FCM_SERVICE_ACCOUNT }}
87 T3CHAT_LINK_SECRET: ${{ secrets.T3CHAT_LINK_SECRET }}
88
89 - name: Publish relay deploy commit status
90 uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
91 with:
92 script: |
93 await github.rest.repos.createCommitStatus({
94 owner: context.repo.owner,
95 repo: context.repo.repo,
96 sha: context.sha,
97 state: "success",
98 context: "Relay deploy / production",
99 description: "Relay production deploy completed.",
100 target_url: `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`,
101 });