diff --git a/RELEASES.md b/RELEASES.md index 2bc7dc917..acc3da1d6 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -3,9 +3,14 @@ ## Step-by-step guide 1. Go to the [Actions tab](https://github.com/wavetermdev/thenextwave/actions) and select "Bump Version" from the left sidebar. -2. Click on "Run workflow". You will see two options: - - "SemVer Bump": This defaults to `none`. Adjust this if you want to increment the version number according to semantic versioning rules (`patch`, `minor`, `major`). - - "Is Prerelease": This defaults to `true`. If set to `true`, a `-beta.X` version will be appended to the end of the version. If one is already present and the base SemVer is not being incremented, the `-beta` version will be incremented (i.e. `0.1.13-beta.0` to `0.1.13-beta.1`). +2. Click on "Run workflow". + - You will see two options: + - "SemVer Bump": This defaults to `none`. Adjust this if you want to increment the version number according to semantic versioning rules (`patch`, `minor`, `major`). + - "Is Prerelease": This defaults to `true`. If set to `true`, a `-beta.X` version will be appended to the end of the version. If one is already present and the base SemVer is not being incremented, the `-beta` version will be incremented (i.e. `0.1.13-beta.0` to `0.1.13-beta.1`). If set to `false`, the `-beta.X` suffix will be removed from the version number. If one was not already present, it will remain absent. + - Some examples: + - If you are creating a new prerelease following an official release, you would set "SemVer Bump" to to the expected version bump (`patch`, `minor`, or `major`) and "Is Prerelease" to `true`. + - If you are bumping an existing prerelease to a new prerelease under the same version, you would set "SemVer Bump" to `none` and "Is Prerelease" to `true`. + - If you are promoting a prerelease version to an official release, you would set "SemVer Bump" to `none` and "Is Prerelease" to `false`. 3. After "Bump Version" a "Build Helper" run will kick off automatically for the new version. When this completes, it will generate a draft GitHub Release with all the built artifacts. 4. Review the artifacts in the release and test them locally. 5. When you are confident that the build is good, edit the GitHub Release to add a changelog and release summary and publish the release. diff --git a/Taskfile.yml b/Taskfile.yml index 8e4884821..280d632f7 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -203,16 +203,7 @@ tasks: - frontend/app/store/wshserver.ts version: - desc: Get the current package version, or bump version if args are present. To pass args to `version.cjs`, add them after `--`. - summary: | - If no arguments are present, the current version will be returned. - If only a single argument is given, the following are valid inputs: - - `none`: No-op. - - `patch`: Bumps the patch version. - - `minor`: Bumps the minor version. - - `major`: Bumps the major version. - - '1', 'true': Bumps the prerelease version. - If two arguments are given, the first argument must be either `none`, `patch`, `minor`, or `major`. The second argument must be `1` or `true` to bump the prerelease version. + desc: Get the current package version, or bump version if args are present. To pass args to `version.cjs`, add them after `--`. See `version.cjs` for usage definitions for the arguments. cmd: node version.cjs {{.CLI_ARGS}} artifacts:upload: diff --git a/package.json b/package.json index ab6b82b51..7e5fd498a 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "productName": "TheNextWave", "description": "An Open-Source, AI-Native, Terminal Built for Seamless Workflows", "license": "Apache-2.0", - "version": "0.1.13", + "version": "0.1.18", "homepage": "https://waveterm.dev", "build": { "appId": "dev.commandline.thenextwave" diff --git a/version.cjs b/version.cjs index fca8c93e0..a90caa170 100644 --- a/version.cjs +++ b/version.cjs @@ -8,7 +8,14 @@ * - `minor`: Bumps the minor version. * - `major`: Bumps the major version. * - '1', 'true': Bumps the prerelease version. - * If two arguments are given, the first argument must be either `none`, `patch`, `minor`, or `major`. The second argument must be `1` or `true` to bump the prerelease version. + * If two arguments are given, the following are valid inputs for the first argument: + * - `none`: No-op. + * - `patch`: Bumps the patch version. + * - `minor`: Bumps the minor version. + * - `major`: Bumps the major version. + * The following are valid inputs for the second argument: + * - `0`, 'false': The release is not a prerelease, will remove any prerelease identifier from the version, if one was present. + * - '1', 'true': The release is a prerelease (any value other than `0` or `false` will be interpreted as `true`). */ const path = require("path"); @@ -23,11 +30,21 @@ if (typeof require !== "undefined" && require.main === module) { const fs = require("fs"); const semver = require("semver"); - const action = process.argv[2]; + let action = process.argv[2]; + + // If prerelease argument is not explicitly set, mark it as undefined. const isPrerelease = process.argv.length > 3 - ? process.argv[3] === "true" || process.argv[3] === "1" - : action === "true" || action === "1"; + ? process.argv[3] !== "false" && process.argv[3] !== "0" + : action === "true" || action === "1" + ? true + : undefined; + + // This will remove the prerelease version string (i.e. 0.1.13-beta.1 -> 0.1.13) if the arguments are `none 0` and the current version is a prerelease. + if (action === "none" && isPrerelease === false && semver.prerelease(VERSION)) { + action = "patch"; + } + let newVersion = packageJson.version; switch (action) { case "major":