Skip to content

build(version): derive app version from git tag when package.json is a placeholder - #924

Merged
PaulHax merged 2 commits into
Kitware:mainfrom
PaulHax:version-from-git-tag
Aug 17, 2026
Merged

build(version): derive app version from git tag when package.json is a placeholder#924
PaulHax merged 2 commits into
Kitware:mainfrom
PaulHax:version-from-git-tag

Conversation

@PaulHax

@PaulHax PaulHax commented Aug 17, 2026

Copy link
Copy Markdown
Collaborator

The About box and bug report link read __VERSIONS__.volview, which came straight from package.json. Since main pins the version to 0.0.0 (the release workflow stamps the real version only in the CI checkout), every non-publish build showed 0.0.0.

This keeps package.json at 0.0.0 and instead falls back to git describe --tags in vite.config.ts when the version is the placeholder. When CI has already stamped a real version, that value still wins, so published npm tarballs are unchanged.

Netlify clones shallow and without tags, so git describe had nothing to work with (verified with a --depth 1 clone: describe degrades to a bare sha). The second commit adds a tag fetch to the Netlify build command, tolerant of both shallow and complete repos, and non-fatal if the fetch fails.

Resulting version shown per build:

Build package.json at build About box
npm tag release stamped by CI tag version
npm dev prerelease stamped by CI matches published
Netlify / local 0.0.0 git describe, e.g. 4.4.1-152-g38d39f96

With this, no release needs a version bump commit; the git tag is the single source of truth.

@netlify

netlify Bot commented Aug 17, 2026

Copy link
Copy Markdown

Deploy Preview for volview-dev ready!

Name Link
🔨 Latest commit 778aee1
🔍 Latest deploy log https://app.netlify.com/projects/volview-dev/deploys/6a8376ba1317040008e5659d
😎 Deploy Preview https://deploy-preview-924--volview-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@PaulHax
PaulHax added this pull request to the merge queue Aug 17, 2026
Merged via the queue into Kitware:main with commit 4130541 Aug 17, 2026
8 checks passed
@PaulHax
PaulHax deleted the version-from-git-tag branch August 17, 2026 21:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant