autorel 2.6.4 → 2.6.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 +423 -37
- package/dist/cli.js +2 -2
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,25 +1,22 @@
|
|
|
1
|
-
|
|
1
|
+
# 🚀 autorel
|
|
2
2
|
|
|
3
|
-
[](https://github.com/mhweiner/autorel/actions)
|
|
4
|
-
[]()
|
|
5
|
-
[](https://conventionalcommits.org)
|
|
6
|
-
[](https://github.com/mhweiner/autorel)
|
|
3
|
+
[](https://github.com/mhweiner/autorel/actions) []() [](https://conventionalcommits.org) [](https://github.com/mhweiner/autorel)
|
|
7
4
|
|
|
8
|
-
|
|
5
|
+
Autorel is a fast, simple, and reliable tool for automating releases based on commit messages. Similar to `semantic-release` or `release-please`, but faster, more reliable, and easier to use. Use autorel to save time, prevent broken releases, and ship with confidence.
|
|
9
6
|
|
|
10
|
-
|
|
7
|
+
```bash
|
|
8
|
+
npx autorel@^2 --preRelease alpha --publish --run 'echo "Next version is ${NEXT_VERSION}"'
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
It follows [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) and [Semantic Versioning](https://semver.org/) to automatically:
|
|
11
12
|
|
|
12
13
|
- Run pre-release tasks (tests, builds, etc.)
|
|
13
14
|
- Bump the version and tag based on commit messages
|
|
14
|
-
- Create tagged
|
|
15
|
-
- Publish to
|
|
15
|
+
- Create tagged releases with changelog notes
|
|
16
|
+
- Publish to package manager registry
|
|
16
17
|
- Run custom scripts or commands with the new version number available as an environment variable
|
|
17
18
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
Supports GitHub Actions and npm (Node.js) natively. You can add custom scripts for other languages and systems (or contribute built-in support).
|
|
21
|
-
|
|
22
|
-
Use AutoRel to save time, prevent broken releases, and ship with confidence.
|
|
19
|
+
Designed for GitHub Actions and npm, but you can use custom commands for other platforms (or contribute built-in support).
|
|
23
20
|
|
|
24
21
|
**✅ Conventional Commit & SemVer Compliant**
|
|
25
22
|
- 100% compliant with Conventional Commits and SemVer out of the box, including "!" for breaking changes
|
|
@@ -36,61 +33,450 @@ Use AutoRel to save time, prevent broken releases, and ship with confidence.
|
|
|
36
33
|
- No need to install or configure a separate CI/CD system
|
|
37
34
|
- Less broken builds and more time to focus on your code!
|
|
38
35
|
|
|
39
|
-
[Read our FAQ on why you should use AutoRel and how it compares to other tools](docs/faq.md)
|
|
40
|
-
|
|
41
36
|
## Table of Contents
|
|
42
37
|
|
|
43
|
-
- [
|
|
44
|
-
- [
|
|
38
|
+
- [Quick Start](#quick-start)
|
|
39
|
+
- [How It Works](#how-it-works)
|
|
40
|
+
- [Example Usage](#example-usage)
|
|
41
|
+
- [GitHub Actions Setup](#github-actions-setup)
|
|
42
|
+
- [Authentication & Permissions](#authentication--permissions)
|
|
45
43
|
- [Commit Messages](#commit-messages)
|
|
44
|
+
- [Using with Other Platforms](#using-with-other-platforms)
|
|
45
|
+
- [Using as a Library](#using-as-a-library)
|
|
46
|
+
- [Troubleshooting](#troubleshooting)
|
|
47
|
+
- [Configuration Options](/docs/configuration-options.md)
|
|
46
48
|
- [FAQ](docs/faq.md)
|
|
47
49
|
- [System Requirements](#system-requirements)
|
|
48
50
|
- [Contributing](#contributing)
|
|
49
51
|
- [License](#license)
|
|
50
52
|
|
|
51
|
-
##
|
|
53
|
+
## Quick Start
|
|
54
|
+
|
|
55
|
+
The simplest way to get started is using `npx` (no installation required):
|
|
52
56
|
|
|
57
|
+
**First, test what would happen:**
|
|
53
58
|
```bash
|
|
54
|
-
npx autorel@^2 --
|
|
59
|
+
npx autorel@^2 --dry-run --verbose
|
|
55
60
|
```
|
|
56
61
|
|
|
57
|
-
This
|
|
62
|
+
This shows you what version would be released and what changes would be made, without actually doing anything.
|
|
63
|
+
|
|
64
|
+
**When ready, run for real:**
|
|
65
|
+
```bash
|
|
66
|
+
npx autorel@^2 --publish
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
This will automatically:
|
|
70
|
+
1. Analyze commit messages since the last release
|
|
71
|
+
2. Bump the version based on Conventional Commits
|
|
72
|
+
3. Create a GitHub release with changelog notes
|
|
73
|
+
4. Publish to npm (if `--publish` is set)
|
|
74
|
+
|
|
75
|
+
> **Note:** When using `npx`, append the version number (e.g., `@^2`) to prevent breaking changes in future versions.
|
|
76
|
+
|
|
77
|
+
> ⚠️ **Before publishing:** Make sure you're authenticated with npm (see [Authentication & Permissions](#authentication--permissions)). If no commits require a release, autorel will exit successfully without making any changes.
|
|
78
|
+
|
|
79
|
+
## How It Works
|
|
80
|
+
|
|
81
|
+
### Order of Operations
|
|
82
|
+
|
|
83
|
+
When autorel runs, it follows this sequence:
|
|
84
|
+
|
|
85
|
+
1. **Analyze commits** - Scans git history since the last release tag
|
|
86
|
+
2. **Determine version** - Calculates the next version based on Conventional Commits
|
|
87
|
+
3. **Check if release needed** - If no commits require a release, exits successfully (no changes made)
|
|
88
|
+
4. **Run pre-release tasks** - Executes `preRun` scripts (tests, builds, etc.) if configured
|
|
89
|
+
5. **Create git tag** - Tags the current commit with the new version
|
|
90
|
+
6. **Create GitHub release** - Creates a release on GitHub with changelog (unless `--skip-release`)
|
|
91
|
+
7. **Update package.json** - Updates version temporarily in memory (not committed to repo)
|
|
92
|
+
8. **Publish to npm** - Publishes package if `--publish` is set
|
|
93
|
+
9. **Restore package.json** - Immediately restores package.json to original version (always happens, even if publish fails)
|
|
94
|
+
10. **Run post-release scripts** - Executes `run` scripts with `NEXT_VERSION` and `NEXT_TAG` environment variables
|
|
95
|
+
|
|
96
|
+
### When No Release is Needed
|
|
58
97
|
|
|
98
|
+
If your commits don't include any that trigger a release (e.g., only `docs:` or `style:` commits), autorel will:
|
|
99
|
+
- Exit successfully with code 0
|
|
100
|
+
- Print a message indicating no release is needed
|
|
101
|
+
- Make no changes to your repository, tags, or npm
|
|
102
|
+
|
|
103
|
+
This is expected behavior and not an error.
|
|
104
|
+
|
|
105
|
+
### First Release
|
|
106
|
+
|
|
107
|
+
If this is your first release (no previous tags exist), autorel will:
|
|
108
|
+
- Start from the beginning of your git history
|
|
109
|
+
- Use `0.0.0` as the base version
|
|
110
|
+
- **Increment based on your commit type:**
|
|
111
|
+
- `fix:` → `0.0.1` (patch)
|
|
112
|
+
- `feat:` → `0.1.0` (minor)
|
|
113
|
+
- `feat!:` or breaking change → `1.0.0` (major)
|
|
114
|
+
- Create the first release tag
|
|
115
|
+
|
|
116
|
+
**Note:** The version in your `package.json` is not used for version calculation—only git tags are considered.
|
|
117
|
+
|
|
118
|
+
### Error Handling & Rollback
|
|
119
|
+
|
|
120
|
+
If any step fails, autorel will:
|
|
121
|
+
- Stop execution immediately
|
|
122
|
+
- **Rollback:**
|
|
123
|
+
- Remove any git tags that were created in this run
|
|
124
|
+
- Delete any GitHub releases that were created
|
|
125
|
+
- Attempt to unpublish from npm (if publish succeeded but later steps failed)
|
|
126
|
+
- **Package.json:** Always restored to original version immediately after npm publish (whether publish succeeds or fails)
|
|
127
|
+
- Exit with a non-zero code and display error details
|
|
128
|
+
|
|
129
|
+
Use `--dry-run` to test before running for real.
|
|
130
|
+
|
|
131
|
+
## Example Usage
|
|
132
|
+
|
|
133
|
+
### Basic Example
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
autorel --publish --run 'aws s3 sync dist/ s3://my-bucket/${NEXT_VERSION}/'
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
This will:
|
|
59
140
|
1. Bump the version based on the commit messages since the last release
|
|
60
141
|
2. Create a new release on GitHub with Release Notes
|
|
61
|
-
3. Update package.json and publish the release to
|
|
62
|
-
4.
|
|
142
|
+
3. Update package.json and publish the release to npm (the version change is not committed to the repository—see [About package.json Versions](#about-packagejson-versions) below)
|
|
143
|
+
4. Copy the dist/ directory to an AWS S3 bucket with the new version number
|
|
144
|
+
|
|
145
|
+
### Configuration Options
|
|
146
|
+
|
|
147
|
+
You can configure autorel in two ways, and you can use both together:
|
|
148
|
+
|
|
149
|
+
**1. CLI Arguments** - Pass options directly via command-line flags
|
|
150
|
+
|
|
151
|
+
**2. YAML Configuration File** - Create a `.autorel.yaml` file in your project root
|
|
152
|
+
|
|
153
|
+
**Priority:** CLI arguments override YAML settings. You can set defaults in `.autorel.yaml` and override them with CLI flags when needed.
|
|
63
154
|
|
|
64
|
-
|
|
155
|
+
Create a `.autorel.yaml` file in your project root:
|
|
65
156
|
|
|
66
157
|
```yaml
|
|
67
|
-
#
|
|
158
|
+
# Define the branches and their respective channels
|
|
159
|
+
branches:
|
|
160
|
+
- {name: 'main'}
|
|
161
|
+
- {name: 'next', prereleaseChannel: 'next'}
|
|
162
|
+
|
|
163
|
+
# Enable publishing to npm
|
|
68
164
|
publish: true
|
|
165
|
+
|
|
166
|
+
# Run custom script after publish
|
|
69
167
|
run: |
|
|
70
|
-
echo "
|
|
168
|
+
echo "$(date +"%Y-%m-%d") ${NEXT_VERSION}" >> versions.txt
|
|
169
|
+
aws s3 sync dist/ s3://my-bucket/${NEXT_VERSION}/
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
> **Note:** The YAML file must be named `.autorel.yaml` and placed in the root of your project. CLI arguments override YAML settings. See [Configuration Options](/docs/configuration-options.md) for all available settings.
|
|
173
|
+
|
|
174
|
+
### More Examples
|
|
175
|
+
|
|
176
|
+
Release a specific version regardless of commit messages:
|
|
177
|
+
```bash
|
|
178
|
+
autorel --use-version 2.0.0 --publish
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
Run tests and build before releasing, then deploy to S3 after:
|
|
182
|
+
```bash
|
|
183
|
+
autorel --pre-run 'npm test && npm run build' --publish --run 'aws s3 sync dist/ s3://my-bucket/${NEXT_VERSION}/'
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
Skip GitHub release but publish to npm and build Docker image:
|
|
187
|
+
```bash
|
|
188
|
+
autorel --publish --skip-release --run 'docker build -t myapp:${NEXT_VERSION} .'
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
Enable verbose logging to debug release issues:
|
|
192
|
+
```bash
|
|
193
|
+
autorel --verbose --publish --run 'echo "Published ${NEXT_VERSION}"'
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
## GitHub Actions Setup
|
|
197
|
+
|
|
198
|
+
Autorel works seamlessly with GitHub Actions. Here's a complete workflow example:
|
|
199
|
+
|
|
200
|
+
```yaml
|
|
201
|
+
name: Release
|
|
202
|
+
on:
|
|
203
|
+
push:
|
|
204
|
+
branches: [main, alpha, beta]
|
|
205
|
+
jobs:
|
|
206
|
+
release:
|
|
207
|
+
name: Release
|
|
208
|
+
runs-on: ubuntu-latest
|
|
209
|
+
steps:
|
|
210
|
+
- uses: actions/checkout@v4
|
|
211
|
+
with:
|
|
212
|
+
fetch-depth: 0
|
|
213
|
+
fetch-tags: true
|
|
214
|
+
- uses: actions/setup-node@v4
|
|
215
|
+
with:
|
|
216
|
+
node-version: latest
|
|
217
|
+
registry-url: "https://registry.npmjs.org"
|
|
218
|
+
cache: 'npm'
|
|
219
|
+
- run: npx autorel@^2
|
|
220
|
+
env:
|
|
221
|
+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
|
222
|
+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
|
|
71
223
|
```
|
|
72
224
|
|
|
73
|
-
>
|
|
225
|
+
> ❗️ **Required:** You must set `fetch-depth: 0` and `fetch-tags: true` in `actions/checkout@v4` (or later) or autorel will not work correctly. This ensures autorel can analyze the full git history.
|
|
226
|
+
|
|
227
|
+
> ❗️ **For npm publishing:** You must be authenticated with npm. See the [npm authentication guide](https://docs.github.com/en/actions/guides/publishing-nodejs-packages#publishing-packages-to-the-npm-registry) for setup instructions.
|
|
228
|
+
|
|
229
|
+
**Recommended:** Create a `.autorel.yaml` file in your project root instead of passing CLI arguments. This keeps your workflow file cleaner. See [Configuration Options](/docs/configuration-options.md) for all available settings.
|
|
230
|
+
|
|
231
|
+
## Authentication & Permissions
|
|
232
|
+
|
|
233
|
+
### GitHub Token
|
|
234
|
+
|
|
235
|
+
To create releases on GitHub, autorel needs a GitHub token:
|
|
236
|
+
|
|
237
|
+
- **GitHub Actions:** The `GITHUB_TOKEN` is automatically provided (no setup needed)
|
|
238
|
+
- **Local/Other CI:** Set the `GITHUB_TOKEN` environment variable or use `--github-token` flag
|
|
239
|
+
- **Required scope:** `repo` (to create releases)
|
|
240
|
+
|
|
241
|
+
### npm Token
|
|
242
|
+
|
|
243
|
+
To publish packages to npm, you need authentication:
|
|
244
|
+
|
|
245
|
+
- **Local usage:** Run `npm login`
|
|
246
|
+
- **CI/CD:** Set the `NODE_AUTH_TOKEN` environment variable to your npm token
|
|
247
|
+
- **GitHub Actions:** See the [npm publishing guide](https://docs.github.com/en/actions/guides/publishing-nodejs-packages#publishing-packages-to-the-npm-registry)
|
|
248
|
+
- **Required scope:** `publish` (at minimum)
|
|
249
|
+
|
|
250
|
+
### About package.json Versions
|
|
251
|
+
|
|
252
|
+
When using npm publishing, autorel:
|
|
253
|
+
1. Temporarily updates `package.json` version in memory
|
|
254
|
+
2. Publishes to npm with that version
|
|
255
|
+
3. **Immediately restores** `package.json` to the original version (even if publish fails)
|
|
256
|
+
4. Then runs post-release scripts (`--run`)
|
|
257
|
+
|
|
258
|
+
**Important:** Package.json is restored **before** post-release scripts run. If your post-release script needs the new version in package.json (e.g., for Docker builds), you have two options:
|
|
259
|
+
|
|
260
|
+
**Option 1: Use environment variables** (recommended)
|
|
261
|
+
```bash
|
|
262
|
+
autorel --publish --run 'docker build -t myapp:${NEXT_VERSION} .'
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
**Option 2: Update package.json in your script**
|
|
266
|
+
```bash
|
|
267
|
+
autorel --publish --run 'npm version ${NEXT_VERSION} --no-git-tag-version && docker build -t myapp:${NEXT_VERSION} .'
|
|
268
|
+
```
|
|
74
269
|
|
|
75
|
-
|
|
270
|
+
**Why this approach?**
|
|
271
|
+
- The version in `package.json` is only needed for npm publishing
|
|
272
|
+
- Committing version changes can cause merge conflicts
|
|
273
|
+
- The git tag is the source of truth for your version
|
|
274
|
+
- Package.json is automatically restored, so there's nothing to rollback
|
|
76
275
|
|
|
77
|
-
|
|
276
|
+
The `NEXT_VERSION` and `NEXT_TAG` environment variables are always available in your `--run` scripts.
|
|
78
277
|
|
|
79
278
|
## Commit Messages
|
|
80
279
|
|
|
81
|
-
|
|
280
|
+
Autorel automatically determines version bumps and generates changelogs by parsing your commit messages. Your commits must follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) specification.
|
|
281
|
+
|
|
282
|
+
### Version Bump Examples
|
|
283
|
+
|
|
284
|
+
Here are examples of commit messages and the resulting version bump (using default configuration):
|
|
285
|
+
|
|
286
|
+
- `fix: fix a bug` → `0.0.1` (patch)
|
|
287
|
+
- `feat: add new feature` → `0.1.0` (minor)
|
|
288
|
+
- `feat!: add breaking change` → `1.0.0` (major)
|
|
289
|
+
|
|
290
|
+
### Commit Type Mapping
|
|
291
|
+
|
|
292
|
+
By default, the following commit types trigger releases:
|
|
293
|
+
- `feat`: minor version bump
|
|
294
|
+
- `fix`, `perf`, `revert`: patch version bump
|
|
295
|
+
- `feat!` or any commit with `!`: major version bump (breaking change)
|
|
296
|
+
|
|
297
|
+
Other commit types (like `docs`, `style`, `refactor`, `test`, `build`, `ci`) don't trigger releases but are included in changelogs.
|
|
298
|
+
|
|
299
|
+
See the [default configuration](/src/defaults.ts) for the complete mapping, or customize it in your `.autorel.yaml` file. Learn more about [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/).
|
|
300
|
+
|
|
301
|
+
## Using with Other Platforms
|
|
302
|
+
|
|
303
|
+
### Other Repositories (not GitHub)
|
|
304
|
+
|
|
305
|
+
Autorel is designed to work with any CI/CD system, not just GitHub Actions. You can use it with GitLab, Bitbucket, Jenkins, or any other system that supports running shell commands and meets our [system requirements](#system-requirements).
|
|
306
|
+
|
|
307
|
+
Simply use the `--skip-release` flag (or `skipRelease: true` in YAML) to skip creating a release on GitHub. Then, use the `--run` flag (or `run: string` in YAML) to run any command or script after the version bump with the new version number available as an environment variable (`NEXT_VERSION` or `NEXT_TAG`).
|
|
308
|
+
|
|
309
|
+
Example:
|
|
310
|
+
```bash
|
|
311
|
+
autorel --skip-release --run 'echo "Version ${NEXT_VERSION} released"'
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
If you're interested in contributing built-in support for other systems, please open an issue or PR.
|
|
315
|
+
|
|
316
|
+
### Other Languages (not Node.js)
|
|
317
|
+
|
|
318
|
+
Autorel is designed to work with any language or platform. You can use it with Python, Ruby, Go, Java, or any other language.
|
|
319
|
+
|
|
320
|
+
Simply omit the `--publish` flag (or set `publish: false` in YAML, which is the default) to skip publishing to npm. Then, use the `--run` flag (or `run: string` in YAML) to run any command or script after the version bump.
|
|
321
|
+
|
|
322
|
+
Example:
|
|
323
|
+
```bash
|
|
324
|
+
# Docker build using the version from environment variable
|
|
325
|
+
autorel --run 'docker build -t myapp:${NEXT_VERSION} . && docker push myapp:${NEXT_VERSION}'
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
**Note:** If you're using `--publish`, package.json is restored to the original version before `--run` scripts execute. Use the `NEXT_VERSION` environment variable (as shown above) rather than reading from package.json.
|
|
329
|
+
|
|
330
|
+
If you're interested in contributing built-in support for other package managers, please open an issue or PR.
|
|
331
|
+
|
|
332
|
+
## Using as a Library
|
|
333
|
+
|
|
334
|
+
You can use autorel programmatically in your Node.js projects.
|
|
335
|
+
|
|
336
|
+
### Installation
|
|
337
|
+
|
|
338
|
+
```bash
|
|
339
|
+
npm i autorel
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
### Example Usage
|
|
343
|
+
|
|
344
|
+
```typescript
|
|
345
|
+
import {autorel, defaultConfig} from 'autorel';
|
|
346
|
+
|
|
347
|
+
const autorelConfig = {
|
|
348
|
+
...defaultConfig,
|
|
349
|
+
publish: true,
|
|
350
|
+
};
|
|
351
|
+
|
|
352
|
+
autorel(autorelConfig).then((nextVersion) => {
|
|
353
|
+
console.log(`Next version is ${nextVersion}`); // e.g., "Next version is 1.0.1"
|
|
354
|
+
});
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
### Configuration
|
|
358
|
+
|
|
359
|
+
When used as a library, you pass the configuration directly to the `autorel` function. It will not automatically load any default configuration—you can use the `defaultConfig` object to get the default configuration:
|
|
360
|
+
|
|
361
|
+
```typescript
|
|
362
|
+
import {autorel, defaultConfig} from 'autorel';
|
|
82
363
|
|
|
83
|
-
|
|
364
|
+
autorel(defaultConfig).then((nextVersion) => {
|
|
365
|
+
console.log(`Next version is ${nextVersion}`);
|
|
366
|
+
});
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
### Types
|
|
370
|
+
|
|
371
|
+
TypeScript types are available. You can find the type definitions at [src/index.ts](src/index.ts) or import them directly:
|
|
372
|
+
|
|
373
|
+
```typescript
|
|
374
|
+
import type {Config, CommitType} from 'autorel';
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
### Environment Variables in Scripts
|
|
378
|
+
|
|
379
|
+
The `NEXT_VERSION` and `NEXT_TAG` environment variables are available in:
|
|
380
|
+
- ✅ `run` scripts (after release is complete)
|
|
381
|
+
- ❌ `preRun` scripts (version not yet determined)
|
|
382
|
+
|
|
383
|
+
**Note:** Package.json is restored to the original version before `run` scripts execute. If you need the new version in package.json for your script, use the environment variables or update package.json manually in your script.
|
|
384
|
+
|
|
385
|
+
Example:
|
|
386
|
+
```bash
|
|
387
|
+
# Using environment variable (package.json will have old version)
|
|
388
|
+
autorel --run 'echo "Published ${NEXT_VERSION}" && docker build -t myapp:${NEXT_VERSION} .'
|
|
389
|
+
|
|
390
|
+
# If you need package.json to have the new version:
|
|
391
|
+
autorel --run 'npm version ${NEXT_VERSION} --no-git-tag-version && docker build -t myapp:${NEXT_VERSION} .'
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
## Troubleshooting
|
|
395
|
+
|
|
396
|
+
### "No commits found" or "No release needed"
|
|
397
|
+
|
|
398
|
+
This means autorel analyzed your commits and determined none of them require a release. This is **not an error**—autorel exits successfully.
|
|
399
|
+
|
|
400
|
+
**Common causes:**
|
|
401
|
+
- Only documentation, style, or refactor commits since last release
|
|
402
|
+
- No commits since last release
|
|
403
|
+
- All commits are marked as `release: 'none'` in your configuration
|
|
404
|
+
|
|
405
|
+
**Solution:** Make commits that trigger releases (e.g., `feat:`, `fix:`, or commits with `!` for breaking changes).
|
|
406
|
+
|
|
407
|
+
### Authentication Failed
|
|
408
|
+
|
|
409
|
+
**npm authentication:**
|
|
410
|
+
```bash
|
|
411
|
+
# Test locally
|
|
412
|
+
npm whoami
|
|
413
|
+
# If not logged in:
|
|
414
|
+
npm login
|
|
415
|
+
# Or set token:
|
|
416
|
+
export NODE_AUTH_TOKEN=your_token_here
|
|
417
|
+
```
|
|
418
|
+
|
|
419
|
+
**GitHub authentication:**
|
|
420
|
+
```bash
|
|
421
|
+
# Test token
|
|
422
|
+
export GITHUB_TOKEN=your_token_here
|
|
423
|
+
# Verify it works
|
|
424
|
+
curl -H "Authorization: token $GITHUB_TOKEN" https://api.github.com/user
|
|
425
|
+
```
|
|
426
|
+
|
|
427
|
+
**GitHub Actions:** Make sure `GITHUB_TOKEN` and `NODE_AUTH_TOKEN` are set in your workflow's `env` section.
|
|
428
|
+
|
|
429
|
+
### Tag Already Exists
|
|
430
|
+
|
|
431
|
+
If you see "tag already exists" error:
|
|
432
|
+
- The tag was created but the release failed partway through
|
|
433
|
+
- You may have manually created a tag with the same version
|
|
434
|
+
|
|
435
|
+
**Solution:**
|
|
436
|
+
- Delete the tag: `git tag -d v1.0.0 && git push origin :refs/tags/v1.0.0`
|
|
437
|
+
- Or use a different version: `autorel --use-version 1.0.1`
|
|
438
|
+
|
|
439
|
+
### Release Created But npm Publish Failed
|
|
84
440
|
|
|
85
|
-
|
|
441
|
+
If the GitHub release was created but npm publish failed:
|
|
442
|
+
- The release cannot be automatically rolled back
|
|
443
|
+
- You can manually delete the GitHub release if needed
|
|
444
|
+
- Fix the npm issue and re-run (use `--use-version` to avoid creating a new release)
|
|
86
445
|
|
|
87
|
-
-
|
|
88
|
-
- `feat: add new feature` -> `0.1.0` (minor)
|
|
89
|
-
- `feat!: add breaking change` -> `1.0.0` (major)
|
|
446
|
+
### Pre-run Scripts Not Executing
|
|
90
447
|
|
|
91
|
-
|
|
448
|
+
`preRun` scripts only run if:
|
|
449
|
+
- A release is needed (commits require a release)
|
|
450
|
+
- Not in dry-run mode
|
|
92
451
|
|
|
93
|
-
|
|
452
|
+
If your `preRun` isn't running, check:
|
|
453
|
+
1. Do you have commits that trigger a release?
|
|
454
|
+
2. Are you using `--dry-run`? (preRun doesn't run in dry-run)
|
|
455
|
+
3. Check the logs with `--verbose`
|
|
456
|
+
|
|
457
|
+
### Wrong Version Calculated
|
|
458
|
+
|
|
459
|
+
If autorel calculated the wrong version:
|
|
460
|
+
- Check your commit messages follow Conventional Commits
|
|
461
|
+
- Verify your `commitTypes` configuration (if customized)
|
|
462
|
+
- Use `--dry-run --verbose` to see which commits were analyzed
|
|
463
|
+
- Check the [default configuration](/src/defaults.ts) to understand version bump logic
|
|
464
|
+
|
|
465
|
+
### Testing Locally
|
|
466
|
+
|
|
467
|
+
Always test before running in CI:
|
|
468
|
+
|
|
469
|
+
```bash
|
|
470
|
+
# See what would happen
|
|
471
|
+
npx autorel@^2 --dry-run --verbose
|
|
472
|
+
|
|
473
|
+
# Test with a specific version
|
|
474
|
+
npx autorel@^2 --dry-run --use-version 1.0.0 --verbose
|
|
475
|
+
|
|
476
|
+
# Test authentication
|
|
477
|
+
npm whoami # for npm
|
|
478
|
+
export GITHUB_TOKEN=your_token && npx autorel@^2 --dry-run # for GitHub
|
|
479
|
+
```
|
|
94
480
|
|
|
95
481
|
## System Requirements
|
|
96
482
|
|
package/dist/cli.js
CHANGED
|
@@ -19,12 +19,12 @@ console.log('------------------------------');
|
|
|
19
19
|
program
|
|
20
20
|
.name('autorel')
|
|
21
21
|
.version(packageJson.version, '-v, --version')
|
|
22
|
-
.description('
|
|
22
|
+
.description('Automate releases based on Conventional Commits')
|
|
23
23
|
.option('--dry-run', 'Do a dry run (arg: dryRun)')
|
|
24
24
|
.option('--pre-release <value>', 'Pre-release channel. If specified, the release will be marked as a pre-release. Overrides branches configuration. (arg: preRelease)')
|
|
25
25
|
.option('--use-version <value>', 'Specify a version to be used instead of calculating it from commit analysis. Must be a valid SemVer version, with no \'v\'. Overrides --pre-release, commitType, and branches configuration. (arg: useVersion)')
|
|
26
26
|
.option('--run <value>', 'Command to run after the release is successful. (arg: run)')
|
|
27
|
-
.option('--pre-run <value>', 'Command to run
|
|
27
|
+
.option('--pre-run <value>', 'Command to run before the release (after version is determined). Useful for tests and builds. (arg: preRun)')
|
|
28
28
|
.option('--publish', 'Publish the package to npm, requires npm already set up and authenticated. (arg: publish)')
|
|
29
29
|
.option('--github-token <value>', 'GitHub token to use for creating the release. By default, we use GITHUB_TOKEN environment variable (arg: githubToken)')
|
|
30
30
|
.option('--skip-release', 'Skips creating a release on GitHub. (arg: skipRelease)')
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;;;AAAA,yCAAkC;AAClC,yCAA4C;AAC5C,wBAA0B;AAC1B,qCAAmC;AACnC,+DAAuC;AACvC,8DAAyD;AACzD,uFAAkF;AAElF,qGAAqG;AACrG,MAAM,WAAW,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAC/C,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AAE9B,OAAO,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAC;AAC9C,OAAO,CAAC,GAAG,CAAC,MAAM,IAAA,gBAAI,EAAC,IAAA,iBAAK,EAAC,SAAS,CAAC,CAAC,IAAI,IAAA,gBAAI,EAAC,IAAI,WAAW,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC;AAC/E,OAAO,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAC;AAE9C,OAAO;KACF,IAAI,CAAC,SAAS,CAAC;KACf,OAAO,CAAC,WAAW,CAAC,OAAO,EAAE,eAAe,CAAC;KAC7C,WAAW,CAAC,
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;;;AAAA,yCAAkC;AAClC,yCAA4C;AAC5C,wBAA0B;AAC1B,qCAAmC;AACnC,+DAAuC;AACvC,8DAAyD;AACzD,uFAAkF;AAElF,qGAAqG;AACrG,MAAM,WAAW,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAC/C,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AAE9B,OAAO,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAC;AAC9C,OAAO,CAAC,GAAG,CAAC,MAAM,IAAA,gBAAI,EAAC,IAAA,iBAAK,EAAC,SAAS,CAAC,CAAC,IAAI,IAAA,gBAAI,EAAC,IAAI,WAAW,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC;AAC/E,OAAO,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAC;AAE9C,OAAO;KACF,IAAI,CAAC,SAAS,CAAC;KACf,OAAO,CAAC,WAAW,CAAC,OAAO,EAAE,eAAe,CAAC;KAC7C,WAAW,CAAC,iDAAiD,CAAC;KAC9D,MAAM,CAAC,WAAW,EAAE,4BAA4B,CAAC;KACjD,MAAM,CAAC,uBAAuB,EAAE,qIAAqI,CAAC;KACtK,MAAM,CAAC,uBAAuB,EAAE,gNAAgN,CAAC;KACjP,MAAM,CAAC,eAAe,EAAE,4DAA4D,CAAC;KACrF,MAAM,CAAC,mBAAmB,EAAE,6GAA6G,CAAC;KAC1I,MAAM,CAAC,WAAW,EAAE,2FAA2F,CAAC;KAChH,MAAM,CAAC,wBAAwB,EAAE,uHAAuH,CAAC;KACzJ,MAAM,CAAC,gBAAgB,EAAE,wDAAwD,CAAC;KAClF,MAAM,CAAC,WAAW,EAAE,sCAAsC,CAAC;KAC3D,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAEzB,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;AAE/B,yCAAyC;AACzC,IAAI,OAAO,EAAE;IAET,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC;IAClC,aAAa;IACb,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,OAAO,OAAO,CAAC,GAAG,CAAC,CACvC,CAAC,CAAC;CAEN;AAED,MAAM,MAAM,GAAG,IAAA,kBAAS,EAAC,OAAO,CAAC,CAAC;AAElC,IAAA,UAAO,EAAC,MAAM,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IAE1B,gBAAM,CAAC,KAAK,CAAC,oBAAoB,IAAA,6CAAqB,EAAC,IAAA,+BAAc,EAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC;IAC/E,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAEpB,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "autorel",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.5",
|
|
4
4
|
"description": "Automate semantic releases based on conventional commits. Similar to semantic-release but much simpler.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Marc H. Weiner <mhweiner234@gmail.com> (https://mhweiner.com)",
|