Open History to see the last commit
1name: Deploy T3 Connect relay
2
3on:
4 push:
5 branches:
6 - main
7 # Alchemy does not redeploy the Worker when only a Config value read in its
8 # Init changes (alchemy-run/alchemy#1831), so a changed repository variable
9 # needs a forced deploy to reach production.
10 workflow_dispatch:
11 inputs:
12 force:
13 description: Redeploy every resource, including ones with no detected changes
14 type: boolean
15 default: true
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.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 CLERK_PUBLISHABLE_KEY: ${{ vars.CLERK_PUBLISHABLE_KEY }}
44 CLERK_JWT_AUDIENCE: ${{ vars.CLERK_JWT_AUDIENCE }}
45 APNS_ENVIRONMENT: ${{ vars.APNS_ENVIRONMENT }}
46 APNS_TEAM_ID: ${{ vars.APNS_TEAM_ID }}
47 APNS_KEY_ID: ${{ vars.APNS_KEY_ID }}
48 APNS_BUNDLE_ID: ${{ vars.APNS_BUNDLE_ID }}
49 ALCHEMY_TELEMETRY_DISABLED: "1"
50 steps:
51 - name: Checkout
52 uses: actions/checkout@v6
53 with:
54 sparse-checkout: |
55 /*
56 !/.repos/
57 sparse-checkout-cone-mode: false
58
59 - name: Setup Vite+
60 uses: voidzero-dev/setup-vp@v1
61 with:
62 node-version-file: package.json
63 cache: true
64 run-install: |
65 args:
66 - --filter=t3code-relay...
67
68 - name: Deploy production relay stage
69 run: vp run --filter t3code-relay deploy --stage prod --yes --no-input ${{ inputs.force && '--force' || '' }}
70 env:
71 # The PublishClientConfig action writes the client env here instead
72 # of the repo-root .env; nothing on the runner reads it.
73 T3CODE_RELAY_CLIENT_CONFIG_ENV: ${{ runner.temp }}/relay-client-config.env
74 CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
75 PLANETSCALE_API_TOKEN_ID: ${{ secrets.PLANETSCALE_API_TOKEN_ID }}
76 PLANETSCALE_API_TOKEN: ${{ secrets.PLANETSCALE_API_TOKEN }}
77 AXIOM_TOKEN: ${{ secrets.AXIOM_TOKEN }}
78 CLERK_SECRET_KEY: ${{ secrets.CLERK_SECRET_KEY }}
79 APNS_PRIVATE_KEY: ${{ secrets.APNS_PRIVATE_KEY }}
80 FCM_SERVICE_ACCOUNT: ${{ secrets.FCM_SERVICE_ACCOUNT }}
81
82 - name: Publish relay deploy commit status
83 uses: actions/github-script@v8
84 with:
85 script: |
86 await github.rest.repos.createCommitStatus({
87 owner: context.repo.owner,
88 repo: context.repo.repo,
89 sha: context.sha,
90 state: "success",
91 context: "Relay deploy / production",
92 description: "Relay production deploy completed.",
93 target_url: `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`,
94 });