Skip to content

Commit c348b3e

Browse files
authored
fix(workflow): replace semver dependency with native version calculation (#42)
* fix(workflow): improve script validation in auto-publish workflow Replace unreliable yarn run --help script detection with direct Node.js package.json parsing - Use Node.js to directly read and validate package.json scripts instead of parsing yarn output - Improve error messages with detailed script information - Ensure reliable detection of required test:ci and dist scripts - Fix workflow failure when scripts exist but aren't detected by yarn run --help This resolves the "Missing test:ci script in package.json" error that occurred even when the scripts were properly defined in package.json. * fix(workflow): replace semver dependency with native version calculation Replace semver.inc() with native JavaScript version increment logic - Remove dependency on external semver package that wasn't available in the runner - Implement semantic versioning logic directly in Node.js - Fix "command not found" error during version bump calculation - Ensure reliable version increment for major, minor, and patch releases This resolves the workflow failure in the "Determine version bump" step.
1 parent dfd00d1 commit c348b3e

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

.github/workflows/auto-publish.yml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,9 +185,22 @@ jobs:
185185
186186
# Calculate new version
187187
NEW_VERSION=$(node -e "
188-
const semver = require('semver');
189188
const current = '$CURRENT_VERSION';
190-
console.log(semver.inc(current, '$VERSION_TYPE'));
189+
const type = '$VERSION_TYPE';
190+
const parts = current.split('.').map(Number);
191+
192+
if (type === 'major') {
193+
parts[0]++;
194+
parts[1] = 0;
195+
parts[2] = 0;
196+
} else if (type === 'minor') {
197+
parts[1]++;
198+
parts[2] = 0;
199+
} else {
200+
parts[2]++;
201+
}
202+
203+
console.log(parts.join('.'));
191204
")
192205
193206
echo "🚀 New version will be: $NEW_VERSION"

0 commit comments

Comments
 (0)