Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

deploy-relay.yml

88 lines3.0 KB

1name: Deploy T3 Connect relay
2​
3on:
4 push:
5 branches:
6 - main
7​
8permissions:
9 contents: read
10 id-token: none
11 statuses: write
12​
13concurrency:
14 group: relay-production
15 cancel-in-progress: false
16​
17jobs:
18 deploy_relay:
19 name: Deploy production relay
20 runs-on: blacksmith-8vcpu-ubuntu-2404
21 timeout-minutes: 15
22 environment:
23 name: production
24 env:
25 CLOUDFLARE_ACCOUNT_ID: ${{ vars.CLOUDFLARE_ACCOUNT_ID }}
26 PLANETSCALE_ORGANIZATION: ${{ vars.PLANETSCALE_ORGANIZATION }}
27 AXIOM_ORG_ID: ${{ vars.AXIOM_ORG_ID }}
28 RELAY_DOMAIN: ${{ vars.RELAY_DOMAIN }}
29 RELAY_API_ZONE_NAME: ${{ vars.RELAY_API_ZONE_NAME }}
30 RELAY_TUNNEL_ZONE_NAME: ${{ vars.RELAY_TUNNEL_ZONE_NAME }}
31 CLERK_PUBLISHABLE_KEY: ${{ vars.CLERK_PUBLISHABLE_KEY }}
32 CLERK_JWT_AUDIENCE: ${{ vars.CLERK_JWT_AUDIENCE }}
33 APNS_ENVIRONMENT: ${{ vars.APNS_ENVIRONMENT }}
34 APNS_TEAM_ID: ${{ vars.APNS_TEAM_ID }}
35 APNS_KEY_ID: ${{ vars.APNS_KEY_ID }}
36 APNS_BUNDLE_ID: ${{ vars.APNS_BUNDLE_ID }}
37 ALCHEMY_TELEMETRY_DISABLED: "1"
38 steps:
39 - name: Checkout
40 uses: actions/checkout@v6
41 with:
42 sparse-checkout: |
43 /*
44 !/.repos/
45 sparse-checkout-cone-mode: false
46​
47 - name: Setup Vite+
48 uses: voidzero-dev/setup-vp@v1
49 with:
50 node-version-file: package.json
51 cache: true
52 run-install: |
53 args:
54 - --filter=t3code-relay...
55​
56 - name: Deploy production relay stage
57 id: deploy
58 run: vp run --filter t3code-relay deploy --stage prod --yes --github-output
59 env:
60 CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
61 PLANETSCALE_API_TOKEN_ID: ${{ secrets.PLANETSCALE_API_TOKEN_ID }}
62 PLANETSCALE_API_TOKEN: ${{ secrets.PLANETSCALE_API_TOKEN }}
63 AXIOM_TOKEN: ${{ secrets.AXIOM_TOKEN }}
64 CLERK_SECRET_KEY: ${{ secrets.CLERK_SECRET_KEY }}
65 APNS_PRIVATE_KEY: ${{ secrets.APNS_PRIVATE_KEY }}
66 FCM_SERVICE_ACCOUNT: ${{ secrets.FCM_SERVICE_ACCOUNT }}
67​
68 - name: Publish relay deploy commit status
69 uses: actions/github-script@v8
70 with:
71 script: |
72 const result = "${{ steps.deploy.outputs.result }}";
73 const changed = "${{ steps.deploy.outputs.changed }}" === "true";
74 const description = changed
75 ? "Relay production deploy applied infrastructure changes."
76 : result === "noop"
77 ? "Relay production deploy was a no-op."
78 : `Relay production deploy completed with result: ${result}.`;
79​
80 await github.rest.repos.createCommitStatus({
81 owner: context.repo.owner,
82 repo: context.repo.repo,
83 sha: context.sha,
84 state: "success",
85 context: "Relay deploy / production",
86 description,
87 target_url: `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`,
88 });