node-package-release-action 1.0.10 → 1.0.12

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.
@@ -0,0 +1,22 @@
1
+ {
2
+ "arrowParens": "always",
3
+ "bracketSpacing": true,
4
+ "bracketSameLine": false,
5
+ "semi": true,
6
+ "singleQuote": true,
7
+ "tabWidth": 2,
8
+ "trailingComma": "all",
9
+ "importOrder": [
10
+ "^@action/core/(.*)$",
11
+ "^@action/github/(.*)$",
12
+ "^@action/exec/(.*)$",
13
+ "^@action/glob/(.*)$",
14
+ "^@action/(.*)$",
15
+ "<THIRD_PARTY_MODULES>",
16
+ "^[./]"
17
+ ],
18
+ "importOrderSortIndividualImports": true,
19
+ "importOrderMergeDuplicateImports": true,
20
+ "importOrderBuiltinModulesToTop": true,
21
+ "importOrderTypeImportsToTop": true
22
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "yaml.schemas": {
3
+ "https://json.schemastore.org/github-action.json": "action.yml",
4
+ "https://json.schemastore.org/github-funding.json": ".github/FUNDING.yml",
5
+ "https://json.schemastore.org/github-workflow.json": ".github/workflows/*.yml",
6
+ "https://json.schemastore.org/package.json": "package.json",
7
+ "https://json.schemastore.org/tsconfig.json": "tsconfig.json",
8
+ "https://json.schemastore.org/eslintrc.json": ".eslintrc.json",
9
+ "https://json.schemastore.org/prettierrc.json": ".prettierrc.json"
10
+ }
11
+ }
package/README.md CHANGED
@@ -15,7 +15,7 @@ name: Release
15
15
 
16
16
  on:
17
17
  schedule:
18
- - cron: "0 12 * * 0" # every sunday noon
18
+ - cron: '0 12 * * 0' # every sunday noon
19
19
 
20
20
  jobs:
21
21
  release:
@@ -28,7 +28,7 @@ jobs:
28
28
  uses: CatChen/node-package-release-action@v1
29
29
  with:
30
30
  github-token: ${{ secrets.GITHUB_TOKEN }} # optional
31
- directory: "./" #optional
31
+ directory: './' #optional
32
32
  release-type: prerelease # optional
33
33
  prerelease: false # optional
34
34
  update-shorthand-release: false
@@ -118,9 +118,9 @@ on:
118
118
  workflow_dispatch:
119
119
  inputs:
120
120
  release-type:
121
- description: "Release Type"
121
+ description: 'Release Type'
122
122
  required: true
123
- default: "patch"
123
+ default: 'patch'
124
124
  type: choice
125
125
  options:
126
126
  - major
@@ -131,12 +131,12 @@ on:
131
131
  - prepatch
132
132
  - prerelease
133
133
  prerelease:
134
- description: "Prerelease"
134
+ description: 'Prerelease'
135
135
  required: true
136
136
  default: false
137
137
  type: boolean
138
138
  dry-run:
139
- description: "Dry run"
139
+ description: 'Dry run'
140
140
  required: true
141
141
  default: false
142
142
  type: boolean
@@ -148,7 +148,7 @@ on:
148
148
  steps:
149
149
  - uses: actions/checkout@v3
150
150
  with:
151
- ref: "main"
151
+ ref: 'main'
152
152
 
153
153
  - uses: CatChen/node-package-release-action@v1
154
154
  with:
@@ -2,11 +2,11 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.RELEASE_TYPES = void 0;
4
4
  exports.RELEASE_TYPES = [
5
- "major",
6
- "premajor",
7
- "minor",
8
- "preminor",
9
- "patch",
10
- "prepatch",
11
- "prerelease",
5
+ 'major',
6
+ 'premajor',
7
+ 'minor',
8
+ 'preminor',
9
+ 'patch',
10
+ 'prepatch',
11
+ 'prerelease',
12
12
  ];
package/lib/checkDiff.js CHANGED
@@ -13,30 +13,28 @@ exports.checkDiff = void 0;
13
13
  const node_path_1 = require("node:path");
14
14
  const core_1 = require("@actions/core");
15
15
  const exec_1 = require("@actions/exec");
16
- const glob_1 = require("@actions/glob");
16
+ const glob_1 = require("glob");
17
17
  function checkDiff(tag) {
18
18
  return __awaiter(this, void 0, void 0, function* () {
19
- const directory = (0, core_1.getInput)("directory");
20
- const diffTargets = (0, core_1.getInput)("diff-targets");
21
- const globber = yield (0, glob_1.create)((0, node_path_1.join)(directory, diffTargets));
22
- const glob = yield globber.glob();
23
- const diffOutput = yield (0, exec_1.getExecOutput)("git", [
24
- "diff",
19
+ const directory = (0, core_1.getInput)('directory');
20
+ const diffTargets = (0, core_1.getInput)('diff-targets');
21
+ const diffOutput = yield (0, exec_1.getExecOutput)('git', [
22
+ 'diff',
25
23
  tag,
26
- "--name-only",
27
- "--",
28
- ...glob,
24
+ '--name-only',
25
+ '--',
26
+ ...(0, glob_1.sync)((0, node_path_1.join)(directory, diffTargets)),
29
27
  ]);
30
28
  if (diffOutput.exitCode !== core_1.ExitCode.Success) {
31
29
  throw new Error(diffOutput.stderr);
32
30
  }
33
31
  (0, core_1.debug)(`Diff against ${tag}:` +
34
- "\n" +
32
+ '\n' +
35
33
  diffOutput.stdout
36
- .split("\n")
34
+ .split('\n')
37
35
  .map((line) => ` ${line}`)
38
- .join("\n"));
39
- return diffOutput.stdout.split("\n").join("") !== "";
36
+ .join('\n'));
37
+ return diffOutput.stdout.split('\n').join('') !== '';
40
38
  });
41
39
  }
42
40
  exports.checkDiff = checkDiff;
package/lib/configGit.js CHANGED
@@ -12,49 +12,49 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.configGit = exports.GITHUB_ACTION_USER_EMAIL = exports.GITHUB_ACTION_USER_NAME = void 0;
13
13
  const core_1 = require("@actions/core");
14
14
  const exec_1 = require("@actions/exec");
15
- exports.GITHUB_ACTION_USER_NAME = "GitHub Action";
16
- exports.GITHUB_ACTION_USER_EMAIL = "41898282+github-actions[bot]@users.noreply.github.com";
15
+ exports.GITHUB_ACTION_USER_NAME = 'GitHub Action';
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", [
20
- "config",
21
- "--global",
22
- "user.name",
19
+ const gitConfigNameOutput = yield (0, exec_1.getExecOutput)('git', [
20
+ 'config',
21
+ '--global',
22
+ 'user.name',
23
23
  exports.GITHUB_ACTION_USER_NAME,
24
24
  ]);
25
25
  if (gitConfigNameOutput.exitCode !== 0) {
26
26
  throw new Error(gitConfigNameOutput.stderr);
27
27
  }
28
- const gitConfigEmailOutput = yield (0, exec_1.getExecOutput)("git", [
29
- "config",
30
- "--global",
31
- "user.email",
28
+ const gitConfigEmailOutput = yield (0, exec_1.getExecOutput)('git', [
29
+ 'config',
30
+ '--global',
31
+ 'user.email',
32
32
  exports.GITHUB_ACTION_USER_EMAIL,
33
33
  ]);
34
34
  if (gitConfigEmailOutput.exitCode !== 0) {
35
35
  throw new Error(gitConfigEmailOutput.stderr);
36
36
  }
37
- const gitConfigPushDefaultOutput = yield (0, exec_1.getExecOutput)("git", [
38
- "config",
39
- "--global",
40
- "push.default",
41
- "simple",
37
+ const gitConfigPushDefaultOutput = yield (0, exec_1.getExecOutput)('git', [
38
+ 'config',
39
+ '--global',
40
+ 'push.default',
41
+ 'simple',
42
42
  ]);
43
43
  if (gitConfigPushDefaultOutput.exitCode !== 0) {
44
44
  throw new Error(gitConfigPushDefaultOutput.stderr);
45
45
  }
46
- const gitConfigPushAutoSetupRemoteOutput = yield (0, exec_1.getExecOutput)("git", [
47
- "config",
48
- "--global",
49
- "push.autoSetupRemote",
50
- "true",
46
+ const gitConfigPushAutoSetupRemoteOutput = yield (0, exec_1.getExecOutput)('git', [
47
+ 'config',
48
+ '--global',
49
+ 'push.autoSetupRemote',
50
+ 'true',
51
51
  ]);
52
52
  if (gitConfigPushAutoSetupRemoteOutput.exitCode !== 0) {
53
53
  throw new Error(gitConfigPushAutoSetupRemoteOutput.stderr);
54
54
  }
55
- const githubToken = (0, core_1.getInput)("github-token");
56
- (0, core_1.exportVariable)("GH_TOKEN", githubToken);
57
- const ghAuthOutput = yield (0, exec_1.getExecOutput)("gh", ["auth", "setup-git"]);
55
+ const githubToken = (0, core_1.getInput)('github-token');
56
+ (0, core_1.exportVariable)('GH_TOKEN', githubToken);
57
+ const ghAuthOutput = yield (0, exec_1.getExecOutput)('gh', ['auth', 'setup-git']);
58
58
  if (ghAuthOutput.exitCode !== 0) {
59
59
  throw new Error(ghAuthOutput.stderr);
60
60
  }
@@ -1,3 +1,3 @@
1
- import type { Octokit } from "@octokit/core";
2
- import type { Api } from "@octokit/plugin-rest-endpoint-methods/dist-types/types";
1
+ import type { Octokit } from '@octokit/core';
2
+ import type { Api } from '@octokit/plugin-rest-endpoint-methods/dist-types/types';
3
3
  export declare function createRelease(owner: string, repo: string, version: string, octokit: Octokit & Api): Promise<void>;
@@ -13,9 +13,9 @@ exports.createRelease = void 0;
13
13
  const core_1 = require("@actions/core");
14
14
  function createRelease(owner, repo, version, octokit) {
15
15
  return __awaiter(this, void 0, void 0, function* () {
16
- const dryRun = (0, core_1.getBooleanInput)("dry-run");
16
+ const dryRun = (0, core_1.getBooleanInput)('dry-run');
17
17
  if (dryRun) {
18
- (0, core_1.notice)("Release creation is skipped in dry run");
18
+ (0, core_1.notice)('Release creation is skipped in dry run');
19
19
  const response = yield octokit.rest.repos.generateReleaseNotes({
20
20
  owner,
21
21
  repo,
@@ -23,7 +23,7 @@ function createRelease(owner, repo, version, octokit) {
23
23
  name: `v${version}`,
24
24
  });
25
25
  (0, core_1.info)(`Release name: ${response.data.name}`);
26
- (0, core_1.info)("Release body:\n" + response.data.body + "\n\n");
26
+ (0, core_1.info)('Release body:\n' + response.data.body + '\n\n');
27
27
  return;
28
28
  }
29
29
  yield octokit.rest.repos.createRelease({
@@ -32,7 +32,7 @@ function createRelease(owner, repo, version, octokit) {
32
32
  tag_name: `v${version}`,
33
33
  name: `v${version}`,
34
34
  generate_release_notes: true,
35
- prerelease: (0, core_1.getBooleanInput)("prerelease"),
35
+ prerelease: (0, core_1.getBooleanInput)('prerelease'),
36
36
  });
37
37
  });
38
38
  }
@@ -14,26 +14,26 @@ const core_1 = require("@actions/core");
14
14
  const exec_1 = require("@actions/exec");
15
15
  function fetchEverything() {
16
16
  return __awaiter(this, void 0, void 0, function* () {
17
- const gitFetchTagsOutput = yield (0, exec_1.getExecOutput)("git", [
18
- "fetch",
19
- "--tags",
20
- "origin",
17
+ const gitFetchTagsOutput = yield (0, exec_1.getExecOutput)('git', [
18
+ 'fetch',
19
+ '--tags',
20
+ 'origin',
21
21
  ]);
22
22
  if (gitFetchTagsOutput.exitCode !== core_1.ExitCode.Success) {
23
23
  throw new Error(gitFetchTagsOutput.stderr);
24
24
  }
25
- const gitIsShallowRepositoryOutput = yield (0, exec_1.getExecOutput)("git", [
26
- "rev-parse",
27
- "--is-shallow-repository",
25
+ const gitIsShallowRepositoryOutput = yield (0, exec_1.getExecOutput)('git', [
26
+ 'rev-parse',
27
+ '--is-shallow-repository',
28
28
  ]);
29
29
  if (gitIsShallowRepositoryOutput.exitCode !== core_1.ExitCode.Success) {
30
30
  throw new Error(gitIsShallowRepositoryOutput.stderr);
31
31
  }
32
- if (gitIsShallowRepositoryOutput.stdout.trim() === "true") {
33
- const gitFetchUnshallowOutput = yield (0, exec_1.getExecOutput)("git", [
34
- "fetch",
35
- "--unshallow",
36
- "origin",
32
+ if (gitIsShallowRepositoryOutput.stdout.trim() === 'true') {
33
+ const gitFetchUnshallowOutput = yield (0, exec_1.getExecOutput)('git', [
34
+ 'fetch',
35
+ '--unshallow',
36
+ 'origin',
37
37
  ]);
38
38
  if (gitFetchUnshallowOutput.exitCode !== core_1.ExitCode.Success) {
39
39
  throw new Error(gitFetchUnshallowOutput.stderr);
@@ -1,2 +1,2 @@
1
- import { ReleaseType } from "semver";
1
+ import { ReleaseType } from 'semver';
2
2
  export declare function findLastSameReleaseTypeVersion(releaseVersion: string, releaseType: ReleaseType): Promise<string | null>;
@@ -15,11 +15,11 @@ const exec_1 = require("@actions/exec");
15
15
  const semver_1 = require("semver");
16
16
  function getAllGitTags() {
17
17
  return __awaiter(this, void 0, void 0, function* () {
18
- const tagOutput = yield (0, exec_1.getExecOutput)("git", ["tag"]);
18
+ const tagOutput = yield (0, exec_1.getExecOutput)('git', ['tag']);
19
19
  if (tagOutput.exitCode !== core_1.ExitCode.Success) {
20
20
  throw new Error(tagOutput.stderr);
21
21
  }
22
- const allTags = tagOutput.stdout.split("\n");
22
+ const allTags = tagOutput.stdout.split('\n');
23
23
  const versionTags = allTags.filter((tag) => (0, semver_1.valid)(tag));
24
24
  return versionTags;
25
25
  });
@@ -1,3 +1,3 @@
1
- import type { Octokit } from "@octokit/core";
2
- import type { Api } from "@octokit/plugin-rest-endpoint-methods/dist-types/types";
1
+ import type { Octokit } from '@octokit/core';
2
+ import type { Api } from '@octokit/plugin-rest-endpoint-methods/dist-types/types';
3
3
  export declare function getLatestReleaseTag(owner: string, repo: string, octokit: Octokit & Api): Promise<string | null>;
@@ -35,7 +35,7 @@ function getLatestReleaseTag(owner, repo, octokit) {
35
35
  (0, core_1.warning)(`Latest release not found but pre-release may exist`);
36
36
  }
37
37
  else {
38
- throw new Error(`Unexpected status code: ${error.status}`);
38
+ throw new Error(`Unexpected error: [${error.status}] ${error.message}`);
39
39
  }
40
40
  }
41
41
  else {
@@ -54,7 +54,7 @@ function getLatestReleaseTag(owner, repo, octokit) {
54
54
  const validReleaseTags = releaseTags.filter((tag) => (0, semver_1.valid)(tag) !== null);
55
55
  if (validReleaseTags.length === 0) {
56
56
  (0, core_1.warning)(`No valid release tag found`);
57
- (0, core_1.debug)("Release tags:\n" + releaseTags.map((tag) => ` ${tag}`).join("\n"));
57
+ (0, core_1.debug)('Release tags:\n' + releaseTags.map((tag) => ` ${tag}`).join('\n'));
58
58
  return null;
59
59
  }
60
60
  const sortedReleaseTags = (0, semver_1.rsort)(validReleaseTags);
package/lib/getOctokit.js CHANGED
@@ -3,10 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getOctokit = void 0;
4
4
  const core_1 = require("@actions/core");
5
5
  const utils_1 = require("@actions/github/lib/utils");
6
- const plugin_throttling_1 = require("@octokit/plugin-throttling");
7
6
  const plugin_retry_1 = require("@octokit/plugin-retry");
7
+ const plugin_throttling_1 = require("@octokit/plugin-throttling");
8
8
  function getOctokit() {
9
- const githubToken = (0, core_1.getInput)("github-token");
9
+ const githubToken = (0, core_1.getInput)('github-token');
10
10
  const Octokit = utils_1.GitHub.plugin(plugin_throttling_1.throttling, plugin_retry_1.retry);
11
11
  const octokit = new Octokit((0, utils_1.getOctokitOptions)(githubToken, {
12
12
  throttle: {
@@ -32,7 +32,7 @@ function getOctokit() {
32
32
  },
33
33
  },
34
34
  retry: {
35
- doNotRetry: ["429"],
35
+ doNotRetry: ['429'],
36
36
  },
37
37
  }));
38
38
  return octokit;
@@ -17,9 +17,9 @@ const core_1 = require("@actions/core");
17
17
  exports.DEFAULT_WORKING_DIRECTORY = process.cwd();
18
18
  function getPackageVersion() {
19
19
  return __awaiter(this, void 0, void 0, function* () {
20
- const directory = (0, core_1.getInput)("directory");
20
+ const directory = (0, core_1.getInput)('directory');
21
21
  const absoluteDirectory = (0, node_path_1.resolve)(exports.DEFAULT_WORKING_DIRECTORY, directory);
22
- const packageJsonPath = (0, node_path_1.resolve)(absoluteDirectory, "package.json");
22
+ const packageJsonPath = (0, node_path_1.resolve)(absoluteDirectory, 'package.json');
23
23
  if (!(0, node_fs_1.existsSync)(packageJsonPath)) {
24
24
  (0, core_1.warning)(`package.json cannot be found at ${packageJsonPath}`);
25
25
  return null;
package/lib/index.js CHANGED
@@ -13,19 +13,19 @@ const core_1 = require("@actions/core");
13
13
  const github_1 = require("@actions/github");
14
14
  const semver_1 = require("semver");
15
15
  const ReleaseType_1 = require("./ReleaseType");
16
- const getOctokit_1 = require("./getOctokit");
16
+ const checkDiff_1 = require("./checkDiff");
17
17
  const configGit_1 = require("./configGit");
18
+ const createRelease_1 = require("./createRelease");
18
19
  const fetchEverything_1 = require("./fetchEverything");
20
+ const findLastSameReleaseTypeVersion_1 = require("./findLastSameReleaseTypeVersion");
19
21
  const getLastGitTag_1 = require("./getLastGitTag");
20
- const getPackageVersion_1 = require("./getPackageVersion");
21
22
  const getLatestReleaseTag_1 = require("./getLatestReleaseTag");
22
- const findLastSameReleaseTypeVersion_1 = require("./findLastSameReleaseTypeVersion");
23
- const setVersion_1 = require("./setVersion");
23
+ const getOctokit_1 = require("./getOctokit");
24
+ const getPackageVersion_1 = require("./getPackageVersion");
24
25
  const pushBranch_1 = require("./pushBranch");
25
- const createRelease_1 = require("./createRelease");
26
+ const setVersion_1 = require("./setVersion");
26
27
  const updateTags_1 = require("./updateTags");
27
- const checkDiff_1 = require("./checkDiff");
28
- const DEFAULT_VERSION = "0.1.0";
28
+ const DEFAULT_VERSION = '0.1.0';
29
29
  function run() {
30
30
  return __awaiter(this, void 0, void 0, function* () {
31
31
  yield (0, configGit_1.configGit)();
@@ -42,35 +42,35 @@ function run() {
42
42
  const sortedVersions = (0, semver_1.rsort)(versions);
43
43
  const highestVersion = sortedVersions.length === 0 ? DEFAULT_VERSION : sortedVersions[0];
44
44
  (0, core_1.notice)(`Highest version: ${highestVersion}`);
45
- const releaseType = ReleaseType_1.RELEASE_TYPES.find((releaseType) => (0, core_1.getInput)("release-type").toLowerCase() === releaseType);
45
+ const releaseType = ReleaseType_1.RELEASE_TYPES.find((releaseType) => (0, core_1.getInput)('release-type').toLowerCase() === releaseType);
46
46
  if (releaseType === undefined) {
47
- (0, core_1.setFailed)(`Invalid release-type input: ${(0, core_1.getInput)("release-type")}`);
47
+ (0, core_1.setFailed)(`Invalid release-type input: ${(0, core_1.getInput)('release-type')}`);
48
48
  return;
49
49
  }
50
50
  const releaseVersion = (0, semver_1.inc)(highestVersion, releaseType);
51
51
  if (releaseVersion === null) {
52
- (0, core_1.setFailed)("Failed to compute release version");
52
+ (0, core_1.setFailed)('Failed to compute release version');
53
53
  return;
54
54
  }
55
55
  (0, core_1.notice)(`Release version: ${releaseVersion}`);
56
- if ((0, core_1.getBooleanInput)("skip-if-no-diff")) {
56
+ if ((0, core_1.getBooleanInput)('skip-if-no-diff')) {
57
57
  const lastSameReleaseTypeVersion = yield (0, findLastSameReleaseTypeVersion_1.findLastSameReleaseTypeVersion)(releaseVersion, releaseType);
58
58
  (0, core_1.notice)(`Last same release type version: ${lastSameReleaseTypeVersion}`);
59
59
  if (lastSameReleaseTypeVersion !== null) {
60
60
  const diff = yield (0, checkDiff_1.checkDiff)(lastSameReleaseTypeVersion);
61
61
  if (!diff) {
62
62
  (0, core_1.notice)(`Skip due to lack of diff between HEAD..${lastSameReleaseTypeVersion}`);
63
- (0, core_1.setOutput)("skipped", true);
63
+ (0, core_1.setOutput)('skipped', true);
64
64
  return;
65
65
  }
66
66
  }
67
- (0, core_1.setOutput)("skipped", false);
67
+ (0, core_1.setOutput)('skipped', false);
68
68
  }
69
- (0, core_1.setOutput)("tag", `v${releaseVersion}`);
69
+ (0, core_1.setOutput)('tag', `v${releaseVersion}`);
70
70
  yield (0, setVersion_1.setVersion)(releaseVersion);
71
71
  yield (0, pushBranch_1.pushBranch)();
72
72
  yield (0, createRelease_1.createRelease)(owner, repo, releaseVersion, octokit);
73
- if ((0, core_1.getBooleanInput)("update-shorthand-release")) {
73
+ if ((0, core_1.getBooleanInput)('update-shorthand-release')) {
74
74
  (0, updateTags_1.updateTags)(releaseVersion);
75
75
  }
76
76
  });
package/lib/pushBranch.js CHANGED
@@ -14,25 +14,25 @@ const core_1 = require("@actions/core");
14
14
  const exec_1 = require("@actions/exec");
15
15
  function pushBranch() {
16
16
  return __awaiter(this, void 0, void 0, function* () {
17
- const dryRun = (0, core_1.getBooleanInput)("dry-run");
18
- const gitBranchOutput = yield (0, exec_1.getExecOutput)("git", [
19
- "branch",
20
- "--show-current",
17
+ const dryRun = (0, core_1.getBooleanInput)('dry-run');
18
+ const gitBranchOutput = yield (0, exec_1.getExecOutput)('git', [
19
+ 'branch',
20
+ '--show-current',
21
21
  ]);
22
22
  if (gitBranchOutput.exitCode !== core_1.ExitCode.Success) {
23
23
  throw new Error(gitBranchOutput.stderr);
24
24
  }
25
25
  const branchName = gitBranchOutput.stdout;
26
- if (branchName === "") {
26
+ if (branchName === '') {
27
27
  (0, core_1.error)(`No branch detected`);
28
28
  (0, core_1.error)(`Did you forget to set the ref input in the actions/checkout Action?`);
29
29
  throw new Error(`No branch detected`);
30
30
  }
31
31
  (0, core_1.notice)(`Current branch: ${branchName}`);
32
- const gitPushOutput = yield (0, exec_1.getExecOutput)("git", [
33
- "push",
34
- "--follow-tags",
35
- ...(dryRun ? ["--dry-run"] : []),
32
+ const gitPushOutput = yield (0, exec_1.getExecOutput)('git', [
33
+ 'push',
34
+ '--follow-tags',
35
+ ...(dryRun ? ['--dry-run'] : []),
36
36
  ]);
37
37
  if (gitPushOutput.exitCode !== core_1.ExitCode.Success) {
38
38
  throw new Error(gitPushOutput.stderr);
package/lib/setVersion.js CHANGED
@@ -12,22 +12,22 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.setVersion = exports.DEFAULT_WORKING_DIRECTORY = void 0;
13
13
  const node_fs_1 = require("node:fs");
14
14
  const node_path_1 = require("node:path");
15
- const exec_1 = require("@actions/exec");
16
15
  const core_1 = require("@actions/core");
16
+ const exec_1 = require("@actions/exec");
17
17
  exports.DEFAULT_WORKING_DIRECTORY = process.cwd();
18
18
  function setVersion(version) {
19
19
  return __awaiter(this, void 0, void 0, function* () {
20
- const directory = (0, core_1.getInput)("directory");
20
+ const directory = (0, core_1.getInput)('directory');
21
21
  const absoluteDirectory = (0, node_path_1.resolve)(exports.DEFAULT_WORKING_DIRECTORY, directory);
22
- const packageJsonPath = (0, node_path_1.resolve)(absoluteDirectory, "package.json");
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]);
24
+ const npmVersionOutput = yield (0, exec_1.getExecOutput)('npm', ['version', version]);
25
25
  if (npmVersionOutput.exitCode !== 0) {
26
26
  throw new Error(npmVersionOutput.stderr);
27
27
  }
28
28
  }
29
29
  else {
30
- const gitTagOutput = yield (0, exec_1.getExecOutput)("git", ["tag", `v${version}`]);
30
+ const gitTagOutput = yield (0, exec_1.getExecOutput)('git', ['tag', `v${version}`]);
31
31
  if (gitTagOutput.exitCode !== 0) {
32
32
  throw new Error(gitTagOutput.stderr);
33
33
  }
package/lib/updateTags.js CHANGED
@@ -16,7 +16,7 @@ const semver_1 = require("semver");
16
16
  function updateTags(version) {
17
17
  return __awaiter(this, void 0, void 0, function* () {
18
18
  const semver = (0, semver_1.parse)(version);
19
- const dryRun = (0, core_1.getBooleanInput)("dry-run");
19
+ const dryRun = (0, core_1.getBooleanInput)('dry-run');
20
20
  if (semver === null) {
21
21
  throw new Error(`Failed to parse the version as semver: ${version}`);
22
22
  }
@@ -25,9 +25,9 @@ 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",
28
+ const gitTagMajorOutput = yield (0, exec_1.getExecOutput)('git', [
29
+ 'tag',
30
+ '-f',
31
31
  `v${semver.major}`,
32
32
  ]);
33
33
  if (gitTagMajorOutput.exitCode !== 0) {
@@ -39,9 +39,9 @@ function updateTags(version) {
39
39
  (0, core_1.warning)(`Tag v0 is not allowed so it's not updated`);
40
40
  }
41
41
  if (semver.major > 0 || semver.minor > 0) {
42
- const gitTagMinorOutput = yield (0, exec_1.getExecOutput)("git", [
43
- "tag",
44
- "-f",
42
+ const gitTagMinorOutput = yield (0, exec_1.getExecOutput)('git', [
43
+ 'tag',
44
+ '-f',
45
45
  `v${semver.major}.${semver.minor}`,
46
46
  ]);
47
47
  if (gitTagMinorOutput.exitCode !== 0) {
@@ -52,11 +52,11 @@ function updateTags(version) {
52
52
  else {
53
53
  (0, core_1.warning)(`Tag v0.0 is not allowed so it's not updated`);
54
54
  }
55
- const gitPushOutput = yield (0, exec_1.getExecOutput)("git", [
56
- "push",
57
- "-f",
58
- "--tags",
59
- ...(dryRun ? ["--dry-run"] : []),
55
+ const gitPushOutput = yield (0, exec_1.getExecOutput)('git', [
56
+ 'push',
57
+ '-f',
58
+ '--tags',
59
+ ...(dryRun ? ['--dry-run'] : []),
60
60
  ]);
61
61
  if (gitPushOutput.exitCode !== core_1.ExitCode.Success) {
62
62
  throw new Error(gitPushOutput.stderr);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-package-release-action",
3
- "version": "1.0.10",
3
+ "version": "1.0.12",
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",
@@ -25,6 +25,8 @@
25
25
  "devDependencies": {
26
26
  "@octokit/graphql-schema": "^12.24.0",
27
27
  "@octokit/webhooks-definitions": "^3.67.3",
28
+ "@serverless-guru/prettier-plugin-import-order": "^0.3.0",
29
+ "@types/glob": "^8.0.0",
28
30
  "@types/node": "^18.11.9",
29
31
  "@types/semver": "^7.3.13",
30
32
  "@typescript-eslint/eslint-plugin": "^5.42.1",
@@ -42,9 +44,9 @@
42
44
  "@actions/core": "^1.10.0",
43
45
  "@actions/exec": "^1.1.1",
44
46
  "@actions/github": "^5.1.1",
45
- "@actions/glob": "^0.3.0",
46
47
  "@octokit/plugin-retry": "^4.0.3",
47
48
  "@octokit/plugin-throttling": "^4.3.2",
49
+ "glob": "^8.0.3",
48
50
  "semver": "^7.3.8"
49
51
  }
50
52
  }