npm: stamp version as base-YYYYMMDD.hash on every CI build

Mirrors the AppImage versioning form (8.3.637~20260414~d157eea) as
closely as semver allows: 8.3.637-20260414.d157eea.

- package.json: placeholder 0.0.0-dev; CI always overwrites before pack
- npm-publish.yml: version step now runs unconditionally (not just on
  tags), reading VERSION + git date + git hash — dry-run artifacts are
  stamped too, making them unambiguously traceable to their source commit
This commit is contained in:
Intubun 2026-05-06 10:38:06 +02:00
parent 93bf324007
commit 003babee04
2 changed files with 8 additions and 4 deletions

View File

@ -79,10 +79,14 @@ jobs:
cp magic/magic.js npm/ cp magic/magic.js npm/
cp magic/magic.wasm npm/ cp magic/magic.wasm npm/
- name: Set package version from tag - name: Set package version
if: startsWith(github.ref, 'refs/tags/v')
run: | run: |
VERSION="${GITHUB_REF#refs/tags/v}" base=$(cat VERSION) # e.g. 8.3.637
date=$(git show -s --format=%cs | tr -d '-') # e.g. 20260414
hash=$(git show -s --format=%h) # e.g. d157eea
# npm requires semver; use pre-release syntax as the closest equivalent
# to the AppImage form 8.3.637~20260414~d157eea
VERSION="${base}-${date}.${hash}"
cd npm cd npm
npm version "$VERSION" --no-git-tag-version npm version "$VERSION" --no-git-tag-version

View File

@ -1,6 +1,6 @@
{ {
"name": "magic-vlsi-wasm", "name": "magic-vlsi-wasm",
"version": "8.3.637", "version": "0.0.0-dev",
"description": "Magic VLSI Layout Tool — headless WebAssembly build", "description": "Magic VLSI Layout Tool — headless WebAssembly build",
"type": "module", "type": "module",
"main": "index.js", "main": "index.js",