autorel 2.2.7 → 2.2.8-next.3
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 +62 -37
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +2 -0
- package/dist/config.js +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +15 -3
- package/dist/lib/sh.d.ts +14 -1
- package/dist/lib/sh.js +17 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -41,6 +41,7 @@ _Currently only has built-in support for `GitHub` and `NPM`, but you can write y
|
|
|
41
41
|
|
|
42
42
|
- [Example Usage (CLI)](#example-usage-cli)
|
|
43
43
|
- [Example Usage (Library)](#example-usage-library)
|
|
44
|
+
- [System Requirements](#system-requirements)
|
|
44
45
|
- [Commit Messages](#commit-messages)
|
|
45
46
|
- [Usage with GitHub Actions](#usage-with-github-actions)
|
|
46
47
|
- [Usage with Other Repositories (not GitHub)](#usage-with-other-repositories-not-github)
|
|
@@ -98,6 +99,14 @@ Example: `npx autorel@^2`
|
|
|
98
99
|
});
|
|
99
100
|
```
|
|
100
101
|
|
|
102
|
+
# System Requirements
|
|
103
|
+
|
|
104
|
+
- Linux or MacOS (Windows is not officially supported)
|
|
105
|
+
- Node.js 14+
|
|
106
|
+
- NPM 7+
|
|
107
|
+
- Git 2.13+
|
|
108
|
+
- Bash
|
|
109
|
+
|
|
101
110
|
# Commit Messages
|
|
102
111
|
|
|
103
112
|
Commit messages are parsed to determine the version bump. They must follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) standard specification.
|
|
@@ -139,15 +148,7 @@ jobs:
|
|
|
139
148
|
node-version: latest
|
|
140
149
|
registry-url: "https://registry.npmjs.org"
|
|
141
150
|
cache: 'npm'
|
|
142
|
-
-
|
|
143
|
-
id: cache-node-modules
|
|
144
|
-
with:
|
|
145
|
-
path: node_modules
|
|
146
|
-
key: ${{runner.os}}-node-${{hashFiles('package-lock.json')}}
|
|
147
|
-
- run: npm ci
|
|
148
|
-
- run: npm run lint
|
|
149
|
-
- run: npm run test
|
|
150
|
-
- run: npx autorel --publish
|
|
151
|
+
- run: npx autorel@^2
|
|
151
152
|
env:
|
|
152
153
|
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
|
153
154
|
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
|
|
@@ -159,7 +160,7 @@ It's also recommended you create a `.autorel.yaml` file in the root of your proj
|
|
|
159
160
|
|
|
160
161
|
`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.
|
|
161
162
|
|
|
162
|
-
Simply use the `--skip-release` flag (arg: `skipRelease: true`) to skip creating a release on GitHub. Then, you can use
|
|
163
|
+
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).
|
|
163
164
|
|
|
164
165
|
If you're interested in contributing built-in support for other systems, please open an issue or PR.
|
|
165
166
|
|
|
@@ -177,9 +178,9 @@ When run in CLI mode, `autorel` can be configured via CLI arguments or a `yaml`
|
|
|
177
178
|
|
|
178
179
|
However, omitting the `--publish` flag will still publish to NPM if `publish: true` is set in the `yaml` file, and the same for other binary flags.
|
|
179
180
|
|
|
180
|
-
When used as a library, you
|
|
181
|
+
When used as a library, you pass the configuration directly to the `autorel` function.
|
|
181
182
|
|
|
182
|
-
All arguments are optional
|
|
183
|
+
All arguments are optional.
|
|
183
184
|
|
|
184
185
|
> ❗️ The `yaml` configuration file must be named `.autorel.yaml` and be in the root of your project.
|
|
185
186
|
|
|
@@ -211,32 +212,59 @@ Whether to skip creating a release on GitHub. If `true`, the release will not be
|
|
|
211
212
|
|
|
212
213
|
## run
|
|
213
214
|
|
|
214
|
-
A command to run after the release is complete.
|
|
215
|
+
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.
|
|
216
|
+
|
|
217
|
+
The following environment variables are available:
|
|
215
218
|
|
|
216
219
|
| Variable | Description |
|
|
217
220
|
| --- | --- |
|
|
218
221
|
| `NEXT_VERSION` | The new version number (without the `v`) |
|
|
219
222
|
| `NEXT_TAG` | The new tag, ie. v3.1.0 |
|
|
220
223
|
|
|
224
|
+
Example CLI usage:
|
|
225
|
+
|
|
226
|
+
```bash
|
|
227
|
+
npx autorel --run 'echo "Next version is ${NEXT_VERSION}"'
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
Example YAML usage:
|
|
231
|
+
|
|
232
|
+
```yaml
|
|
233
|
+
run: echo "Next version is ${NEXT_VERSION}"
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
You can use the multi-line string syntax in YAML to write a script:
|
|
237
|
+
|
|
238
|
+
```yaml
|
|
239
|
+
run: |
|
|
240
|
+
echo "$(date +"%Y-%m-%d") ${NEXT_VERSION}" >> versions.txt
|
|
241
|
+
aws s3 sync . s3://my-bucket
|
|
242
|
+
```
|
|
243
|
+
|
|
221
244
|
- CLI: `--run`
|
|
222
245
|
- Argument: `run: string`
|
|
223
246
|
- Default: `undefined`
|
|
224
247
|
|
|
225
|
-
##
|
|
248
|
+
## preRun
|
|
226
249
|
|
|
227
|
-
A bash script to run
|
|
250
|
+
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.
|
|
228
251
|
|
|
229
|
-
|
|
252
|
+
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.
|
|
230
253
|
|
|
231
|
-
|
|
254
|
+
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.
|
|
255
|
+
|
|
256
|
+
Example YAML usage:
|
|
232
257
|
|
|
233
258
|
```yaml
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
259
|
+
preRun: |
|
|
260
|
+
npm ci
|
|
261
|
+
npm run build
|
|
262
|
+
npm run test
|
|
263
|
+
npm run lint
|
|
237
264
|
```
|
|
238
265
|
|
|
239
|
-
-
|
|
266
|
+
- CLI: `--pre-run`
|
|
267
|
+
- Argument: `preRun: string`
|
|
240
268
|
- Default: `undefined`
|
|
241
269
|
|
|
242
270
|
## preRelease
|
|
@@ -249,20 +277,21 @@ The pre-release channel to use. This will be appended to the version number. For
|
|
|
249
277
|
- Argument: `preRelease: string`
|
|
250
278
|
- Default: `undefined`
|
|
251
279
|
|
|
252
|
-
## breakingChangeTitle (YAML only)
|
|
280
|
+
## breakingChangeTitle (YAML/library only)
|
|
253
281
|
|
|
254
282
|
The title to use for the breaking changes section in the release notes.
|
|
255
283
|
|
|
256
284
|
- Argument: `breakingChangeTitle: string`
|
|
257
285
|
- Default: `"🚨 Breaking Changes 🚨"`
|
|
258
286
|
|
|
259
|
-
## commitTypes (YAML only)
|
|
287
|
+
## commitTypes (YAML/library only)
|
|
260
288
|
|
|
261
|
-
The commit types to use for both the release notes and version bumping.
|
|
289
|
+
The commit types to use for both the release notes and version bumping.
|
|
262
290
|
|
|
263
291
|
- Argument: `commitTypes: CommitType[]`
|
|
292
|
+
- Defaults: [src/defaults.ts](src/defaults.ts)
|
|
264
293
|
|
|
265
|
-
## branches (YAML only)
|
|
294
|
+
## branches (YAML/library only)
|
|
266
295
|
|
|
267
296
|
The branches to use for the release along with their pre-release channel. If not provided, the default is:
|
|
268
297
|
|
|
@@ -306,7 +335,7 @@ branches:
|
|
|
306
335
|
publish: true
|
|
307
336
|
|
|
308
337
|
# Run custom script after publish
|
|
309
|
-
|
|
338
|
+
run: |
|
|
310
339
|
echo "$(date +"%Y-%m-%d") ${NEXT_VERSION}" >> versions.txt
|
|
311
340
|
aws s3 sync . s3://my-bucket
|
|
312
341
|
```
|
|
@@ -329,11 +358,12 @@ This will output configuration and other debug information.
|
|
|
329
358
|
|
|
330
359
|
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)
|
|
331
360
|
|
|
332
|
-
|
|
361
|
+
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.
|
|
362
|
+
|
|
363
|
+
# Support & Feedback
|
|
333
364
|
|
|
334
365
|
- Star this repo if you like it!
|
|
335
366
|
- Submit an [issue](https://github.com/mhweiner/autorel/issues) with your problem, feature request or bug report
|
|
336
|
-
- Issue a PR against `main` and request review. Make sure all tests pass and coverage is good.
|
|
337
367
|
- Write about `autorel` in your blog, tweet about it, or share it with your friends!
|
|
338
368
|
- Support this package by adding our badge to your README:
|
|
339
369
|
|
|
@@ -341,18 +371,13 @@ If using our npm publishing feature, the package.json file's version will be upd
|
|
|
341
371
|
[](https://github.com/mhweiner/autorel)
|
|
342
372
|
```
|
|
343
373
|
|
|
374
|
+
# Contributors & Maintainers Wanted!
|
|
375
|
+
|
|
376
|
+
We are looking for contributors and maintainers to help with the project. If you are interested, please open an issue or PR. Together we can help bring automated releases to everyone!
|
|
377
|
+
|
|
344
378
|
## License
|
|
345
379
|
|
|
346
380
|
MIT © Marc H. Weiner
|
|
347
381
|
|
|
348
382
|
[See full license](LICENSE)
|
|
349
383
|
|
|
350
|
-
## Sponsors
|
|
351
|
-
|
|
352
|
-
<picture>
|
|
353
|
-
<source srcset="docs/aeroview-logo-lockup.svg" media="(prefers-color-scheme: dark)">
|
|
354
|
-
<source srcset="docs/aeroview-logo-lockup-dark.svg" media="(prefers-color-scheme: light)">
|
|
355
|
-
<img src="docs/aeroview-logo-lockup-dark.svg" alt="Logo" style="max-width: 150px;margin: 0 0 10px">
|
|
356
|
-
</picture>
|
|
357
|
-
|
|
358
|
-
Aeroview is a developer-friendly, AI-powered observability platform that helps you monitor, troubleshoot, and optimize your applications. Get started for free at [https://aeroview.io](https://aeroview.io).
|
package/dist/cli.d.ts
CHANGED
package/dist/cli.js
CHANGED
|
@@ -21,6 +21,7 @@ program
|
|
|
21
21
|
.option('--pre-release <value>', 'Pre-release channel. If specified, the release will be marked as a pre-release. Overrides branches configuration. (arg: preRelease)')
|
|
22
22
|
.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)')
|
|
23
23
|
.option('--run <value>', 'Command to run after the release is successful. (arg: run)')
|
|
24
|
+
.option('--pre-run <value>', 'Command to run after the release is successful. (arg: preRun)')
|
|
24
25
|
.option('--skip-release', 'Skips creating a release on GitHub. (arg: skipRelease)')
|
|
25
26
|
.option('--publish', 'Publish the package to npm, requires passing --npm-token or NPM_TOKEN environment variable. (arg: publish)')
|
|
26
27
|
.parse(process.argv);
|
|
@@ -28,6 +29,7 @@ const options = program.opts();
|
|
|
28
29
|
const cliOptions = {
|
|
29
30
|
dryRun: options.dryRun,
|
|
30
31
|
run: options.run,
|
|
32
|
+
preRun: options.preRun,
|
|
31
33
|
prereleaseChannel: options.preRelease,
|
|
32
34
|
useVersion: options.useVersion,
|
|
33
35
|
publish: options.publish,
|
package/dist/config.js
CHANGED
|
@@ -36,6 +36,7 @@ const defaults_1 = require("./defaults");
|
|
|
36
36
|
const validateConfig = typura_1.predicates.object({
|
|
37
37
|
dryRun: typura_1.predicates.optional(typura_1.predicates.boolean()),
|
|
38
38
|
run: typura_1.predicates.optional(typura_1.predicates.string()),
|
|
39
|
+
preRun: typura_1.predicates.optional(typura_1.predicates.string()),
|
|
39
40
|
runScript: typura_1.predicates.optional(typura_1.predicates.string()),
|
|
40
41
|
prereleaseChannel: typura_1.predicates.optional(typura_1.predicates.string()),
|
|
41
42
|
useVersion: typura_1.predicates.optional(typura_1.predicates.string()),
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -103,6 +103,13 @@ async function autorel(args) {
|
|
|
103
103
|
output_1.default.debug(`The changelog is:\n${changelog}`);
|
|
104
104
|
if (args.dryRun)
|
|
105
105
|
return;
|
|
106
|
+
if (args.preRun) {
|
|
107
|
+
output_1.default.log('Running pre-release bash script:');
|
|
108
|
+
output_1.default.log('----------------------------');
|
|
109
|
+
output_1.default.log(args.preRun);
|
|
110
|
+
output_1.default.log('----------------------------');
|
|
111
|
+
(0, sh_1.bash)(args.preRun);
|
|
112
|
+
}
|
|
106
113
|
git.createAndPushTag(nextTag);
|
|
107
114
|
const { owner, repository } = git.getRepo();
|
|
108
115
|
!args.skipRelease && github.createRelease({
|
|
@@ -120,15 +127,20 @@ async function autorel(args) {
|
|
|
120
127
|
}
|
|
121
128
|
process.env.NEXT_VERSION = nextTag.replace('v', '');
|
|
122
129
|
process.env.NEXT_TAG = nextTag;
|
|
123
|
-
// run post-release script
|
|
130
|
+
// run post-release bash script
|
|
124
131
|
if (args.run) {
|
|
125
|
-
output_1.default.log('Running post-release command:');
|
|
132
|
+
output_1.default.log('Running post-release bash script/command:');
|
|
126
133
|
output_1.default.log('----------------------------');
|
|
127
134
|
output_1.default.log(args.run);
|
|
128
135
|
output_1.default.log('----------------------------');
|
|
129
|
-
(0, sh_1.
|
|
136
|
+
(0, sh_1.bash)(args.run);
|
|
130
137
|
}
|
|
131
138
|
else if (args.runScript) {
|
|
139
|
+
// TODO: delete this block in the next major version
|
|
140
|
+
output_1.default.warn('----------------------------');
|
|
141
|
+
output_1.default.warn('🚨 The "runScript" option is deprecated. Please use "run" instead. 🚨');
|
|
142
|
+
output_1.default.warn('🚨 The "runScript" option will be removed in the next major version. 🚨');
|
|
143
|
+
output_1.default.warn('----------------------------');
|
|
132
144
|
output_1.default.log('Running post-release bash script:');
|
|
133
145
|
output_1.default.log('');
|
|
134
146
|
output_1.default.log('----------------------------');
|
package/dist/lib/sh.d.ts
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Executes a bash program/command and returns the output. This is a tagged template
|
|
3
|
+
* literal function, so you can use it like this:
|
|
4
|
+
*
|
|
5
|
+
* const output = $`echo "Hello, World!"`;
|
|
6
|
+
*
|
|
7
|
+
* Also, it logs the command/script to the console in debug mode.
|
|
8
|
+
*/
|
|
1
9
|
export declare function $(strings: TemplateStringsArray, ...values: any[]): string;
|
|
10
|
+
/**
|
|
11
|
+
* Executes a bash program/command but does not return the output. Is not a tagged template
|
|
12
|
+
* literal function. You can use it like this:
|
|
13
|
+
*
|
|
14
|
+
* bash('echo "Hello, World!" > /dev/null');
|
|
15
|
+
*/
|
|
2
16
|
export declare function bash(cmd: string): void;
|
|
3
|
-
export declare function cmd(cmd: string): void;
|
package/dist/lib/sh.js
CHANGED
|
@@ -3,24 +3,34 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.bash = exports.$ = void 0;
|
|
7
7
|
const child_process_1 = require("child_process");
|
|
8
8
|
const output_1 = __importDefault(require("./output"));
|
|
9
|
+
/**
|
|
10
|
+
* Executes a bash program/command and returns the output. This is a tagged template
|
|
11
|
+
* literal function, so you can use it like this:
|
|
12
|
+
*
|
|
13
|
+
* const output = $`echo "Hello, World!"`;
|
|
14
|
+
*
|
|
15
|
+
* Also, it logs the command/script to the console in debug mode.
|
|
16
|
+
*/
|
|
9
17
|
function $(strings, ...values) {
|
|
10
18
|
const command = strings.reduce((acc, str, i) => acc + str + (values[i] || ''), '');
|
|
11
19
|
output_1.default.debug(command);
|
|
12
|
-
const escapedCommand = command.replace(/(["$`\\])/g, '\\$1')
|
|
20
|
+
const escapedCommand = command.replace(/(["$`\\])/g, '\\$1');
|
|
13
21
|
const output = (0, child_process_1.execSync)(`bash -c "${escapedCommand}"`, { encoding: 'utf8' });
|
|
14
22
|
return output.trim();
|
|
15
23
|
}
|
|
16
24
|
exports.$ = $;
|
|
25
|
+
/**
|
|
26
|
+
* Executes a bash program/command but does not return the output. Is not a tagged template
|
|
27
|
+
* literal function. You can use it like this:
|
|
28
|
+
*
|
|
29
|
+
* bash('echo "Hello, World!" > /dev/null');
|
|
30
|
+
*/
|
|
17
31
|
function bash(cmd) {
|
|
18
|
-
const escapedCommand = cmd.replace(/(["$`\\])/g, '\\$1')
|
|
32
|
+
const escapedCommand = cmd.replace(/(["$`\\])/g, '\\$1');
|
|
19
33
|
(0, child_process_1.execSync)(`bash -c "${escapedCommand}"`, { encoding: 'utf8', stdio: 'inherit' });
|
|
20
34
|
}
|
|
21
35
|
exports.bash = bash;
|
|
22
|
-
function cmd(cmd) {
|
|
23
|
-
(0, child_process_1.execSync)(cmd, { encoding: 'utf8', stdio: 'inherit' });
|
|
24
|
-
}
|
|
25
|
-
exports.cmd = cmd;
|
|
26
36
|
//# sourceMappingURL=sh.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "autorel",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.8-next.3",
|
|
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)",
|