autorel 2.5.2 → 2.5.4
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 +39 -269
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -41,19 +41,20 @@ Use Autorel to save time, prevent broken releases, and ship with confidence.
|
|
|
41
41
|
## Table of Contents
|
|
42
42
|
|
|
43
43
|
- [Example Usage (CLI)](#example-usage-cli)
|
|
44
|
-
- [Example Usage (Library)](
|
|
45
|
-
- [
|
|
46
|
-
- [Commit Messages](#commit-messages)
|
|
44
|
+
- [Example Usage (Library)](docs/usage-library.md)
|
|
45
|
+
- [Configuring GitHub Permissions](#configuring-github-permissions)
|
|
47
46
|
- [Usage with GitHub Actions](#usage-with-github-actions)
|
|
47
|
+
- [Commit Messages](#commit-messages)
|
|
48
48
|
- [Usage with Other Repositories (not GitHub)](#usage-with-other-repositories-not-github)
|
|
49
49
|
- [Usage with Other Languages (not Node.js)](#usage-with-other-languages-not-nodejs)
|
|
50
|
-
- [Configuration](
|
|
51
|
-
- [Sample YAML Configuration](#sample-yaml-configuration)
|
|
50
|
+
- [Configuration](docs/configuration.md)
|
|
51
|
+
- [Sample YAML Configuration](docs/configuration.md#sample-yaml-configuration)
|
|
52
52
|
- [Types](#types)
|
|
53
|
-
- [
|
|
53
|
+
- [Verbose Mode](#verbose-mode)
|
|
54
54
|
- [About package.json versions](#about-packagejson-versions)
|
|
55
55
|
- [FAQ](docs/faq.md)
|
|
56
|
-
- [
|
|
56
|
+
- [System Requirements](#system-requirements)
|
|
57
|
+
- [Contributing](#contributing)
|
|
57
58
|
- [License](#license)
|
|
58
59
|
|
|
59
60
|
## Example Usage (CLI)
|
|
@@ -76,40 +77,23 @@ npm i -g autorel
|
|
|
76
77
|
autorel --publish
|
|
77
78
|
```
|
|
78
79
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
If using the `npx` command, you may want to append the version number to prevent breaking changes in the future. You can do this by appending `@^` followed by the major version number, ie. `npx autorel@^2`.
|
|
80
|
+
> ⚠️ If using the `npx` command, you may want to append the version number to prevent breaking changes in the future. You can do this by appending `@^` followed by the major version number, ie. `npx autorel@^2`.
|
|
82
81
|
|
|
83
82
|
## Example Usage (Library)
|
|
84
83
|
|
|
85
|
-
|
|
84
|
+
See [Using `autorel` as a library](/docs/usage-library.md)
|
|
86
85
|
|
|
87
|
-
|
|
88
|
-
npm i autorel
|
|
89
|
-
```
|
|
86
|
+
## Configuring GitHub Permissions
|
|
90
87
|
|
|
91
|
-
|
|
88
|
+
In order for `autorel` to create releases and publish to GitHub's npm registry, you'll need to make sure you have the appropriate access/permissions.
|
|
92
89
|
|
|
93
|
-
|
|
94
|
-
import {autorel, defaultConfig} from 'autorel';
|
|
90
|
+
If you're using GitHub Actions, see [Using `autorel` with GitHub Actions](/docs/github-actions.md#permissions) for more information.
|
|
95
91
|
|
|
96
|
-
|
|
97
|
-
...defaultConfig,
|
|
98
|
-
publish: true,
|
|
99
|
-
};
|
|
92
|
+
If you're running it locally (or using a different CI/CD system), you can pass your [GitHub Personal Access Token (PAT)](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token) either by setting the `GITHUB_TOKEN` environment variable or by passing the `--github-token (githubToken: string)` flag.
|
|
100
93
|
|
|
101
|
-
|
|
102
|
-
console.log(`Next version is ${nextVersion}`); // ie, "Next version is 1.0.1"
|
|
103
|
-
});
|
|
104
|
-
```
|
|
94
|
+
## Usage with GitHub Actions
|
|
105
95
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
- Linux or MacOS (Windows is not officially supported)
|
|
109
|
-
- Node.js 14+
|
|
110
|
-
- NPM 7+
|
|
111
|
-
- Git 2.13+
|
|
112
|
-
- Bash
|
|
96
|
+
Autorel 💜 GitHub Actions. See [Using `autorel` with GitHub Actions](/docs/github-actions.md)
|
|
113
97
|
|
|
114
98
|
## Commit Messages
|
|
115
99
|
|
|
@@ -123,265 +107,51 @@ Here are some examples of commit messages and the resulting [SemVer](https://sem
|
|
|
123
107
|
|
|
124
108
|
You can find more examples in the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) documentation.
|
|
125
109
|
|
|
126
|
-
## Usage with GitHub Actions
|
|
127
|
-
|
|
128
|
-
You can use `autorel` with GitHub Actions to automate your releases (recommended).
|
|
129
|
-
|
|
130
|
-
> ❗️ You must set `fetch-depth: 0` and `fetch-tags: true` in `actions/checkout@v4` (or later) or autorel will not work correctly.
|
|
131
|
-
|
|
132
|
-
> ❗️ You must be authenticated with NPM to publish. To do so via GitHub Actions, see [this](https://docs.github.com/en/actions/guides/publishing-nodejs-packages#publishing-packages-to-the-npm-registry).
|
|
133
|
-
|
|
134
|
-
Here is a sample configuration:
|
|
135
|
-
|
|
136
|
-
```yaml
|
|
137
|
-
name: Release
|
|
138
|
-
on:
|
|
139
|
-
push:
|
|
140
|
-
branches: [main, alpha, beta]
|
|
141
|
-
jobs:
|
|
142
|
-
release:
|
|
143
|
-
name: Release
|
|
144
|
-
runs-on: ubuntu-latest
|
|
145
|
-
steps:
|
|
146
|
-
- uses: actions/checkout@v4
|
|
147
|
-
with:
|
|
148
|
-
fetch-depth: 0
|
|
149
|
-
fetch-tags: true
|
|
150
|
-
- uses: actions/setup-node@v4
|
|
151
|
-
with:
|
|
152
|
-
node-version: latest
|
|
153
|
-
registry-url: "https://registry.npmjs.org"
|
|
154
|
-
cache: 'npm'
|
|
155
|
-
- run: npx autorel@^2
|
|
156
|
-
env:
|
|
157
|
-
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
|
158
|
-
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
|
|
159
|
-
```
|
|
160
|
-
|
|
161
|
-
It's also recommended you create a `.autorel.yaml` file in the root of your project to [configure](#configuration) `autorel`.
|
|
162
|
-
|
|
163
|
-
## Usage with Other Repositories (not GitHub)
|
|
164
|
-
|
|
165
|
-
`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.
|
|
166
|
-
|
|
167
|
-
Simply use the `--skip-release` flag (arg: `skipRelease: true`) to skip creating a release on GitHub. Then, you can use the `--run` flag (arg: `run: string`) to run any command or script after the version bump with the new version number available as an environment variable [see below](#run).
|
|
168
|
-
|
|
169
|
-
If you're interested in contributing built-in support for other systems, please open an issue or PR.
|
|
170
|
-
|
|
171
|
-
## Usage with Other Languages (not Node.js)
|
|
172
|
-
|
|
173
|
-
`autorel` is designed to work with any language or platform. You can use it with Python, Ruby, Go, Java, or any other language.
|
|
174
|
-
|
|
175
|
-
Simply omit the `--publish` flag (arg: `publish: false`, which is default) to skip publishing to NPM. Then, you can use either the `--run` flag (arg: `run: string`) or `runScript: string` arg to run any command or script after the version bump with the new version number available as an environment variable [see below](#run).
|
|
176
|
-
|
|
177
|
-
If you're interested in contributing built-in support for other systems, please open an issue or PR.
|
|
178
|
-
|
|
179
110
|
## Configuration
|
|
180
111
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
However, omitting optional binary flags, such as the `--publish`, `--dry-run`, `--skip-release`, and `--verbose` flags will still publish to NPM if set in the `yaml` file.
|
|
184
|
-
|
|
185
|
-
When used as a library, you pass the configuration directly to the `autorel` function. When used this way, it will not automatically load any default configuration—you can use the `defaultConfig` object to get the default configuration:
|
|
186
|
-
|
|
187
|
-
```typescript
|
|
188
|
-
import {autorel, defaultConfig} from 'autorel';
|
|
189
|
-
|
|
190
|
-
const autorelConfig = {
|
|
191
|
-
...defaultConfig,
|
|
192
|
-
publish: true,
|
|
193
|
-
};
|
|
194
|
-
```
|
|
195
|
-
|
|
196
|
-
> ❗️ The `yaml` configuration file must be named `.autorel.yaml` and be in the root of your project.
|
|
197
|
-
|
|
198
|
-
[See sample YAML configuration](#sample-yaml-configuration)
|
|
199
|
-
|
|
200
|
-
### publish
|
|
201
|
-
|
|
202
|
-
Whether to publish the release to NPM. If `true`, you must be authenticated with NPM. To do so via GitHub Actions, see [this](https://docs.github.com/en/actions/guides/publishing-nodejs-packages#publishing-packages-to-the-npm-registry).
|
|
203
|
-
|
|
204
|
-
- CLI: `--publish`
|
|
205
|
-
- Argument: `publish: boolean`
|
|
206
|
-
- Default: `false`
|
|
207
|
-
|
|
208
|
-
### dryRun
|
|
209
|
-
|
|
210
|
-
Whether to run in dry-run mode. This will not push the tag, create the release, publish to NPM, or run the command.
|
|
112
|
+
See [Configuration](docs/configuration.md) for reference and examples.
|
|
211
113
|
|
|
212
|
-
|
|
213
|
-
- Argument: `dryRun: boolean`
|
|
214
|
-
- Default: `false`
|
|
215
|
-
|
|
216
|
-
### verbose
|
|
217
|
-
|
|
218
|
-
Whether to run in verbose mode. This will output more information about the release process.
|
|
219
|
-
|
|
220
|
-
- CLI: `--verbose`
|
|
221
|
-
- Argument: `verbose: boolean`
|
|
222
|
-
- Default: `false`
|
|
223
|
-
|
|
224
|
-
### skipRelease
|
|
225
|
-
|
|
226
|
-
Whether to skip creating a release on GitHub. If `true`, the release will not be created, but the tag will still be pushed and the package on npm will still be updated, if applicable.
|
|
227
|
-
|
|
228
|
-
- CLI: `--skip-release`
|
|
229
|
-
- Argument: `skipRelease: boolean`
|
|
230
|
-
- Default: `false`
|
|
231
|
-
|
|
232
|
-
### run
|
|
233
|
-
|
|
234
|
-
A `bash` command/script to run after the release is complete. All scripts are run in "-e" mode, meaning they will exit on the first error.
|
|
114
|
+
## Types
|
|
235
115
|
|
|
236
|
-
|
|
116
|
+
You can find the types defined at [src/index.ts](src/index.ts).
|
|
237
117
|
|
|
238
|
-
|
|
239
|
-
| --- | --- |
|
|
240
|
-
| `NEXT_VERSION` | The new version number (without the `v`) |
|
|
241
|
-
| `NEXT_TAG` | The new tag, ie. v3.1.0 |
|
|
118
|
+
## Verbose Mode
|
|
242
119
|
|
|
243
|
-
|
|
120
|
+
To enable verbose mode, set `--verbose (verbose: true)` or environment variable `AUTOREL_DEBUG=1`:
|
|
244
121
|
|
|
245
122
|
```bash
|
|
246
|
-
npx autorel --
|
|
123
|
+
npx autorel --verbose
|
|
247
124
|
```
|
|
248
125
|
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
```yaml
|
|
252
|
-
run: echo "Next version is ${NEXT_VERSION}"
|
|
253
|
-
```
|
|
254
|
-
|
|
255
|
-
You can use the multi-line string syntax in YAML to write a script:
|
|
256
|
-
|
|
257
|
-
```yaml
|
|
258
|
-
run: |
|
|
259
|
-
echo "$(date +"%Y-%m-%d") ${NEXT_VERSION}" >> versions.txt
|
|
260
|
-
aws s3 sync . s3://my-bucket
|
|
261
|
-
```
|
|
262
|
-
|
|
263
|
-
- CLI: `--run`
|
|
264
|
-
- Argument: `run: string`
|
|
265
|
-
- Default: `undefined`
|
|
266
|
-
|
|
267
|
-
### preRun
|
|
268
|
-
|
|
269
|
-
A `bash` command/script to run before the release is started. All scripts are run in "-e" mode, meaning they will exit on the first error. Here's where you can do things like run tests or do build steps.
|
|
270
|
-
|
|
271
|
-
This could save you time and money by not running unnecessary steps in your CI/CD pipeline. It will not run if no release is determined to be necessary, and it will not run in dry-run mode.
|
|
272
|
-
|
|
273
|
-
This is run *after* determining the new version number but *before* pushing tags, creating the release on GitHub, updating the package.json, or publishing to NPM.
|
|
274
|
-
|
|
275
|
-
Example YAML usage:
|
|
276
|
-
|
|
277
|
-
```yaml
|
|
278
|
-
preRun: |
|
|
279
|
-
npm ci
|
|
280
|
-
npm run build
|
|
281
|
-
npm run test
|
|
282
|
-
npm run lint
|
|
283
|
-
```
|
|
284
|
-
|
|
285
|
-
- CLI: `--pre-run`
|
|
286
|
-
- Argument: `preRun: string`
|
|
287
|
-
- Default: `undefined`
|
|
288
|
-
|
|
289
|
-
### preRelease
|
|
290
|
-
|
|
291
|
-
> ❗️ This is typically set via the `branches` configuration (recommended), but can be overridden here.
|
|
292
|
-
|
|
293
|
-
The pre-release channel to use. This will be appended to the version number. For example, if the version is `1.0.0` and the pre-release is `alpha`, the version will be `1.0.0-alpha.1`. For "production" releases, the "latest" tag will be used for NPM.
|
|
294
|
-
|
|
295
|
-
- CLI: `--pre-release`
|
|
296
|
-
- Argument: `preRelease: string`
|
|
297
|
-
- Default: `undefined`
|
|
298
|
-
|
|
299
|
-
### breakingChangeTitle (YAML/library only)
|
|
300
|
-
|
|
301
|
-
The title to use for the breaking changes section in the release notes.
|
|
302
|
-
|
|
303
|
-
- Argument: `breakingChangeTitle: string`
|
|
304
|
-
- Default: `"🚨 Breaking Changes 🚨"`
|
|
305
|
-
|
|
306
|
-
### commitTypes (YAML/library only)
|
|
307
|
-
|
|
308
|
-
The commit types to use for both the release notes and version bumping.
|
|
309
|
-
|
|
310
|
-
- Argument: `commitTypes: CommitType[]`
|
|
311
|
-
- Defaults: [src/defaults.ts](src/defaults.ts)
|
|
312
|
-
|
|
313
|
-
### branches (YAML/library only)
|
|
314
|
-
|
|
315
|
-
The branches to use for the release along with their pre-release channel. If not provided, the default is:
|
|
316
|
-
|
|
317
|
-
```yaml
|
|
318
|
-
- {name: 'main'}
|
|
319
|
-
```
|
|
320
|
-
|
|
321
|
-
The above will release to the `latest` channel on NPM. If you want to release to a different channel (making it a pre-release), you can specify it like so:
|
|
322
|
-
|
|
323
|
-
```yaml
|
|
324
|
-
branches:
|
|
325
|
-
- {name: 'main'}
|
|
326
|
-
- {name: 'develop', prereleaseChannel: 'alpha'}
|
|
327
|
-
- {name: 'staging', prereleaseChannel: 'beta'}
|
|
328
|
-
```
|
|
329
|
-
|
|
330
|
-
The above will release to the `latest` channel (production) on NPM for the `main` branch, the `alpha` pre-release channel for the `develop` branch, and the `beta` pre-release channel for the `staging` branch.
|
|
331
|
-
|
|
332
|
-
- Argument: `branches: ReleaseBranch[]`
|
|
333
|
-
|
|
334
|
-
### useVersion
|
|
335
|
-
|
|
336
|
-
The version to use for the release INSTEAD of the version being generated. Always results in a release being created unless `noRelease` is `true`. **Advanced usage only, not recommended for most users.**
|
|
337
|
-
|
|
338
|
-
- CLI: `--use-version`
|
|
339
|
-
- Argument: `useVersion: string`
|
|
340
|
-
- Default: `undefined`
|
|
341
|
-
|
|
342
|
-
> ❗️ Must be a valid SemVer version, without the `v`.
|
|
343
|
-
|
|
344
|
-
### githubToken
|
|
345
|
-
|
|
346
|
-
The GitHub token to use for creating the release. If not provided, it will use the `GITHUB_TOKEN` environment variable. This is only used if `skipRelease` is `false`.
|
|
347
|
-
|
|
348
|
-
## Sample YAML Configuration
|
|
126
|
+
## About package.json versions
|
|
349
127
|
|
|
350
|
-
|
|
351
|
-
```yaml
|
|
352
|
-
# Define the branches and their respective channels
|
|
353
|
-
branches:
|
|
354
|
-
- {name: 'main'}
|
|
355
|
-
- {name: 'next', prereleaseChannel: 'next'}
|
|
128
|
+
If using our npm publishing feature, the package.json file's version will be updated in memory before being pushed to npm, as this is the only place where it's actually required. The change will not be pushed to the repository, as it is not necessary and could cause conflicts. See [this post](https://semantic-release.gitbook.io/semantic-release/support/faq)
|
|
356
129
|
|
|
357
|
-
|
|
358
|
-
publish: true
|
|
130
|
+
If you need access to the new version number in your CI/CD pipeline, you can use the `NEXT_VERSION` or `NEXT_TAG` environment variables.
|
|
359
131
|
|
|
360
|
-
|
|
361
|
-
run: |
|
|
362
|
-
echo "$(date +"%Y-%m-%d") ${NEXT_VERSION}" >> versions.txt
|
|
363
|
-
aws s3 sync . s3://my-bucket
|
|
364
|
-
```
|
|
132
|
+
## Usage with Other Repositories (not GitHub)
|
|
365
133
|
|
|
366
|
-
|
|
134
|
+
`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.
|
|
367
135
|
|
|
368
|
-
|
|
136
|
+
Simply use the `--skip-release` flag (arg: `skipRelease: true`) to skip creating a release on GitHub. Then, you can use the `--run` flag (arg: `run: string`) to run any command or script after the version bump with the new version number available as an environment variable [see below](#run).
|
|
369
137
|
|
|
370
|
-
|
|
138
|
+
If you're interested in contributing built-in support for other systems, please open an issue or PR.
|
|
371
139
|
|
|
372
|
-
|
|
140
|
+
## Usage with Other Languages (not Node.js)
|
|
373
141
|
|
|
374
|
-
|
|
375
|
-
AUTOREL_DEBUG=1 npx autorel
|
|
376
|
-
```
|
|
142
|
+
`autorel` is designed to work with any language or platform. You can use it with Python, Ruby, Go, Java, or any other language.
|
|
377
143
|
|
|
378
|
-
|
|
144
|
+
Simply omit the `--publish` flag (arg: `publish: false`, which is default) to skip publishing to NPM. Then, you can use either the `--run` flag (arg: `run: string`) or `runScript: string` arg to run any command or script after the version bump with the new version number available as an environment variable [see below](#run).
|
|
379
145
|
|
|
380
|
-
|
|
146
|
+
If you're interested in contributing built-in support for other systems, please open an issue or PR.
|
|
381
147
|
|
|
382
|
-
|
|
148
|
+
## System Requirements
|
|
383
149
|
|
|
384
|
-
|
|
150
|
+
- Linux or MacOS (Windows is not officially supported)
|
|
151
|
+
- Node.js 14+
|
|
152
|
+
- npm 7+
|
|
153
|
+
- Git 2.13+
|
|
154
|
+
- Bash
|
|
385
155
|
|
|
386
156
|
## Contributing
|
|
387
157
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "autorel",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.4",
|
|
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)",
|