diff --git a/.github/workflows/deploy-relay.yml b/.github/workflows/deploy-relay.yml index 8086fac1c53c..b93874010801 100644 --- a/.github/workflows/deploy-relay.yml +++ b/.github/workflows/deploy-relay.yml @@ -36,7 +36,21 @@ jobs: APNS_BUNDLE_ID: ${{ vars.APNS_BUNDLE_ID }} ALCHEMY_TELEMETRY_DISABLED: "1" steps: + - name: Check for production relay credentials + id: creds + shell: bash + env: + CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} + run: | + if [[ -n "$CLOUDFLARE_ACCOUNT_ID" && -n "$CLOUDFLARE_API_TOKEN" ]]; then + echo "configured=true" >> "$GITHUB_OUTPUT" + else + echo "configured=false" >> "$GITHUB_OUTPUT" + echo "::notice::The production environment carries no relay credentials, so there is nothing to deploy to." + fi + - name: Checkout + if: steps.creds.outputs.configured == 'true' uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 with: sparse-checkout: | @@ -45,6 +59,7 @@ jobs: sparse-checkout-cone-mode: false - name: Setup Vite+ + if: steps.creds.outputs.configured == 'true' uses: voidzero-dev/setup-vp@250f29ce396baf5e8f24498e17c0dfdebabc26eb # v1.15.0 with: node-version-file: package.json @@ -54,6 +69,7 @@ jobs: - --filter=t3code-relay... - name: Deploy production relay stage + if: steps.creds.outputs.configured == 'true' id: deploy run: vp run --filter t3code-relay deploy --stage prod --yes --github-output env: @@ -65,6 +81,7 @@ jobs: APNS_PRIVATE_KEY: ${{ secrets.APNS_PRIVATE_KEY }} - name: Publish relay deploy commit status + if: steps.creds.outputs.configured == 'true' uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 with: script: | diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b8e0a2161fbb..7b5497579571 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -237,7 +237,19 @@ jobs: CLERK_JWT_TEMPLATE: ${{ vars.CLERK_JWT_TEMPLATE }} CLERK_CLI_OAUTH_CLIENT_ID: ${{ vars.CLERK_CLI_OAUTH_CLIENT_ID }} steps: + - name: Check for production relay credentials + id: creds + shell: bash + run: | + if [[ -n "$CLOUDFLARE_ACCOUNT_ID" && -n "$CLOUDFLARE_API_TOKEN" ]]; then + echo "configured=true" >> "$GITHUB_OUTPUT" + else + echo "configured=false" >> "$GITHUB_OUTPUT" + echo "::notice::The production environment carries no relay credentials, so there is no relay to resolve a public config from." + fi + - name: Checkout + if: steps.creds.outputs.configured == 'true' uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 with: ref: ${{ github.sha }} @@ -247,6 +259,7 @@ jobs: sparse-checkout-cone-mode: false - name: Setup Vite+ + if: steps.creds.outputs.configured == 'true' uses: voidzero-dev/setup-vp@250f29ce396baf5e8f24498e17c0dfdebabc26eb # v1.15.0 with: node-version-file: package.json @@ -256,6 +269,7 @@ jobs: - --filter=t3code-relay... - id: relay_state + if: steps.creds.outputs.configured == 'true' name: Read production relay tracing config shell: bash run: | @@ -266,6 +280,7 @@ jobs: --github-env-file "$RUNNER_TEMP/relay-client-tracing.env" - name: Upload relay client tracing config + if: steps.creds.outputs.configured == 'true' uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: name: relay-client-tracing-config @@ -274,6 +289,7 @@ jobs: retention-days: 1 - id: public_config + if: steps.creds.outputs.configured == 'true' name: Resolve production relay public config shell: bash run: | @@ -371,7 +387,7 @@ jobs: # build_wsl_node_pty failed; the Windows-only download step below then fails # that single platform if the prebuild is missing. needs: [preflight, relay_public_config, build_wsl_node_pty] - if: ${{ !cancelled() && needs.preflight.result == 'success' && needs.relay_public_config.result == 'success' }} + if: ${{ !cancelled() && needs.preflight.result == 'success' && needs.relay_public_config.outputs.relay_url != '' }} runs-on: ${{ matrix.runner }} timeout-minutes: 30 env: @@ -731,7 +747,7 @@ jobs: publish_cli: name: Publish CLI to npm needs: [preflight, relay_public_config, quality, build] - if: ${{ !failure() && !cancelled() && needs.preflight.result == 'success' && needs.relay_public_config.result == 'success' && needs.quality.result == 'success' && needs.build.result == 'success' }} + if: ${{ !failure() && !cancelled() && needs.preflight.result == 'success' && needs.relay_public_config.outputs.relay_url != '' && needs.quality.result == 'success' && needs.build.result == 'success' }} runs-on: ubuntu-24.04 # blacksmith-8vcpu-ubuntu-2404 timeout-minutes: 10 permissions: @@ -934,7 +950,7 @@ jobs: deploy_web: name: Deploy hosted web app needs: [preflight, relay_public_config, release] - if: ${{ !failure() && !cancelled() && needs.preflight.result == 'success' && needs.relay_public_config.result == 'success' && needs.release.result == 'success' }} + if: ${{ !failure() && !cancelled() && needs.preflight.result == 'success' && needs.relay_public_config.outputs.relay_url != '' && needs.release.result == 'success' }} runs-on: ubuntu-24.04 # blacksmith-8vcpu-ubuntu-2404 timeout-minutes: 10 env: @@ -1134,7 +1150,7 @@ jobs: if: | always() && !cancelled() && needs.preflight.result == 'success' && - needs.relay_public_config.result == 'success' && + needs.relay_public_config.outputs.relay_url != '' && needs.release.result == 'success' && needs.deploy_web.result == 'success' && (needs.finalize.result == 'success' || needs.finalize.result == 'skipped')