diff --git a/.github/workflows/_deploy_production.yml b/.github/workflows/_deploy_production.yml index 8c7cdcb49..bf44fab38 100644 --- a/.github/workflows/_deploy_production.yml +++ b/.github/workflows/_deploy_production.yml @@ -184,18 +184,12 @@ jobs: needs: deploy-production runs-on: ubuntu-22.04 env: - VERCEL_PROJECT: firezone - VERCEL_SLUG: firezone - # Fetched from Vercel's API. Not a secret. - VERCEL_ENV_VAR_ID: Ph436pR2So7nwrSI + VERCEL_TEAM_ID: firezone + VERCEL_EDGE_CONFIG_ID: ecfg_hmorgeez26rwyncgsuj1yaibfx4p steps: - name: Update FIREZONE_DEPLOYED_SHA run: | - curl --fail -X PATCH "https://api.vercel.com/v9/projects/${VERCEL_PROJECT}/env/${VERCEL_ENV_VAR_ID}?slug=${VERCEL_SLUG}" \ - -H "Authorization: Bearer ${{ secrets.VERCEL_TOKEN }}" -H "Content-Type: application/json" \ - -d '{ - "comment": "latest deployed SHA for control plane", - "key": "FIREZONE_DEPLOYED_SHA", - "type": "plain", - "value": "${{ inputs.tag }}" - }' + curl --fail -X PATCH "https://api.vercel.com/v1/edge-config/${VERCEL_EDGE_CONFIG_ID}/items?teamId=${VERCEL_TEAM_ID}" \ + -H "Authorization: Bearer ${{ secrets.VERCEL_TOKEN }}" \ + -H "Content-Type: application/json" \ + -d '{ "items": [ { "operation": "upsert", "key": "deployed_sha", "value": "${{ inputs.tag }}" } ] }' diff --git a/website/package.json b/website/package.json index d63986bdc..0afa277ab 100644 --- a/website/package.json +++ b/website/package.json @@ -22,6 +22,7 @@ "@types/react": "18.3.3", "@types/react-dom": "18.3.0", "@types/react-syntax-highlighter": "^15.5.11", + "@vercel/edge-config": "^1.2.0", "asciinema-player": "^3.7.1", "autoprefixer": "10.4.19", "fast-xml-parser": "^4.3.5", diff --git a/website/pnpm-lock.yaml b/website/pnpm-lock.yaml index f77c21583..e298689c7 100644 --- a/website/pnpm-lock.yaml +++ b/website/pnpm-lock.yaml @@ -41,6 +41,9 @@ importers: '@types/react-syntax-highlighter': specifier: ^15.5.11 version: 15.5.13 + '@vercel/edge-config': + specifier: ^1.2.0 + version: 1.2.0 asciinema-player: specifier: ^3.7.1 version: 3.7.1 @@ -462,6 +465,18 @@ packages: '@ungap/structured-clone@1.2.0': resolution: {integrity: sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==} + '@vercel/edge-config-fs@0.1.0': + resolution: {integrity: sha512-NRIBwfcS0bUoUbRWlNGetqjvLSwgYH/BqKqDN7vK1g32p7dN96k0712COgaz6VFizAm9b0g6IG6hR6+hc0KCPg==} + + '@vercel/edge-config@1.2.0': + resolution: {integrity: sha512-ouX+hJK4KzXE31Wi2Xs7IEXb+6gImcOXgeOT9P48YKsZb7oNG2uyhvKDDkAyOJ739AnCJ5tKxavXjIoit6dWtw==} + engines: {node: '>=14.6'} + peerDependencies: + '@opentelemetry/api': ^1.7.0 + peerDependenciesMeta: + '@opentelemetry/api': + optional: true + '@webassemblyjs/ast@1.12.1': resolution: {integrity: sha512-EKfMUOPRRUTy5UII4qJDGPpqfwjOmZ5jeGFwid9mnoqIFK+e0vqoi1qH56JpmZSzEL53jKnNzScdmftJyG5xWg==} @@ -2235,6 +2250,12 @@ snapshots: '@ungap/structured-clone@1.2.0': {} + '@vercel/edge-config-fs@0.1.0': {} + + '@vercel/edge-config@1.2.0': + dependencies: + '@vercel/edge-config-fs': 0.1.0 + '@webassemblyjs/ast@1.12.1': dependencies: '@webassemblyjs/helper-numbers': 1.11.6 diff --git a/website/src/app/api/deployed-sha/route.ts b/website/src/app/api/deployed-sha/route.ts index 2d75bb673..e10fc087b 100644 --- a/website/src/app/api/deployed-sha/route.ts +++ b/website/src/app/api/deployed-sha/route.ts @@ -1,7 +1,8 @@ // app/api/deployed-sha/route.ts import { NextRequest, NextResponse } from "next/server"; +import { get } from "@vercel/edge-config"; -export async function GET(req: NextRequest) { - const sha = process.env.FIREZONE_DEPLOYED_SHA; +export async function GET(_req: NextRequest) { + const sha = await get("deployed_sha"); return NextResponse.json({ sha }); }