fix(build): include commit short SHA in version string for traceability#1723
Merged
Conversation
Preview version strings now include the git short SHA (e.g. 0.0.0-main-202607141224-a1b2c3d). Falls back to MIMOCODE_COMMIT_SHA env var when git is unavailable (CI/non-repo builds).
Simplify version format from 0.0.0-<channel>-<timestamp>-<sha> to 0.0.0-<channel>-<sha>. The timestamp is redundant (files have mtime, git commits have dates) and makes the version too long for narrow UI. The SHA is what actually maps to code. Also changes fallback from empty string to 'unknown' for graceful degradation when neither git nor env fallback is available.
… 'unknown' When both git and MIMOCODE_COMMIT_SHA env are unavailable, the version string now produces '0.0.0-<channel>' without any SHA segment, instead of appending '-unknown'.
…ring When no git SHA is available (no git repo and no MIMOCODE_COMMIT_SHA env), the version string now appends a YYYYMMDDHHmm timestamp instead of omitting the identifier segment entirely. SHA remains the preferred identifier when available (0.0.0-<channel>-<sha>); timestamp is the fallback only.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
0.0.0-<channel>-<timestamp>-<shortsha>(e.g.0.0.0-main-202607141224-a1b2c3d)MIMOCODE_COMMIT_SHAenv var when git is unavailable (CI/non-repo builds)Changes
packages/script/src/index.ts: AddedSHORT_SHAviagit rev-parse --short HEADwith env var fallback; appended to preview version stringVerification
0.0.0-fix/version-include-sha-202607141237-f17e98b(SHA included)0.0.0-main-202607141237-abc1234(works without git)