GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Pake/scripts/check-release-version.mjs at main · diffuzor2a9/Pake

Expand file tree

/

check-release-version.mjs

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
102 lines (88 loc) · 2.54 KB
/

check-release-version.mjs

Copy path

File metadata and controls

102 lines (88 loc) · 2.54 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#!/usr/bin/env node
import fs from "node:fs";
import path from "node:path";
const root = process.cwd();
// Only trust GITHUB_REF_NAME when the workflow actually runs on a tag;
// on workflow_dispatch it holds the branch name, which is not a version.
const refTag =
process.env.GITHUB_REF_TYPE === "tag" ? process.env.GITHUB_REF_NAME : "";
const tag = process.argv[2] || refTag;
const errors = [];
function readText(filePath) {
return fs.readFileSync(path.join(root, filePath), "utf8");
}
function readJson(filePath) {
return JSON.parse(readText(filePath));
}
function expectEqual(label, actual, expected) {
if (actual !== expected) {
errors.push(`${label}: expected ${expected}, got ${actual || "<missing>"}`);
}
}
function extractCargoVersion() {
const cargoToml = readText("src-tauri/Cargo.toml");
const match = cargoToml.match(/^version\s*=\s*"([^"]+)"/m);
return match?.[1];
}
function extractCargoLockVersion() {
const cargoLock = readText("src-tauri/Cargo.lock");
const match = cargoLock.match(
/\[\[package\]\]\s+name = "pake"\s+version = "([^"]+)"/,
);
return match?.[1];
}
function extractDistVersion() {
const distCli = readText("dist/cli.js");
const match = distCli.match(
/\b(?:var|let|const)\s+version\s*=\s*["']([^"']+)["'];/,
);
return match?.[1];
}
const packageJson = readJson("package.json");
const packageVersion = packageJson.version;
const expectedTag = tag || `V${packageVersion}`;
if (!/^V\d+\.\d+\.\d+$/.test(expectedTag)) {
errors.push(
`release tag must match Vx.y.z, got ${expectedTag || "<missing>"}`,
);
} else {
expectEqual("tag version", expectedTag.slice(1), packageVersion);
}
expectEqual(
"src-tauri/Cargo.toml version",
extractCargoVersion(),
packageVersion,
);
expectEqual(
"src-tauri/Cargo.lock version",
extractCargoLockVersion(),
packageVersion,
);
expectEqual(
"src-tauri/tauri.conf.json version",
readJson("src-tauri/tauri.conf.json").version,
packageVersion,
);
expectEqual(
"dist/cli.js bundled version",
extractDistVersion(),
packageVersion,
);
expectEqual(
"package.json repository.url",
packageJson.repository?.url,
"git+https://github.com/tw93/Pake.git",
);
if (!packageJson.files?.includes("LICENSE-EXCEPTION")) {
errors.push(
"package.json files: LICENSE-EXCEPTION must be included in the npm package",
);
}
if (errors.length > 0) {
console.error("Release version check failed:");
for (const error of errors) {
console.error(`- ${error}`);
}
process.exit(1);
}
console.log(`Release version check passed for V${packageVersion}`);
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.