Skip to content

Commit 38502d8

Browse files
Kevin Arthurclaude
andcommitted
build(release): derive product and repo names instead of hardcoding them
A product rename (Strata -> Varve) is in progress in parallel. The release tooling had "Strata" and "K-Arthur/Strata" baked into artifact filenames, SBOM names, install hints and release URLs — none of which would have errored after the rename. They would simply have kept producing `Strata-0.1.0-…` artifacts and URLs built from the old slug: a wrong release that looks like a working one. scripts/release/product.mjs derives all three from configuration the rename has to touch anyway: - productSlug() tauri.conf.json productName, minus a trailing " Desktop" - repoSlug() GITHUB_REPOSITORY, else the git remote — which GitHub updates automatically if the repository is renamed - documentExtension() bundle.fileAssociations, so release notes describe the format the build actually registers Verified by flipping productName to "Varve Desktop" and re-running collection: artifacts became Varve-0.1.0-linux-x86_64.{AppImage,deb,rpm} with no script change. Restored afterwards. This keeps the two workstreams out of each other's way: the rename agent edits product configuration, and the release pipeline follows without either of us touching the other's files. Also adds `just release-*` recipes. `just` always runs from the justfile's directory, so these work from anywhere in the tree — running `node scripts/release/publish-model-assets.mjs` from apps/desktop/ fails with MODULE_NOT_FOUND, which is a sharp edge worth removing rather than documenting. just release-check bundled assets, catalog agreement, checksums just release-version [TAG] assert every manifest agrees, optionally with a tag just release-publish-models upload the on-demand AI models just release-collect / -verify / -sbom / -website Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1 parent 18ceabf commit 38502d8

6 files changed

Lines changed: 158 additions & 30 deletions

File tree

‎justfile‎

Lines changed: 53 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,33 +28,33 @@ build-js:
2828
# --- WASM build (web engine backend) ---
2929
wasm-build:
3030
rustup target add wasm32-unknown-unknown
31-
cd crates/strata-wasm && wasm-pack build --target web --out-dir ../../apps/desktop/public/wasm --out-name strata_wasm
32-
which wasm-opt 2>/dev/null && wasm-opt -O3 -o apps/desktop/public/wasm/strata_wasm_bg.wasm apps/desktop/public/wasm/strata_wasm_bg.wasm || echo "wasm-opt not on PATH — skipping manual optimization"
31+
cd crates/varve-wasm && wasm-pack build --target web --out-dir ../../apps/desktop/public/wasm --out-name varve_wasm
32+
which wasm-opt 2>/dev/null && wasm-opt -O3 -o apps/desktop/public/wasm/varve_wasm_bg.wasm apps/desktop/public/wasm/varve_wasm_bg.wasm || echo "wasm-opt not on PATH — skipping manual optimization"
3333

3434
wasm-build-simd:
3535
rustup target add wasm32-unknown-unknown
36-
cd crates/strata-wasm && RUSTFLAGS="-C target-feature=+simd128" \
37-
wasm-pack build --target web --out-dir ../../apps/desktop/public/wasm --out-name strata_wasm_simd
38-
which wasm-opt 2>/dev/null && wasm-opt -O3 -o apps/desktop/public/wasm/strata_wasm_simd_bg.wasm apps/desktop/public/wasm/strata_wasm_simd_bg.wasm || echo "wasm-opt not on PATH — skipping SIMD optimization"
36+
cd crates/varve-wasm && RUSTFLAGS="-C target-feature=+simd128" \
37+
wasm-pack build --target web --out-dir ../../apps/desktop/public/wasm --out-name varve_wasm_simd
38+
which wasm-opt 2>/dev/null && wasm-opt -O3 -o apps/desktop/public/wasm/varve_wasm_simd_bg.wasm apps/desktop/public/wasm/varve_wasm_simd_bg.wasm || echo "wasm-opt not on PATH — skipping SIMD optimization"
3939

4040
wasm-check:
4141
rustup target add wasm32-unknown-unknown
42-
cargo check --target wasm32-unknown-unknown -p strata-wasm
42+
cargo check --target wasm32-unknown-unknown -p varve-wasm
4343

4444
# --- WASM build (colour engine, for browser print pipeline) ---
4545
wasm-build-colour:
4646
rustup target add wasm32-unknown-unknown
47-
cd crates/strata-colour && wasm-pack build --target web --out-dir ../../apps/desktop/public/wasm --out-name strata_colour -- --features wasm
48-
which wasm-opt 2>/dev/null && wasm-opt -O3 -o apps/desktop/public/wasm/strata_colour_bg.wasm apps/desktop/public/wasm/strata_colour_bg.wasm || echo "wasm-opt not on PATH — skipping manual optimization"
47+
cd crates/varve-colour && wasm-pack build --target web --out-dir ../../apps/desktop/public/wasm --out-name varve_colour -- --features wasm
48+
which wasm-opt 2>/dev/null && wasm-opt -O3 -o apps/desktop/public/wasm/varve_colour_bg.wasm apps/desktop/public/wasm/varve_colour_bg.wasm || echo "wasm-opt not on PATH — skipping manual optimization"
4949

5050
wasm-build-all: wasm-build wasm-build-simd wasm-build-colour
5151

5252
wasm-size:
53-
ls -lh apps/desktop/public/wasm/strata_wasm_bg.wasm apps/desktop/public/wasm/strata_wasm_simd_bg.wasm apps/desktop/public/wasm/strata_colour_bg.wasm 2>/dev/null
53+
ls -lh apps/desktop/public/wasm/varve_wasm_bg.wasm apps/desktop/public/wasm/varve_wasm_simd_bg.wasm apps/desktop/public/wasm/varve_colour_bg.wasm 2>/dev/null
5454

5555
wasm-check-colour:
5656
rustup target add wasm32-unknown-unknown
57-
cargo check --target wasm32-unknown-unknown -p strata-colour --features wasm
57+
cargo check --target wasm32-unknown-unknown -p varve-colour --features wasm
5858

5959
# --- Tests (TDD-first) ---
6060
test: test-rust test-js
@@ -92,7 +92,7 @@ typecheck-regression:
9292
node scripts/audit-typecheck-regression.mjs
9393

9494
# --- Icon generation ---
95-
# Canonical master: packages/ui/src/icons/strata-app-icon.svg
95+
# Canonical master: packages/ui/src/icons/varve-app-icon.svg
9696
# (via apps/desktop/build-icons.sh — do not regenerate launchers from mark-only SVGs)
9797
generate-icons:
9898
bash apps/desktop/build-icons.sh
@@ -204,14 +204,54 @@ package-dmg: prune-runtimes
204204
package-windows: prune-runtimes
205205
cd apps/desktop && pnpm tauri build --bundles msi,nsis --ci --features ai
206206

207+
# --- Release tooling ---
208+
#
209+
# `just` always runs from the justfile's directory, so these work from anywhere
210+
# in the tree. Invoking the scripts as `node scripts/release/...` only works
211+
# from the repository root, which is a sharp edge worth removing.
212+
213+
# Pre-flight: bundled assets, model catalog agreement, download checksums.
214+
release-check:
215+
node scripts/release/check-bundled-assets.mjs
216+
217+
# Show the version every manifest reports; pass a tag to assert they match it.
218+
release-version TAG="":
219+
node scripts/release/version.mjs verify {{TAG}}
220+
221+
# Set the release version across all manifests (then refresh the lockfiles).
222+
release-set-version VERSION:
223+
node scripts/release/version.mjs set {{VERSION}}
224+
@echo "Now run: cargo check --workspace && cargo check --manifest-path apps/desktop/src-tauri/Cargo.toml"
225+
226+
# Upload the large on-demand AI models to the models-v1 release.
227+
# Needs `git lfs pull --include="models-source/*.onnx"` first.
228+
release-publish-models *ARGS:
229+
node scripts/release/publish-model-assets.mjs {{ARGS}}
230+
231+
# Collect built bundles into dist/release with checksums and a manifest.
232+
release-collect *ARGS:
233+
node scripts/release/collect-artifacts.mjs {{ARGS}}
234+
235+
# Verify dist/release against its manifest and checksum file.
236+
release-verify *ARGS:
237+
node scripts/release/verify-artifacts.mjs {{ARGS}}
238+
239+
# Generate the CycloneDX SBOM.
240+
release-sbom OUT="dist/release/sbom.cdx.json":
241+
node scripts/release/generate-sbom.mjs --out {{OUT}}
242+
243+
# Point the website download page at a published release.
244+
release-website TAG:
245+
node scripts/release/update-website-manifest.mjs --manifest dist/release/release-manifest.json --tag {{TAG}}
246+
207247
# Validate AUR PKGBUILDs using Docker (requires docker; works on any OS).
208248
# Standard AUR CI pattern: useradd non-root builder + makepkg --printsrcinfo.
209249
aur-validate:
210250
docker run --rm -v "$(pwd)/dist/aur:/aur" archlinux:base-devel bash -c " \
211251
useradd -m builder && \
212252
chown -R builder:builder /aur && \
213-
cd /aur/strata-desktop && su -c 'makepkg --printsrcinfo' builder && echo 'source PKGBUILD OK' && \
214-
cd /aur/strata-desktop-bin && su -c 'makepkg --printsrcinfo' builder && echo 'bin PKGBUILD OK' \
253+
cd /aur/varve-desktop && su -c 'makepkg --printsrcinfo' builder && echo 'source PKGBUILD OK' && \
254+
cd /aur/varve-desktop-bin && su -c 'makepkg --printsrcinfo' builder && echo 'bin PKGBUILD OK' \
215255
"
216256

217257
# Smoke-test AppImage on the current Linux session (Wayland or X11).

‎scripts/release/collect-artifacts.mjs‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ import {
4040
} from 'node:fs';
4141
import { basename, dirname, join, resolve } from 'node:path';
4242
import { fileURLToPath } from 'node:url';
43+
import { productSlug } from './product.mjs';
4344

4445
const repoRoot = join(dirname(fileURLToPath(import.meta.url)), '..', '..');
4546

@@ -88,7 +89,7 @@ function humanSize(bytes) {
8889
return mb >= 1000 ? `${(mb / 1000).toFixed(2)} GB` : `${mb.toFixed(1)} MB`;
8990
}
9091

91-
function collect({ bundleDir, outDir, os, arch, version }) {
92+
function collect({ bundleDir, outDir, os, arch, version, product }) {
9293
if (!existsSync(bundleDir)) {
9394
throw new Error(
9495
`Bundle directory not found: ${bundleDir}\n` +
@@ -110,7 +111,7 @@ function collect({ bundleDir, outDir, os, arch, version }) {
110111
const source = join(dir, entry);
111112
if (!statSync(source).isFile()) continue;
112113

113-
const canonical = `Strata-${version}-${os}-${arch}.${meta.ext}`;
114+
const canonical = `${product}-${version}-${os}-${arch}.${meta.ext}`;
114115
const dest = join(outDir, canonical);
115116
copyFileSync(source, dest);
116117

@@ -199,7 +200,10 @@ function main() {
199200
);
200201
}
201202

202-
const artifacts = collect({ bundleDir, outDir, os, arch, version });
203+
// Read from tauri.conf.json rather than hardcoded, so a product rename
204+
// renames the artifacts too instead of silently shipping the old name.
205+
const product = productSlug();
206+
const artifacts = collect({ bundleDir, outDir, os, arch, version, product });
203207
writeChecksums(outDir, artifacts);
204208
const manifest = writeManifest(outDir, artifacts, version);
205209

‎scripts/release/product.mjs‎

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
/**
2+
* Single source for the product name and repository slug used by release tooling.
3+
*
4+
* Both were hardcoded as "Strata" and "K-Arthur/Strata" across the release
5+
* scripts. With a product rename in progress (Strata -> Varve), that is a
6+
* silent-failure waiting to happen: artifacts would keep being named
7+
* `Strata-0.1.0-…` after the rename, and the download page would keep pointing
8+
* at URLs built from the old slug. Nothing would error — the release would just
9+
* be wrong.
10+
*
11+
* Deriving both from configuration that the rename has to touch anyway means
12+
* the release pipeline follows the rename instead of needing to be remembered.
13+
*/
14+
import { execFileSync } from 'node:child_process';
15+
import { readFileSync } from 'node:fs';
16+
import { dirname, join } from 'node:path';
17+
import { fileURLToPath } from 'node:url';
18+
19+
const repoRoot = join(dirname(fileURLToPath(import.meta.url)), '..', '..');
20+
21+
/**
22+
* Product name used to build artifact filenames, e.g. `Varve-0.1.0-linux-x86_64.deb`.
23+
*
24+
* Taken from `tauri.conf.json`'s `productName`, with a trailing " Desktop"
25+
* removed — the installer is the product, and "Varve Desktop-0.1.0-…" reads
26+
* like a mistake. Spaces become hyphens so the filename stays shell-safe.
27+
*/
28+
export function productSlug() {
29+
const conf = JSON.parse(
30+
readFileSync(join(repoRoot, 'apps/desktop/src-tauri/tauri.conf.json'), 'utf-8'),
31+
);
32+
const name = String(conf.productName ?? '').trim();
33+
if (!name) throw new Error('tauri.conf.json has no productName');
34+
return name.replace(/\s+Desktop$/i, '').replace(/\s+/g, '-');
35+
}
36+
37+
/**
38+
* `owner/repo` for building release URLs.
39+
*
40+
* Order matters: CI's `GITHUB_REPOSITORY` is authoritative when present, then
41+
* the git remote — which GitHub updates automatically when a repository is
42+
* renamed, so this keeps working without anyone editing a constant.
43+
*/
44+
export function repoSlug() {
45+
if (process.env.GITHUB_REPOSITORY) return process.env.GITHUB_REPOSITORY;
46+
47+
let url;
48+
try {
49+
url = execFileSync('git', ['remote', 'get-url', 'origin'], {
50+
cwd: repoRoot,
51+
encoding: 'utf-8',
52+
stdio: ['ignore', 'pipe', 'ignore'],
53+
}).trim();
54+
} catch {
55+
throw new Error(
56+
'Cannot determine the repository: no GITHUB_REPOSITORY and no git remote "origin". ' +
57+
'Pass --repo owner/name explicitly.',
58+
);
59+
}
60+
61+
// git@github.com:owner/repo.git | https://github.com/owner/repo(.git)
62+
const match = url.match(/[:/]([^/:]+\/[^/]+?)(?:\.git)?$/);
63+
if (!match) throw new Error(`Could not parse a repository slug from remote URL: ${url}`);
64+
return match[1];
65+
}
66+
67+
/**
68+
* Document file extension without the dot, e.g. `strata`.
69+
*
70+
* Read from `bundle.fileAssociations` so release notes describe the format the
71+
* build actually registers, rather than a string that survives a rename.
72+
*/
73+
export function documentExtension() {
74+
const conf = JSON.parse(
75+
readFileSync(join(repoRoot, 'apps/desktop/src-tauri/tauri.conf.json'), 'utf-8'),
76+
);
77+
return conf.bundle?.fileAssociations?.[0]?.ext?.[0] ?? 'strata';
78+
}

‎scripts/release/publish-model-assets.mjs‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import { createHash } from 'node:crypto';
2828
import { existsSync, readFileSync, statSync } from 'node:fs';
2929
import { dirname, join } from 'node:path';
3030
import { fileURLToPath } from 'node:url';
31+
import { productSlug, repoSlug } from './product.mjs';
3132

3233
const repoRoot = join(dirname(fileURLToPath(import.meta.url)), '..', '..');
3334
const SOURCE_DIR = join(repoRoot, 'models-source');
@@ -137,9 +138,9 @@ function main() {
137138
'create',
138139
TAG,
139140
'--title',
140-
'Strata AI models (v1)',
141+
`${productSlug()} AI models (v1)`,
141142
'--notes',
142-
'On-demand AI models downloaded by Strata. Not an application release.\n\n' +
143+
`On-demand AI models downloaded by ${productSlug()}. Not an application release.\n\n` +
143144
'These are pinned by SHA-256 in the app; assets here are never overwritten. ' +
144145
'A revised model ships as models-v2.',
145146
'--latest=false',
@@ -158,7 +159,7 @@ function main() {
158159
process.stdout.write(`\nDone. Verify a download resolves:\n`);
159160
for (const { filename } of ready) {
160161
process.stdout.write(
161-
` curl -sIL https://github.com/K-Arthur/Strata/releases/download/${TAG}/${filename} | head -1\n`,
162+
` curl -sIL https://github.com/${repoSlug()}/releases/download/${TAG}/${filename} | head -1\n`,
162163
);
163164
}
164165
}

‎scripts/release/release-notes.mjs‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import { readFileSync, writeFileSync } from 'node:fs';
2020
import { dirname, join, resolve } from 'node:path';
2121
import { fileURLToPath } from 'node:url';
22+
import { documentExtension, productSlug } from './product.mjs';
2223

2324
const repoRoot = join(dirname(fileURLToPath(import.meta.url)), '..', '..');
2425

@@ -85,7 +86,7 @@ function main() {
8586
const platforms = [...new Set(manifest.artifacts.map((a) => a.os))];
8687
const out = [];
8788

88-
out.push(`## Strata ${version}`);
89+
out.push(`## ${productSlug()} ${version}`);
8990
out.push('');
9091
out.push(changelogSection(version));
9192
out.push('');
@@ -151,7 +152,8 @@ function main() {
151152
out.push('');
152153
out.push(
153154
'- **This is early software. Keep backups of anything you care about.** ' +
154-
'The `.strata` document format may still change in ways that break older files.',
155+
`The \`.${documentExtension()}\` document format may still change in ways that ` +
156+
'break older files.',
155157
);
156158
out.push('- Updates are manual — there is no in-app updater yet.');
157159
if (!platforms.includes('macos')) {
@@ -163,7 +165,7 @@ function main() {
163165
out.push('');
164166
out.push(
165167
'A CycloneDX software bill of materials is attached as ' +
166-
`\`strata-${version}-sbom.cdx.json\`.`,
168+
`\`${productSlug().toLowerCase()}-${version}-sbom.cdx.json\`.`,
167169
);
168170

169171
writeFileSync(outPath, `${out.join('\n')}\n`);

‎scripts/release/update-website-manifest.mjs‎

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import { mkdirSync, readFileSync, writeFileSync } from 'node:fs';
2020
import { dirname, join, resolve } from 'node:path';
2121
import { fileURLToPath } from 'node:url';
22+
import { productSlug, repoSlug } from './product.mjs';
2223

2324
const repoRoot = join(dirname(fileURLToPath(import.meta.url)), '..', '..');
2425
const OUT = join(repoRoot, 'apps/website/src/data/release-manifest.json');
@@ -29,22 +30,22 @@ function parseArgs(argv) {
2930
return args;
3031
}
3132

32-
const FORMAT_COPY = {
33+
const formatCopy = (product) => ({
3334
appimage: {
3435
title: 'AppImage',
3536
blurb: 'Single file, runs on any x86-64 Linux. No install, no root.',
3637
caveat: 'Requires FUSE2. On systems without it, run with --appimage-extract-and-run.',
37-
install: 'chmod +x Strata-*.AppImage && ./Strata-*.AppImage',
38+
install: `chmod +x ${product}-*.AppImage && ./${product}-*.AppImage`,
3839
},
3940
deb: {
4041
title: 'Debian package',
4142
blurb: 'For Debian 12+ and Ubuntu 22.04+.',
42-
install: 'sudo apt install ./Strata-*.deb',
43+
install: `sudo apt install ./${product}-*.deb`,
4344
},
4445
rpm: {
4546
title: 'RPM package',
4647
blurb: 'For Fedora and RHEL-based distributions.',
47-
install: 'sudo dnf install ./Strata-*.rpm',
48+
install: `sudo dnf install ./${product}-*.rpm`,
4849
},
4950
nsis: {
5051
title: 'Windows installer',
@@ -63,19 +64,21 @@ const FORMAT_COPY = {
6364
blurb: 'Apple Silicon.',
6465
caveat:
6566
'Unsigned and not notarised: macOS will refuse to open it. Use System Settings > Privacy & Security > Open Anyway. Do not disable Gatekeeper.',
66-
install: 'Open the .dmg and drag Strata to Applications',
67+
install: `Open the .dmg and drag ${product} to Applications`,
6768
},
68-
};
69+
});
6970

7071
function main() {
7172
const args = parseArgs(process.argv.slice(2));
72-
const repo = args.repo ?? 'K-Arthur/Strata';
73+
const repo = args.repo ?? repoSlug();
7374
const tag = args.tag;
7475
if (!tag) throw new Error('--tag is required (e.g. --tag v0.1.0)');
7576

7677
const manifest = JSON.parse(readFileSync(resolve(repoRoot, args.manifest), 'utf-8'));
7778
const base = `https://github.com/${repo}/releases/download/${tag}`;
7879

80+
const product = productSlug();
81+
const FORMAT_COPY = formatCopy(product);
7982
const platforms = {};
8083
for (const artifact of manifest.artifacts) {
8184
platforms[artifact.os] ??= [];
@@ -105,7 +108,7 @@ function main() {
105108
notarized: manifest.notarized === true,
106109
releaseUrl: `https://github.com/${repo}/releases/tag/${tag}`,
107110
checksumsUrl: `${base}/SHA256SUMS.txt`,
108-
sbomUrl: `${base}/strata-${manifest.version}-sbom.cdx.json`,
111+
sbomUrl: `${base}/${productSlug().toLowerCase()}-${manifest.version}-sbom.cdx.json`,
109112
platforms,
110113
};
111114

0 commit comments

Comments
 (0)