Skip to content

Commit ac16775

Browse files
Add unstable dist tag for NPM package
1 parent 1890825 commit ac16775

2 files changed

Lines changed: 17 additions & 6 deletions

File tree

.github/workflows/publish.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ on:
1414
options:
1515
- latest
1616
- prerelease
17+
- unstable
1718
version:
1819
description: "Version override (optional, e.g., 1.0.0). If empty, auto-increments."
1920
type: string
@@ -66,8 +67,8 @@ jobs:
6667
fi
6768
else
6869
if [[ "$VERSION" != *-* ]]; then
69-
echo "❌ Error: Version '$VERSION' has no prerelease suffix but dist-tag is 'prerelease'" >> $GITHUB_STEP_SUMMARY
70-
echo "Use a version with suffix (e.g., '1.0.0-preview.0') for prerelease"
70+
echo "❌ Error: Version '$VERSION' has no prerelease suffix but dist-tag is '${{ github.event.inputs.dist-tag }}'" >> $GITHUB_STEP_SUMMARY
71+
echo "Use a version with suffix (e.g., '1.0.0-preview.0') for prerelease/unstable"
7172
exit 1
7273
fi
7374
fi
@@ -112,6 +113,7 @@ jobs:
112113

113114
publish-dotnet:
114115
name: Publish .NET SDK
116+
if: github.event.inputs.dist-tag != 'unstable'
115117
needs: version
116118
runs-on: ubuntu-latest
117119
defaults:
@@ -147,6 +149,7 @@ jobs:
147149

148150
publish-python:
149151
name: Publish Python SDK
152+
if: github.event.inputs.dist-tag != 'unstable'
150153
needs: version
151154
runs-on: ubuntu-latest
152155
defaults:
@@ -183,7 +186,7 @@ jobs:
183186
github-release:
184187
name: Create GitHub Release
185188
needs: [version, publish-nodejs, publish-dotnet, publish-python]
186-
if: github.ref == 'refs/heads/main'
189+
if: github.ref == 'refs/heads/main' && github.event.inputs.dist-tag != 'unstable'
187190
runs-on: ubuntu-latest
188191
steps:
189192
- uses: actions/checkout@v6.0.2

nodejs/scripts/get-version.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*
66
* Usage:
77
*
8-
* node scripts/get-version.js [current|current-prerelease|latest|prerelease]
8+
* node scripts/get-version.js [current|current-prerelease|latest|prerelease|unstable]
99
*
1010
* Outputs the version to stdout.
1111
*/
@@ -32,7 +32,7 @@ async function getLatestVersion(tag) {
3232

3333
async function main() {
3434
const command = process.argv[2];
35-
const validCommands = ["current", "current-prerelease", "latest", "prerelease"];
35+
const validCommands = ["current", "current-prerelease", "latest", "prerelease", "unstable"];
3636
if (!validCommands.includes(command)) {
3737
console.error(
3838
`Invalid argument, must be one of: ${validCommands.join(", ")}, got: "${command}"`
@@ -75,8 +75,16 @@ async function main() {
7575
return;
7676
}
7777

78+
if (command === "unstable") {
79+
const unstable = await getLatestVersion("unstable");
80+
if (unstable && semver.gt(unstable, higherVersion)) {
81+
higherVersion = unstable;
82+
}
83+
}
84+
7885
const increment = command === "latest" ? "patch" : "prerelease";
79-
const prereleaseIdentifier = command === "prerelease" ? "preview" : undefined;
86+
const prereleaseIdentifier =
87+
command === "prerelease" ? "preview" : command === "unstable" ? "unstable" : undefined;
8088
const nextVersion = semver.inc(higherVersion, increment, prereleaseIdentifier);
8189
if (!nextVersion) {
8290
console.error(`Failed to increment version "${higherVersion}" with "${increment}"`);

0 commit comments

Comments
 (0)