@cmflow/cli 2.0.0-alpha.1 → 2.0.0-alpha.11

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/.yarnrc.yml ADDED
@@ -0,0 +1,3 @@
1
+ nodeLinker: node-modules
2
+
3
+ yarnPath: .yarn/releases/yarn-4.7.0.cjs
package/README.md CHANGED
@@ -47,39 +47,64 @@ Then create `release.config.js` with this configuration:
47
47
  import { defineConfig } from '@cmflow/cli'
48
48
 
49
49
  export default defineConfig({
50
- verifyConditions: ['@cmflow/cli/semantic/verify-conditions'],
51
- analyzeCommits: ['@cmflow/cli/semantic/analyze-commits'],
52
- verifyRelease: ['@cmflow/cli/semantic/verify-release'],
53
- generateNotes: ['@cmflow/cli/semantic/generate-notes'],
50
+ verifyConditions: ['@cmflow/cli/semantic/core/verify-conditions'],
51
+ analyzeCommits: ['@cmflow/cli/semantic/core/analyze-commits'],
52
+ verifyRelease: ['@cmflow/cli/semantic/core/verify-release'],
53
+ generateNotes: [
54
+ [
55
+ "@cmflow/cli/semantic/conditional", // add this task to trigger build npm task
56
+ {
57
+ // when: (context) => context.branch.type === "release" // default condition to run the task
58
+ run: ["@semantic-release/core/release-notes-generator"]
59
+ }
60
+ ]
61
+ ],
54
62
  prepare: [
55
- '@cmflow/cli/semantic/prepare/bump-version',
63
+ '@cmflow/cli/semantic/core/prepare/bump-version',
56
64
  [
57
- '@cmflow/cli/semantic/prepare/run', // add this task to trigger build npm task
65
+ '@cmflow/cli/semantic/core/prepare/run', // add this task to trigger build npm task
58
66
  {
59
67
  command: 'build'
60
68
  }
61
69
  ],
62
70
  [
63
- '@cmflow/cli/semantic/prepare/run', // add this task to trigger build npm task
71
+ '@cmflow/cli/semantic/core/prepare/run', // add this task to trigger build npm task
64
72
  {
65
73
  command: 'test_e2e'
66
74
  }
67
75
  ],
68
- '@cmflow/cli/semantif/prepare/post'
76
+ [
77
+ '@cmflow/cli/semantic/core/conditional', // add this task to trigger build npm task
78
+ {
79
+ // when: (context) => context.branch.type === "release" // default condition to run the task
80
+ run: [
81
+ '@cmflow/cli/semantic/core/prepare/commit'
82
+ ]
83
+ }
84
+ ]
69
85
  ],
70
86
  publish: [
71
87
  [
72
- '@cmflow/cli/semantic/conditional',
88
+ '@cmflow/cli/semantic/core/conditional',
73
89
  {
74
90
  // when: (context) => context.branch.type === "release" // default condition to run the task
75
- run: '@semantic-release/github' // only run if the conditional rule is true
91
+ run: [
92
+ '@cmflow/cli/semantic/core/publish/sync-repository',
93
+ '@semantic-release/github'
94
+ ] // only run if the conditional rule is true
95
+ }
96
+ ],
97
+ [
98
+ '@cmflow/cli/semantic/core/conditional', // run process.exit(0) if the branch is not a release branch - legacy: maybe not necessary now all task are conditional
99
+ {
100
+ when: (context) => context.branch.type !== 'release',
101
+ run: '@cmflow/cli/semantic/core/publish/exit'
76
102
  }
77
103
  ]
78
104
  ],
79
105
  success: [
80
- '@cmflow/cli/semantic/success',
81
106
  [
82
- '@cmflow/cli/semantic/conditional',
107
+ '@cmflow/cli/semantic/core/conditional',
83
108
  {
84
109
  // when: (context) => context.branch.type === "release" // default condition to run the task
85
110
  run: '@semantic-release/github' // only run if the conditional rule is true
@@ -87,9 +112,8 @@ export default defineConfig({
87
112
  ]
88
113
  ],
89
114
  fail: [
90
- '@cmflow/cli/semantic/fail',
91
115
  [
92
- '@cmflow/cli/semantic/conditional',
116
+ "@cmflow/cli/semantic/core/conditional",
93
117
  {
94
118
  // when: (context) => context.branch.type === "release" // default condition to run the task
95
119
  run: '@semantic-release/github' // only run if the conditional rule is true
@@ -115,7 +139,7 @@ Now, CmFlow and semantic release are correctly installed on your project.
115
139
 
116
140
  ### Condition step (publish, success, fail)
117
141
 
118
- CMFlow provide a `@cmflow/cli/semantic/conditional` task to run one task or many task only if a condition is true. The condition is a
142
+ CMFlow provide a `@cmflow/cli/semantic/core/conditional` task to run one task or many task only if a condition is true. The condition is a
119
143
  function that takes the semantic context as parameter and return a boolean.
120
144
 
121
145
  You can customize the condition to run the task by adding a `when` property to the configuration object.
@@ -123,7 +147,7 @@ You can customize the condition to run the task by adding a `when` property to t
123
147
  ```javascript
124
148
  export default defineConfig({
125
149
  publish: [
126
- '@cmflow/cli/semantic/conditional',
150
+ '@cmflow/cli/semantic/core/conditional',
127
151
  {
128
152
  when: (context) => context.branch.type === 'release', // default condition to run the task
129
153
  run: ['@semantic-release/github', '@semantic-release/github'] // only run if the conditional rule is true
@@ -149,6 +173,26 @@ Example:
149
173
  }
150
174
  ```
151
175
 
176
+ ### Generate release.info file
177
+
178
+ CmFlow release generate a `release.info` file in the root of your project. This file contains the branch name.
179
+
180
+ ```js
181
+ import { defineConfig } from '@cmflow/cli'
182
+
183
+ export default defineConfig({
184
+ prepare: [
185
+ '@cmflow/cli/semantic/prepare/bump-version',
186
+ [
187
+ '@cmflow/cli/semantic/prepare/release-info',
188
+ {
189
+ path: './resources/release.info'
190
+ }
191
+ ]
192
+ ]
193
+ })
194
+ ```
195
+
152
196
  ### Deploy on Docker Hub
153
197
 
154
198
  Add the following configuration to your `release.config.js`:
package/bin/cm-config.js CHANGED
File without changes
package/bin/cm-fetch.js CHANGED
File without changes
package/bin/cm-finish.js CHANGED
File without changes
package/bin/cm-merge.js CHANGED
File without changes
package/bin/cm-publish.js CHANGED
File without changes
package/bin/cm-push.js CHANGED
File without changes
package/bin/cm-rebase.js CHANGED
File without changes
File without changes
package/bin/cm-start.js CHANGED
File without changes
package/bin/cm.js CHANGED
File without changes
package/bin/cmrelease.js CHANGED
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cmflow/cli",
3
- "version": "2.0.0-alpha.1",
3
+ "version": "2.0.0-alpha.11",
4
4
  "description": "An awesome Git Flow",
5
5
  "author": "camfou",
6
6
  "license": "MIT",
@@ -8,36 +8,31 @@
8
8
  "main": "./src/index.js",
9
9
  "module": "./src/index.js",
10
10
  "type": "module",
11
- "private": false,
12
11
  "bin": {
12
+ "checkfeatures": "./bin/checkfeatures.sh",
13
13
  "cm": "./bin/cm.js",
14
+ "cmconfig": "bin/cm-config.js",
15
+ "cmexpedit": "./bin/cmexpedit.sh",
14
16
  "cmfetch": "bin/cm-fetch.js",
15
- "cmrebase": "bin/cm-rebase.js",
16
17
  "cmfinish": "bin/cm-finish.js",
17
- "cmexpedit": "./bin/cmexpedit.sh",
18
+ "cmmerge": "./bin/cm-merge.js",
18
19
  "cmpublish": "bin/cm-publish.js",
19
- "cmrepublish": "bin/cm-republish.js",
20
- "cmpush": "bin/cm-push.js",
21
20
  "cmpull": "./bin/cmpull.sh",
22
- "cmstart": "bin/cm-start.js",
23
- "checkfeatures": "./bin/checkfeatures.sh",
21
+ "cmpush": "bin/cm-push.js",
22
+ "cmrebase": "bin/cm-rebase.js",
24
23
  "cmrelease": "./bin/cmrelease.js",
25
- "cmmerge": "./bin/cm-merge.js",
26
- "cmchangelog": "bin/cm-changelog.js",
27
- "cmconfig": "bin/cm-config.js"
24
+ "cmrepublish": "bin/cm-republish.js",
25
+ "cmstart": "bin/cm-start.js"
28
26
  },
29
27
  "exports": {
30
- ".": "./index.js",
31
- "./semantic/prepare/*": "./src/semantic-release/core/prepare/*.js",
32
- "./semantic/*": "./src/semantic-release/core/*.js",
33
- "./semantic/docker/*": "./src/semantic-release/docker/*.js"
28
+ ".": "./src/index.js",
29
+ "./semantic/*": "./src/semantic/*.js"
34
30
  },
35
31
  "dependencies": {
32
+ "any-observable": "0.5.1",
36
33
  "axios": "1.8.2",
37
34
  "chalk": "^4.1.0",
38
35
  "commander": "5.1.0",
39
- "conventional-changelog": "3.1.25",
40
- "conventional-changelog-cli": "2.2.2",
41
36
  "execa": "5.1.1",
42
37
  "figures": "3.2.0",
43
38
  "fs-extra": "^10.1.0",
@@ -47,14 +42,16 @@
47
42
  "listr": "0.14.3",
48
43
  "lodash": "4.17.21",
49
44
  "rxjs": "7.8.1",
50
- "semantic-release": "23.1.1",
51
- "semver": "7.3.7",
45
+ "semantic-release": ">=24.2.3",
46
+ "semver": "7.7.1",
52
47
  "split": "1.0.1"
53
48
  },
54
49
  "devDependencies": {
50
+ "@semantic-release/github": "11.0.1",
51
+ "@semantic-release/release-notes-generator": ">=14.0.3",
55
52
  "@stylistic/eslint-plugin": "^4.2.0",
56
- "@typescript-eslint/parser": "8.26.1",
57
53
  "@typescript-eslint/eslint-plugin": "8.26.1",
54
+ "@typescript-eslint/parser": "8.26.1",
58
55
  "eslint": "9.21.0",
59
56
  "eslint-config-prettier": "10.0.2",
60
57
  "eslint-formatter-junit": "^8.40.0",
@@ -62,15 +59,14 @@
62
59
  "eslint-plugin-simple-import-sort": "12.1.1",
63
60
  "eslint-plugin-vitest": "0.5.4",
64
61
  "husky": "4.3.6",
65
- "prettier": "3.5.1",
66
62
  "lint-staged": "10.5.3",
67
- "vitest": "^3.0.8",
68
- "typescript": "5.8.2"
63
+ "prettier": "3.5.1",
64
+ "typescript": "5.8.2",
65
+ "vitest": "^3.0.8"
69
66
  },
70
67
  "peerDependencies": {
71
- "@semantic-release/commit-analyzer": "^11.1.0",
72
- "@semantic-release/github": "^10.1.1",
73
- "@semantic-release/release-notes-generator": "^12.1.0"
68
+ "@semantic-release/commit-analyzer": ">=13.0.1",
69
+ "@semantic-release/release-notes-generator": ">=14.0.3"
74
70
  },
75
71
  "peerDependenciesMeta": {
76
72
  "@semantic-release/commit-analyzer": {
@@ -87,8 +83,7 @@
87
83
  "lint_ci": "eslint --format junit --output-file ./reports/eslint.xml",
88
84
  "lint_fix": "eslint --fix",
89
85
  "release": "node bin/cmrelease.js",
90
- "release_dry_run": "node bin/cmrelease.js --dry-run",
91
- "build_changelog": "node bin/cm-changelog.js"
86
+ "release_dry_run": "node bin/cmrelease.js --dry-run"
92
87
  },
93
88
  "husky": {
94
89
  "hooks": {
@@ -107,5 +102,6 @@
107
102
  "develop": "master",
108
103
  "production": "master"
109
104
  }
110
- }
105
+ },
106
+ "packageManager": "yarn@4.7.0"
111
107
  }
@@ -22,18 +22,17 @@ export default defineConfig({
22
22
  verifyConditions: ["./src/semantic/core/verify-conditions.js"],
23
23
  analyzeCommits: ["@semantic-release/commit-analyzer"],
24
24
  verifyRelease: ["./src/semantic/core/verify-release.js"],
25
- generateNotes: ["./src/semantic/core/generate-notes.js"],
26
- prepare: ["./src/semantic/core/prepare/bump-version.js", "./src/semantic/core/prepare/post.js"],
27
- publish: ["@semantic-release/github"],
28
- success: [
25
+ generateNotes: [
29
26
  [
30
- "./src/semantic/core/success.js",
27
+ "./src/semantic/core/conditional",
31
28
  {
32
- when: () => true
29
+ run: ["@semantic-release/release-notes-generator"]
33
30
  }
34
- ],
35
- "@semantic-release/github"
31
+ ]
36
32
  ],
33
+ prepare: ["./src/semantic/core/prepare/bump-version.js", "./src/semantic/core/prepare/commit.js"],
34
+ publish: ["./src/semantic/core/publish/sync-repository.js", "@semantic-release/github"],
35
+ success: ["@semantic-release/github"],
37
36
  fail: ["@semantic-release/github"],
38
37
  npmPublish: false
39
38
  });
@@ -1,4 +1,3 @@
1
- export * from "./changelog.js";
2
1
  export * from "./clean.js";
3
2
  export * from "./deploy.js";
4
3
  export * from "./fetch.js";
@@ -3,7 +3,7 @@ import { git } from "./cli/git.js";
3
3
  export function configureGitWorkspace(context) {
4
4
  const {
5
5
  logger,
6
- config: { SCM_TOKEN, REPOSITORY_URL, ORIGIN, GIT_USER_NAME, GIT_USER_EMAIL }
6
+ config: { SCM_TOKEN, REPOSITORY_URL, ORIGIN, GIT_USER_NAME, GIT_USER_EMAIL, GIT_DISABLE_SSL }
7
7
  } = context;
8
8
 
9
9
  if (GIT_USER_NAME && GIT_USER_EMAIL) {
@@ -11,6 +11,11 @@ export function configureGitWorkspace(context) {
11
11
  git.config("--global", "user.email", `"${GIT_USER_EMAIL}"`);
12
12
  }
13
13
 
14
+ if (GIT_DISABLE_SSL) {
15
+ logger.info("Disable SSL verification");
16
+ git.config("--global", "http.sslVerify", "false");
17
+ }
18
+
14
19
  if (SCM_TOKEN) {
15
20
  const repository = REPOSITORY_URL.replace("https://", "");
16
21
 
@@ -74,8 +74,20 @@ export function getCI() {
74
74
  export function getConfig() {
75
75
  const pkg = getPackageJson();
76
76
  const [owner, projectName] = pkg.name.replace(/^@/, "").split("/");
77
- const { PROJECT_NAME, DOCKER_HUB_ID, DOCKER_HUB_PWD, REF_COMMIT, GH_TOKEN, SCM_TOKEN, REPOSITORY_URL, GIT_USER_NAME, GIT_USER_EMAIL } =
78
- process.env;
77
+ const {
78
+ PROJECT_NAME,
79
+ DOCKER_HUB_ID,
80
+ DOCKER_HUB_PWD,
81
+ REF_COMMIT,
82
+ GH_TOKEN,
83
+ SCM_TOKEN,
84
+ REPOSITORY_URL,
85
+ GIT_DISABLE_SSL,
86
+ GIT_USER_NAME,
87
+ GIT_USER_EMAIL,
88
+ GITLAB_USER_EMAIL,
89
+ GITLAB_USER_NAME
90
+ } = process.env;
79
91
 
80
92
  const HAS_YARN = hasYarn();
81
93
  const IS_YARN_BERRY = HAS_YARN ? fs.existsSync(join(process.cwd(), ".yamlrc.yml")) : false;
@@ -113,8 +125,9 @@ export function getConfig() {
113
125
  GH_TOKEN,
114
126
  SCM_TOKEN: GH_TOKEN || SCM_TOKEN,
115
127
  REPOSITORY_URL: get(pkg, "repository.url", get(pkg, "repository", REPOSITORY_URL)),
116
- GIT_USER_NAME,
117
- GIT_USER_EMAIL,
128
+ GIT_USER_NAME: GIT_USER_NAME || GITLAB_USER_NAME,
129
+ GIT_USER_EMAIL: GIT_USER_EMAIL || GITLAB_USER_EMAIL,
130
+ GIT_DISABLE_SSL,
118
131
  BUMP_METHOD,
119
132
  WORKSPACES: pkg.workspaces || [],
120
133
  ...getCI()
@@ -1,25 +1,42 @@
1
1
  import { getConfig } from "../../common/index.js";
2
+
3
+ export function prepare(pluginConfig, context) {
4
+ return runAll("prepare", pluginConfig, context, context.branch?.type === "release");
5
+ }
6
+
2
7
  export function success(pluginConfig, context) {
3
- return runAll(pluginConfig, context, context.branch?.type === "release");
8
+ return runAll("success", pluginConfig, context, context.branch?.type === "release");
4
9
  }
5
10
 
6
11
  export function publish(pluginConfig, context) {
7
- return runAll(pluginConfig, context, context.branch?.type === "release");
12
+ return runAll("publish", pluginConfig, context, context.branch?.type === "release");
13
+ }
14
+
15
+ export function generateNotes(pluginConfig, context) {
16
+ return runAll("generateNotes", pluginConfig, context, context.branch?.type === "release");
8
17
  }
9
18
 
10
19
  export function fail(pluginConfig, context) {
11
- return runAll(pluginConfig, context, context.branch?.type === "release");
20
+ return runAll("fail", pluginConfig, context, context.branch?.type === "release");
12
21
  }
13
22
 
14
- async function runAll(pluginConfig, context, defaultCondition) {
23
+ async function runAll(step, pluginConfig, context, defaultCondition) {
15
24
  context.config = getConfig();
16
25
 
17
26
  const condition = pluginConfig.when !== undefined ? pluginConfig.if(context) : defaultCondition;
18
27
 
19
28
  if (condition && pluginConfig.run) {
20
29
  const tasks = [].concat(pluginConfig.run);
30
+
21
31
  for (const task of tasks) {
22
- await task(pluginConfig, context);
32
+ if (typeof task === "string") {
33
+ const mod = await import(task);
34
+ const taskFunction = mod[step];
35
+
36
+ if (taskFunction) {
37
+ await taskFunction(pluginConfig, context);
38
+ }
39
+ }
23
40
  }
24
41
  }
25
42
  }
@@ -0,0 +1,29 @@
1
+ import { configureGitWorkspace, getConfig, git } from "../../../common/index.js";
2
+
3
+ export async function prepare(pluginConfig, context) {
4
+ context.config = getConfig();
5
+
6
+ const {
7
+ logger,
8
+ config: { CI_NAME, BUILD_NUMBER }
9
+ } = context;
10
+
11
+ logger.info("Prepare release");
12
+
13
+ configureGitWorkspace(context);
14
+
15
+ logger.info("Adding files to commit");
16
+ git.add("-A").sync();
17
+
18
+ logger.info("Get commit stage status");
19
+ git.status();
20
+
21
+ const revisionMessage = `${CI_NAME} build: ${context.branch.name} ${BUILD_NUMBER} ${context.nextRelease.gitTag} [ci skip]`;
22
+
23
+ logger.info("Commit changes with revision message: ");
24
+ logger.info(revisionMessage);
25
+
26
+ git.commit("-m", revisionMessage).sync();
27
+
28
+ logger.success("Change committed");
29
+ }
@@ -0,0 +1,5 @@
1
+ import { writeFile } from "node:fs/promises";
2
+
3
+ export function prepare(pluginConfig, context) {
4
+ return writeFile(pluginConfig.path, context.branch.name, { encoding: "utf-8" });
5
+ }
@@ -0,0 +1,7 @@
1
+ import { getConfig } from "../../../common/index.js";
2
+
3
+ export async function prepare(pluginConfig, context) {
4
+ context.config = getConfig();
5
+ // avoid next semantic-release steps when is a prerelease or release branch with SKIP_GITHUB_PUBLISH
6
+ process.exit(0);
7
+ }
@@ -0,0 +1,42 @@
1
+ import { getConfig, git } from "../../../common/index.js";
2
+
3
+ export async function publish(pluginConfig, context) {
4
+ context.config = getConfig();
5
+
6
+ const {
7
+ logger,
8
+ config: { PRODUCTION_BRANCH, ORIGIN, DEVELOP_BRANCH }
9
+ } = context;
10
+
11
+ logger.info("Prepare release");
12
+
13
+ async function asyncCatchError(fn) {
14
+ try {
15
+ return await fn();
16
+ } catch (er) {
17
+ context.logger.error(String(er), er.stack);
18
+ }
19
+ }
20
+
21
+ await asyncCatchError(() => git.fetch());
22
+
23
+ if ([PRODUCTION_BRANCH, "alpha", "beta", "rc"].includes(context.branch.name)) {
24
+ logger.info(`Push ${PRODUCTION_BRANCH}`);
25
+
26
+ await asyncCatchError(() => {
27
+ logger.info(`git push --quiet --set-upstream ${ORIGIN} ${context.branch.name}`);
28
+
29
+ return git.push("--quiet", "--set-upstream", ORIGIN, context.branch.name);
30
+ });
31
+ }
32
+
33
+ if (PRODUCTION_BRANCH !== DEVELOP_BRANCH) {
34
+ logger.info(`Sync ${DEVELOP_BRANCH} with ${PRODUCTION_BRANCH}`);
35
+ logger.info(`git push -f ${ORIGIN} ${PRODUCTION_BRANCH}:refs/heads/${DEVELOP_BRANCH}`);
36
+
37
+ await asyncCatchError(async () => {
38
+ await git.push("-f", ORIGIN, `${PRODUCTION_BRANCH}:refs/heads/${DEVELOP_BRANCH}`);
39
+ logger.success(`${ORIGIN}/${DEVELOP_BRANCH} branch correctly updated`);
40
+ });
41
+ }
42
+ }
@@ -16,6 +16,8 @@ const transformCommitType = (commit) => {
16
16
  };
17
17
 
18
18
  export function transformWriter(commit, context) {
19
+ commit = { ...commit };
20
+
19
21
  const issues = [];
20
22
 
21
23
  commit.notes.forEach((note) => {
@@ -1,26 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- import commander from "commander";
4
-
5
- import { commands, runCommand } from "../src/index.js";
6
-
7
- commander
8
- .usage("cmchangelog [options]")
9
- .alias("cm changelog")
10
- .option(
11
- "-p, --preset <preset>",
12
- "Name of the preset you want to use. Must be one of the following:\n" +
13
- "angular, atom, codemirror, ember, eslint, express, jquery, jscs or jshint",
14
- "angular"
15
- )
16
- .option(
17
- "-r, --release-count <count>",
18
- "How many releases to be generated from the latest\n" +
19
- "If 0, the whole changelog will be regenerated and the outfile will be overwritten\n" +
20
- "Default: 0",
21
- 0
22
- )
23
- .option("-t, --tag-prefix <prefix>", "Tag prefix to consider when reading the tags")
24
- .parse(process.argv);
25
-
26
- runCommand(commands.Changelog, commander);
@@ -1,47 +0,0 @@
1
- import conventionalChangelog from "conventional-changelog";
2
- import { createWriteStream } from "fs";
3
- import { Observable } from "rxjs";
4
-
5
- export class Changelog {
6
- mapContext(commander, config) {
7
- return {
8
- preset: commander.preset || "angular",
9
- releaseCount: commander.releaseCount || 0,
10
- outfile: `${process.cwd()}/CHANGELOG.md`,
11
-
12
- tagPrefix: (config.tagFormat || commander.tagPrefix || "").replace("${version}", "")
13
- };
14
- }
15
-
16
- exec({ preset, releaseCount, outfile, tagPrefix }) {
17
- const writableStream = createWriteStream(outfile, { encoding: "utf8" });
18
-
19
- return new Observable((observer) => {
20
- const stream = conventionalChangelog({
21
- preset,
22
- releaseCount,
23
- path: `${process.cwd()}/package.json`,
24
- tagPrefix
25
- });
26
-
27
- stream.pipe(writableStream);
28
-
29
- stream.on("error", (err) => {
30
- observer.error(err);
31
- });
32
-
33
- stream.on("end", () => {
34
- observer.complete();
35
- });
36
- });
37
- }
38
-
39
- getTasks(ctx) {
40
- return [
41
- {
42
- title: "Generate changelog",
43
- task: () => this.exec(ctx)
44
- }
45
- ];
46
- }
47
- }
@@ -1,21 +0,0 @@
1
- import { git } from "../../common/index.js";
2
-
3
- /**
4
- * Remove the tag from the git repository if the release is not a prerelease.
5
- *
6
- * @param pluginConfig
7
- * @param context
8
- * @return {Promise<void>}
9
- */
10
- export async function fail(pluginConfig, context) {
11
- if (context.branch && context.branch.type !== "prerelease") {
12
- const {
13
- tagFormat,
14
- config: { ORIGIN }
15
- } = context;
16
-
17
- try {
18
- await git.push("--delete", ORIGIN, tagFormat.replace("${version}", context.nextRelease.version));
19
- } catch {}
20
- }
21
- }
@@ -1,11 +0,0 @@
1
- import * as releaseNotesPlugins from "@semantic-release/release-notes-generator";
2
-
3
- import { getConfig } from "../../common/index.js";
4
-
5
- export async function generateNotes(pluginConfig, context) {
6
- context.config = getConfig();
7
-
8
- if (context.branch.type === "release") {
9
- return releaseNotesPlugins.generateNotes(pluginConfig, context);
10
- }
11
- }
@@ -1,38 +0,0 @@
1
- import { configureGitWorkspace, getConfig, git } from "../../../common/index.js";
2
-
3
- export async function prepare(pluginConfig, context) {
4
- context.config = getConfig();
5
- const { branch } = context;
6
-
7
- if (branch.type === "release") {
8
- context.config = getConfig();
9
-
10
- const {
11
- logger,
12
- config: { CI_NAME, BUILD_NUMBER }
13
- } = context;
14
-
15
- logger.info("Prepare release");
16
-
17
- configureGitWorkspace(context);
18
-
19
- logger.info("Adding files to commit");
20
- git.add("-A").sync();
21
-
22
- logger.info("Get commit stage status");
23
- git.status();
24
-
25
- const revisionMessage = `${CI_NAME} build: ${context.branch.name} ${BUILD_NUMBER} ${context.nextRelease.gitTag} [ci skip]`;
26
-
27
- logger.info("Commit changes with revision message: ");
28
- logger.info(revisionMessage);
29
-
30
- git.commit("-m", revisionMessage).sync();
31
-
32
- logger.success("Change committed");
33
- return;
34
- }
35
-
36
- // avoid next semantic-release steps when is a prerelease or release branch with SKIP_GITHUB_PUBLISH
37
- process.exit(0);
38
- }