refactor(landlock-run): unify workspace release (review round 1)

This commit is contained in:
Hypatia May
2026-08-06 10:23:26 +08:00
parent e88bace07e
commit 598f9719f4
40 changed files with 535 additions and 530 deletions
@@ -1,8 +1,8 @@
#!/usr/bin/env node
/**
* Release verification. Always: every published package carries one shared
* version, and — when running from a tag or publishing — the `vX.Y.Z` tag
* matches it. With `--prebuilds`: every platform package's declared
* version, and — when running from a tag or publishing — the
* `landlock-run-vX.Y.Z` tag matches it. With `--prebuilds`: every platform package's declared
* binaries exist with the right ELF architecture (run after
* `assemble-prebuilds.mjs` or a local `build:native`).
*/
@@ -10,6 +10,8 @@
import path from 'node:path';
import { packageDirs, platformDirs, readJson, root, verifyPlatformBinaries } from './repo.mjs';
const TAG_PREFIX = 'refs/tags/landlock-run-v';
function verifyVersions() {
const packages = packageDirs().map((dir) => ({
dir,
@@ -26,13 +28,13 @@ function verifyVersions() {
const version = packages[0].manifest.version;
const ref = process.env.GITHUB_REF || '';
const publish = process.env.RELEASE_PUBLISH === 'true';
if (publish && !ref.startsWith('refs/tags/v')) {
throw new Error('publishing requires running the workflow from a v* tag');
if (publish && !ref.startsWith(TAG_PREFIX)) {
throw new Error('publishing requires running the workflow from a landlock-run-v* tag');
}
if (ref.startsWith('refs/tags/v')) {
const tagVersion = ref.slice('refs/tags/v'.length);
if (ref.startsWith(TAG_PREFIX)) {
const tagVersion = ref.slice(TAG_PREFIX.length);
if (tagVersion !== version) {
throw new Error(`tag/version mismatch: tag v${tagVersion}, packages ${version}`);
throw new Error(`tag/version mismatch: tag landlock-run-v${tagVersion}, packages ${version}`);
}
}