node-package-release-action 1.0.13 → 1.0.15

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 CHANGED
@@ -91,7 +91,7 @@ Let's start with the easy ones. `major`, `minor` and `patch` increase their corr
91
91
  - `2.3.4` + `minor` => `2.4.0`
92
92
  - `2.3.4` + `patch` => `2.3.5`
93
93
 
94
- `prerelease` is an interesting one. It increases the prerelease part if it exists. Otherwise, it increases the minor part and append a prerelease zero suffix.
94
+ `prerelease` is an interesting one. It increases the prerelease part if it exists. Otherwise, it increases the patch part and append a prerelease zero suffix.
95
95
 
96
96
  - `2.3.4-0` + `prerelease` => `2.3.4-1`
97
97
  - `2.3.4` + `prerelease` => `2.3.5-0`
package/lib/checkDiff.js CHANGED
@@ -23,11 +23,8 @@ function checkDiff(tag) {
23
23
  tag,
24
24
  '--name-only',
25
25
  '--',
26
- ...(0, glob_1.sync)((0, node_path_1.join)(directory, diffTargets)),
26
+ ...(0, glob_1.globSync)((0, node_path_1.join)(directory, diffTargets)),
27
27
  ]);
28
- if (diffOutput.exitCode !== core_1.ExitCode.Success) {
29
- throw new Error(diffOutput.stderr);
30
- }
31
28
  (0, core_1.debug)(`Diff against ${tag}:` +
32
29
  '\n' +
33
30
  diffOutput.stdout
package/lib/configGit.js CHANGED
@@ -16,48 +16,28 @@ exports.GITHUB_ACTION_USER_NAME = 'GitHub Action';
16
16
  exports.GITHUB_ACTION_USER_EMAIL = '41898282+github-actions[bot]@users.noreply.github.com';
17
17
  function configGit() {
18
18
  return __awaiter(this, void 0, void 0, function* () {
19
- const gitConfigNameOutput = yield (0, exec_1.getExecOutput)('git', [
19
+ yield (0, exec_1.getExecOutput)('git', [
20
20
  'config',
21
21
  '--global',
22
22
  'user.name',
23
23
  exports.GITHUB_ACTION_USER_NAME,
24
24
  ]);
25
- if (gitConfigNameOutput.exitCode !== 0) {
26
- throw new Error(gitConfigNameOutput.stderr);
27
- }
28
- const gitConfigEmailOutput = yield (0, exec_1.getExecOutput)('git', [
25
+ yield (0, exec_1.getExecOutput)('git', [
29
26
  'config',
30
27
  '--global',
31
28
  'user.email',
32
29
  exports.GITHUB_ACTION_USER_EMAIL,
33
30
  ]);
34
- if (gitConfigEmailOutput.exitCode !== 0) {
35
- throw new Error(gitConfigEmailOutput.stderr);
36
- }
37
- const gitConfigPushDefaultOutput = yield (0, exec_1.getExecOutput)('git', [
38
- 'config',
39
- '--global',
40
- 'push.default',
41
- 'simple',
42
- ]);
43
- if (gitConfigPushDefaultOutput.exitCode !== 0) {
44
- throw new Error(gitConfigPushDefaultOutput.stderr);
45
- }
46
- const gitConfigPushAutoSetupRemoteOutput = yield (0, exec_1.getExecOutput)('git', [
31
+ yield (0, exec_1.getExecOutput)('git', ['config', '--global', 'push.default', 'simple']);
32
+ yield (0, exec_1.getExecOutput)('git', [
47
33
  'config',
48
34
  '--global',
49
35
  'push.autoSetupRemote',
50
36
  'true',
51
37
  ]);
52
- if (gitConfigPushAutoSetupRemoteOutput.exitCode !== 0) {
53
- throw new Error(gitConfigPushAutoSetupRemoteOutput.stderr);
54
- }
55
38
  const githubToken = (0, core_1.getInput)('github-token');
56
39
  (0, core_1.exportVariable)('GH_TOKEN', githubToken);
57
- const ghAuthOutput = yield (0, exec_1.getExecOutput)('gh', ['auth', 'setup-git']);
58
- if (ghAuthOutput.exitCode !== 0) {
59
- throw new Error(ghAuthOutput.stderr);
60
- }
40
+ yield (0, exec_1.getExecOutput)('gh', ['auth', 'setup-git']);
61
41
  });
62
42
  }
63
43
  exports.configGit = configGit;
@@ -10,34 +10,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.fetchEverything = void 0;
13
- const core_1 = require("@actions/core");
14
13
  const exec_1 = require("@actions/exec");
15
14
  function fetchEverything() {
16
15
  return __awaiter(this, void 0, void 0, function* () {
17
- const gitFetchTagsOutput = yield (0, exec_1.getExecOutput)('git', [
18
- 'fetch',
19
- '--tags',
20
- 'origin',
21
- ]);
22
- if (gitFetchTagsOutput.exitCode !== core_1.ExitCode.Success) {
23
- throw new Error(gitFetchTagsOutput.stderr);
24
- }
16
+ yield (0, exec_1.getExecOutput)('git', ['fetch', '--tags', 'origin']);
25
17
  const gitIsShallowRepositoryOutput = yield (0, exec_1.getExecOutput)('git', [
26
18
  'rev-parse',
27
19
  '--is-shallow-repository',
28
20
  ]);
29
- if (gitIsShallowRepositoryOutput.exitCode !== core_1.ExitCode.Success) {
30
- throw new Error(gitIsShallowRepositoryOutput.stderr);
31
- }
32
21
  if (gitIsShallowRepositoryOutput.stdout.trim() === 'true') {
33
- const gitFetchUnshallowOutput = yield (0, exec_1.getExecOutput)('git', [
34
- 'fetch',
35
- '--unshallow',
36
- 'origin',
37
- ]);
38
- if (gitFetchUnshallowOutput.exitCode !== core_1.ExitCode.Success) {
39
- throw new Error(gitFetchUnshallowOutput.stderr);
40
- }
22
+ yield (0, exec_1.getExecOutput)('git', ['fetch', '--unshallow', 'origin']);
41
23
  }
42
24
  });
43
25
  }
@@ -10,15 +10,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.getAllGitTags = void 0;
13
- const core_1 = require("@actions/core");
14
13
  const exec_1 = require("@actions/exec");
15
14
  const semver_1 = require("semver");
16
15
  function getAllGitTags() {
17
16
  return __awaiter(this, void 0, void 0, function* () {
18
17
  const tagOutput = yield (0, exec_1.getExecOutput)('git', ['tag']);
19
- if (tagOutput.exitCode !== core_1.ExitCode.Success) {
20
- throw new Error(tagOutput.stderr);
21
- }
22
18
  const allTags = tagOutput.stdout.split('\n');
23
19
  const versionTags = allTags.filter((tag) => (0, semver_1.valid)(tag));
24
20
  return versionTags;
package/lib/pushBranch.js CHANGED
@@ -19,9 +19,6 @@ function pushBranch() {
19
19
  'branch',
20
20
  '--show-current',
21
21
  ]);
22
- if (gitBranchOutput.exitCode !== core_1.ExitCode.Success) {
23
- throw new Error(gitBranchOutput.stderr);
24
- }
25
22
  const branchName = gitBranchOutput.stdout;
26
23
  if (branchName === '') {
27
24
  (0, core_1.error)(`No branch detected`);
@@ -29,14 +26,11 @@ function pushBranch() {
29
26
  throw new Error(`No branch detected`);
30
27
  }
31
28
  (0, core_1.notice)(`Current branch: ${branchName}`);
32
- const gitPushOutput = yield (0, exec_1.getExecOutput)('git', [
29
+ yield (0, exec_1.getExecOutput)('git', [
33
30
  'push',
34
31
  '--follow-tags',
35
32
  ...(dryRun ? ['--dry-run'] : []),
36
33
  ]);
37
- if (gitPushOutput.exitCode !== core_1.ExitCode.Success) {
38
- throw new Error(gitPushOutput.stderr);
39
- }
40
34
  });
41
35
  }
42
36
  exports.pushBranch = pushBranch;
package/lib/setVersion.js CHANGED
@@ -21,16 +21,10 @@ function setVersion(version) {
21
21
  const absoluteDirectory = (0, node_path_1.resolve)(exports.DEFAULT_WORKING_DIRECTORY, directory);
22
22
  const packageJsonPath = (0, node_path_1.resolve)(absoluteDirectory, 'package.json');
23
23
  if ((0, node_fs_1.existsSync)(packageJsonPath)) {
24
- const npmVersionOutput = yield (0, exec_1.getExecOutput)('npm', ['version', version]);
25
- if (npmVersionOutput.exitCode !== 0) {
26
- throw new Error(npmVersionOutput.stderr);
27
- }
24
+ yield (0, exec_1.getExecOutput)('npm', ['version', version]);
28
25
  }
29
26
  else {
30
- const gitTagOutput = yield (0, exec_1.getExecOutput)('git', ['tag', `v${version}`]);
31
- if (gitTagOutput.exitCode !== 0) {
32
- throw new Error(gitTagOutput.stderr);
33
- }
27
+ yield (0, exec_1.getExecOutput)('git', ['tag', `v${version}`]);
34
28
  }
35
29
  (0, core_1.notice)(`Tag created: v${version}`);
36
30
  });
package/lib/updateTags.js CHANGED
@@ -25,42 +25,29 @@ function updateTags(version) {
25
25
  "\nPlease don't set release-type to prerelease and update-shorthand-release to true at the same time");
26
26
  }
27
27
  if (semver.major > 0) {
28
- const gitTagMajorOutput = yield (0, exec_1.getExecOutput)('git', [
29
- 'tag',
30
- '-f',
31
- `v${semver.major}`,
32
- ]);
33
- if (gitTagMajorOutput.exitCode !== 0) {
34
- throw new Error(gitTagMajorOutput.stderr);
35
- }
28
+ yield (0, exec_1.getExecOutput)('git', ['tag', '-f', `v${semver.major}`]);
36
29
  (0, core_1.notice)(`Tag updated: v${semver.major}`);
37
30
  }
38
31
  else {
39
32
  (0, core_1.warning)(`Tag v0 is not allowed so it's not updated`);
40
33
  }
41
34
  if (semver.major > 0 || semver.minor > 0) {
42
- const gitTagMinorOutput = yield (0, exec_1.getExecOutput)('git', [
35
+ yield (0, exec_1.getExecOutput)('git', [
43
36
  'tag',
44
37
  '-f',
45
38
  `v${semver.major}.${semver.minor}`,
46
39
  ]);
47
- if (gitTagMinorOutput.exitCode !== 0) {
48
- throw new Error(gitTagMinorOutput.stderr);
49
- }
50
40
  (0, core_1.notice)(`Tag updated: v${semver.major}.${semver.minor}`);
51
41
  }
52
42
  else {
53
43
  (0, core_1.warning)(`Tag v0.0 is not allowed so it's not updated`);
54
44
  }
55
- const gitPushOutput = yield (0, exec_1.getExecOutput)('git', [
45
+ yield (0, exec_1.getExecOutput)('git', [
56
46
  'push',
57
47
  '-f',
58
48
  '--tags',
59
49
  ...(dryRun ? ['--dry-run'] : []),
60
50
  ]);
61
- if (gitPushOutput.exitCode !== core_1.ExitCode.Success) {
62
- throw new Error(gitPushOutput.stderr);
63
- }
64
51
  });
65
52
  }
66
53
  exports.updateTags = updateTags;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-package-release-action",
3
- "version": "1.0.13",
3
+ "version": "1.0.15",
4
4
  "description": "A template to create custom GitHub Action with TypeScript/JavaScript.",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.js",
@@ -22,12 +22,13 @@
22
22
  "url": "https://github.com/CatChen/node-package-release-action/issues"
23
23
  },
24
24
  "homepage": "https://github.com/CatChen/node-package-release-action#readme",
25
+ "funding": "https://github.com/CatChen/node-package-release-action?sponsor=1",
25
26
  "devDependencies": {
26
- "@octokit/graphql-schema": "^12.24.0",
27
+ "@octokit/graphql-schema": "^13.0.1",
27
28
  "@octokit/webhooks-definitions": "^3.67.3",
28
- "@serverless-guru/prettier-plugin-import-order": "^0.3.0",
29
+ "@serverless-guru/prettier-plugin-import-order": "^0.4.1",
29
30
  "@types/glob": "^8.0.0",
30
- "@types/node": "^18.11.9",
31
+ "@types/node": "^20.1.3",
31
32
  "@types/semver": "^7.3.13",
32
33
  "@typescript-eslint/eslint-plugin": "^5.42.1",
33
34
  "@typescript-eslint/parser": "^5.42.1",
@@ -38,15 +39,15 @@
38
39
  "husky": "^8.0.2",
39
40
  "prettier": "^2.7.1",
40
41
  "pretty-quick": "^3.1.3",
41
- "typescript": "^4.8.4"
42
+ "typescript": "^5.0.2"
42
43
  },
43
44
  "dependencies": {
44
45
  "@actions/core": "^1.10.0",
45
46
  "@actions/exec": "^1.1.1",
46
47
  "@actions/github": "^5.1.1",
47
48
  "@octokit/plugin-retry": "^4.0.3",
48
- "@octokit/plugin-throttling": "^4.3.2",
49
- "glob": "^8.0.3",
49
+ "@octokit/plugin-throttling": "^5.0.1",
50
+ "glob": "^10.2.3",
50
51
  "semver": "^7.3.8"
51
52
  }
52
53
  }