Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,9 @@ jobs:
if [ "$VERSION_BUMP" = "manual" ]; then
STABLE_VERSION="$STABLE_VERSION_INPUT"
else
STABLE_VERSION="$(
CURRENT_LATEST="$CURRENT_LATEST" VERSION_BUMP="$VERSION_BUMP" node - <<'NODE'
const currentLatest = process.env.CURRENT_LATEST || '';
const bump = process.env.VERSION_BUMP || 'patch';
STABLE_VERSION="$(CURRENT_LATEST="$CURRENT_LATEST" VERSION_BUMP="$VERSION_BUMP" node -e '
const currentLatest = process.env.CURRENT_LATEST || "";
const bump = process.env.VERSION_BUMP || "patch";
const match = currentLatest.match(/^(\d+)\.(\d+)\.(\d+)(?:-.+)?$/);
let major = match ? Number(match[1]) : 0;
let minor = match ? Number(match[2]) : 0;
Expand All @@ -94,20 +93,19 @@ jobs:
patch = 1;
} else if (isPrerelease) {
// Promote the current prerelease base to stable, for example 0.0.1-next.18 -> 0.0.1.
} else if (bump === 'major') {
} else if (bump === "major") {
major += 1;
minor = 0;
patch = 0;
} else if (bump === 'minor') {
} else if (bump === "minor") {
minor += 1;
patch = 0;
} else {
patch += 1;
}

process.stdout.write(`${major}.${minor}.${patch}`);
NODE
)"
')"
fi

if ! printf '%s' "$STABLE_VERSION" | grep -Eq '^[0-9]+\.[0-9]+\.[0-9]+$'; then
Expand Down
Loading