semantic-release-next-version 0.1.4 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -2
- package/dist/cli.js +20 -18
- package/dist/cli.js.map +3 -3
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +3 -3
- package/dist/index.js +2 -2
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -88,7 +88,7 @@ jobs:
|
|
|
88
88
|
run: |
|
|
89
89
|
set -euo pipefail
|
|
90
90
|
MODE=""
|
|
91
|
-
if [ "${{ github.ref }}" = "refs/heads/main" ]; then MODE="--release"; fi
|
|
91
|
+
if [ "${{ github.ref }}" = "refs/heads/main" ]; then MODE="--release --on-no-release preview"; fi
|
|
92
92
|
VERSION=$(npx next-version-helper $MODE)
|
|
93
93
|
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
|
|
94
94
|
# env:
|
|
@@ -115,6 +115,9 @@ npx next-version-helper
|
|
|
115
115
|
npx next-version-helper --release
|
|
116
116
|
# → 0.4.0
|
|
117
117
|
|
|
118
|
+
npx next-version-helper --release --on-no-release preview
|
|
119
|
+
# → 0.4.0-preview-abc1234 (when no releasable commits)
|
|
120
|
+
|
|
118
121
|
# When you run from outside the repo (e.g. a packed tarball):
|
|
119
122
|
npx next-version-helper --cwd /path/to/your/checkout --release
|
|
120
123
|
```
|
|
@@ -137,6 +140,10 @@ console.log(version)
|
|
|
137
140
|
## CLI options
|
|
138
141
|
|
|
139
142
|
- `--release` / `-r`: return plain `x.y.z` (no preview suffix).
|
|
143
|
+
- `--on-no-release <mode>`: behavior when `--release` has no releasable commits:
|
|
144
|
+
- `error` (default): exit with an error.
|
|
145
|
+
- `current`: return `<currentVersion>`.
|
|
146
|
+
- `preview`: return `<currentVersion>-preview-<hash>`.
|
|
140
147
|
- `--cwd <path>`: run against a different working directory (useful when you call from a temp folder).
|
|
141
148
|
- `--default-branch <name>`: set the primary release branch (default: `main`).
|
|
142
149
|
- `--main-branch <name>`: deprecated alias for `--default-branch`.
|
|
@@ -149,11 +156,15 @@ console.log(version)
|
|
|
149
156
|
- On `main` branch with `--release` → returns `x.y.z`.
|
|
150
157
|
- On any branch without `--release` → returns `x.y.z-preview-<hash>`.
|
|
151
158
|
- If there is no new release in preview mode → returns `<currentVersion>-preview-<hash>`.
|
|
152
|
-
- If there is no new release with `--release
|
|
159
|
+
- If there is no new release with `--release`:
|
|
160
|
+
- `--on-no-release error` (default) → exits with an error.
|
|
161
|
+
- `--on-no-release current` → returns `<currentVersion>`.
|
|
162
|
+
- `--on-no-release preview` → returns `<currentVersion>-preview-<hash>`.
|
|
153
163
|
- `currentVersion` is resolved from the latest semantic version tag, then falls back to `package.json` version.
|
|
154
164
|
- Uses `@semantic-release/commit-analyzer` by default (must be installed).
|
|
155
165
|
- Default branch defaults to `main`; override with `--default-branch` or `defaultBranch` in code.
|
|
156
166
|
- `--cwd` lets you run the CLI outside the repo root (for example after `npm pack`).
|
|
167
|
+
- Recommended for main-branch packaging/smoke flows: `--release --on-no-release preview` to keep artifacts clearly non-stable and reduce accidental publish risk.
|
|
157
168
|
|
|
158
169
|
---
|
|
159
170
|
|