fix(website): fix sha of deployed portal (#5782)

Needs a storage key, not an env var to read.
This commit is contained in:
Jamil
2024-07-06 17:25:00 -07:00
committed by GitHub
parent aa7977c9b5
commit 1b7338e5c3
4 changed files with 31 additions and 14 deletions

View File

@@ -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 }}" } ] }'

View File

@@ -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",

21
website/pnpm-lock.yaml generated
View File

@@ -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

View File

@@ -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 });
}