Skip to content

Commit e966b47

Browse files
committed
fix: fixed license verification broken
1 parent f865cf9 commit e966b47

2 files changed

Lines changed: 17 additions & 4 deletions

File tree

.github/workflows/release.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,12 @@ jobs:
8888
# PANO_LICENSE_PUBLIC_KEY secret). main branch → prod, anything else → dev.
8989
env:
9090
PANO_LICENSE_SERVER: ${{ steps.extract_branch.outputs.branch == 'main' && 'prod' || 'dev' }}
91+
# Embeds semantic-release's next-tag into license-constants.generated.js
92+
# so the theme runtime's expected `ver` matches the `ver` claim panomc.com
93+
# signs into the JWT. Without this the constant defaults to package.json
94+
# version (e.g. "1.0.0") while the backend has registered "1.0.0-dev.44",
95+
# and the theme refuses to serve with a version-mismatch error.
96+
PANO_THEME_VERSION_OVERRIDE: ${{ needs.get-next-version.outputs.new_tag_version }}
9197
run: bun run build
9298

9399
- name: Update manifest.json version

scripts/license/generate-license-constants.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -233,10 +233,17 @@ async function main() {
233233
const manifest = readJson(MANIFEST_FILE);
234234
const pkg = readJson(PACKAGE_FILE);
235235

236-
// Manifest's "v{version}" placeholder is replaced at release time. For local builds we
237-
// resolve to the package.json version so the embedded constant matches what the host
238-
// sees after install. Strip a leading "v" so the constant matches the JWT `ver` claim.
239-
const versionRaw = String(manifest.version || "").replace("{version}", pkg.version);
236+
// Version resolution priority (the embedded constant MUST match the `ver` claim in the
237+
// JWT panomc.com mints for this build — otherwise the theme runtime refuses to serve):
238+
// 1. PANO_THEME_VERSION_OVERRIDE — release workflow passes semantic-release's
239+
// next-tag here (e.g. "1.0.0-dev.44"). Wins over everything because the manifest
240+
// source still has the "v{version}" placeholder at this point in the pipeline.
241+
// 2. manifest.version with "{version}" substituted from package.json (local dev).
242+
// The leading "v" is always stripped so the constant matches ResourceVersion.tag on
243+
// the backend, which is stored without it.
244+
const overrideVersion = (process.env.PANO_THEME_VERSION_OVERRIDE || "").trim();
245+
const versionRaw = overrideVersion ||
246+
String(manifest.version || "").replace("{version}", pkg.version);
240247
const themeVersion = versionRaw.startsWith("v") ? versionRaw.slice(1) : versionRaw;
241248

242249
const themeId = manifest.id;

0 commit comments

Comments
 (0)