chore(relay): deploy with the Alchemy CLI and publish client config through an Action (#12401)
Co-authored-by: Claude Fable 5 <[email protected]>
This commit is contained in:
1 parent
e3c85ead63
commit
7479625686
10 files changed
+369
-755
No files matched your search
@@ -54,9 +54,11 @@ jobs:
|
||||
- --filter=t3code-relay...
|
||||
|
||||
- name: Deploy production relay stage
|
||||
id: deploy
|
||||
run: vp run --filter t3code-relay deploy --stage prod --yes --github-output
|
||||
run: vp run --filter t3code-relay deploy --stage prod --yes --no-input
|
||||
env:
|
||||
# The PublishClientConfig action writes the client env here instead
|
||||
# of the repo-root .env; nothing on the runner reads it.
|
||||
T3CODE_RELAY_CLIENT_CONFIG_ENV: ${{ runner.temp }}/relay-client-config.env
|
||||
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
||||
PLANETSCALE_API_TOKEN_ID: ${{ secrets.PLANETSCALE_API_TOKEN_ID }}
|
||||
PLANETSCALE_API_TOKEN: ${{ secrets.PLANETSCALE_API_TOKEN }}
|
||||
@@ -69,20 +71,12 @@ jobs:
|
||||
uses: actions/github-script@v8
|
||||
with:
|
||||
script: |
|
||||
const result = "${{ steps.deploy.outputs.result }}";
|
||||
const changed = "${{ steps.deploy.outputs.changed }}" === "true";
|
||||
const description = changed
|
||||
? "Relay production deploy applied infrastructure changes."
|
||||
: result === "noop"
|
||||
? "Relay production deploy was a no-op."
|
||||
: `Relay production deploy completed with result: ${result}.`;
|
||||
|
||||
await github.rest.repos.createCommitStatus({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
sha: context.sha,
|
||||
state: "success",
|
||||
context: "Relay deploy / production",
|
||||
description,
|
||||
description: "Relay production deploy completed.",
|
||||
target_url: `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`,
|
||||
});
|
||||
@@ -311,15 +311,28 @@ jobs:
|
||||
args:
|
||||
- --filter=t3code-relay...
|
||||
|
||||
- id: relay_state
|
||||
name: Read production relay tracing config
|
||||
# The deployed stack's outputs, read from Alchemy's state store without
|
||||
# planning or applying. Redacted values are persisted as
|
||||
# {"__redacted__": "<value>"}; the token is masked before it is written.
|
||||
- name: Read production relay tracing config
|
||||
shell: bash
|
||||
working-directory: infra/relay
|
||||
run: |
|
||||
vp run --filter t3code-relay deploy \
|
||||
--stage prod \
|
||||
--read-state \
|
||||
--github-output \
|
||||
--github-env-file "$RUNNER_TEMP/relay-client-tracing.env"
|
||||
set -euo pipefail
|
||||
output="$(npx alchemy state read T3CodeRelay/prod/output --no-input)"
|
||||
field() {
|
||||
jq -er --arg key "$1" '.[$key] | if type == "object" then .__redacted__ else . end | select(. != null and . != "")' <<<"$output" \
|
||||
|| { echo "Relay stack output is missing $1" >&2; exit 1; }
|
||||
}
|
||||
url="$(field clientTracingUrl)"
|
||||
dataset="$(field clientTracingDataset)"
|
||||
token="$(field clientTracingToken)"
|
||||
echo "::add-mask::$token"
|
||||
{
|
||||
echo "T3CODE_RELAY_CLIENT_OTLP_TRACES_URL=$url"
|
||||
echo "T3CODE_RELAY_CLIENT_OTLP_TRACES_DATASET=$dataset"
|
||||
echo "T3CODE_RELAY_CLIENT_OTLP_TRACES_TOKEN=$token"
|
||||
} > "$RUNNER_TEMP/relay-client-tracing.env"
|
||||
|
||||
- name: Upload relay client tracing config
|
||||
uses: actions/upload-artifact@v7
|
||||
|
||||
Reference in new issue
Block a user