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