@cmflow/cli 1.0.16 → 1.1.1-alpha.1
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/.prettierignore +5 -0
- package/.prettierrc +10 -0
- package/README.md +106 -32
- package/bin/cm-changelog.js +20 -12
- package/bin/cm-clean.js +4 -7
- package/bin/cm-config.js +8 -8
- package/bin/cm-deploy.js +4 -8
- package/bin/cm-fetch.js +7 -7
- package/bin/cm-finish.js +9 -9
- package/bin/cm-merge.js +7 -7
- package/bin/cm-publish.js +10 -10
- package/bin/cm-push.js +10 -10
- package/bin/cm-rebase.js +10 -10
- package/bin/cm-republish.js +7 -7
- package/bin/cm-start.js +10 -10
- package/bin/cm.js +20 -20
- package/bin/cmrelease.js +2 -2
- package/eslint.config.mjs +67 -0
- package/package.json +27 -21
- package/release.config.mjs +49 -19
- package/src/commands/changelog.js +23 -23
- package/src/commands/clean.js +13 -13
- package/src/commands/config.js +8 -8
- package/src/commands/deploy.js +15 -20
- package/src/commands/fetch.js +7 -10
- package/src/commands/finish.js +18 -19
- package/src/commands/index.js +10 -11
- package/src/commands/merge.js +30 -14
- package/src/commands/prompts/branches.js +20 -20
- package/src/commands/push.js +11 -14
- package/src/commands/rebase.js +17 -19
- package/src/commands/release.js +10 -11
- package/src/commands/republish.js +11 -14
- package/src/commands/start.js +66 -38
- package/src/commands/tasks/merge-branch.js +41 -37
- package/src/commands/tasks/push-branch.js +5 -11
- package/src/commands/tasks/rebase-all-branches.js +19 -24
- package/src/commands/tasks/refresh-repository.js +26 -24
- package/src/commands/tasks/run-test.js +11 -17
- package/src/commands/tasks/update-branch.js +33 -30
- package/src/commands/tasks/update-dependencies.js +38 -32
- package/src/commands/utils/check-install.js +16 -15
- package/src/common/cli/cli.js +55 -57
- package/src/common/cli/docker.js +31 -28
- package/src/common/cli/docker.test.js +94 -96
- package/src/common/cli/git.js +59 -68
- package/src/common/cli/git.test.js +187 -189
- package/src/common/cli/lerna.js +12 -12
- package/src/common/cli/lerna.test.js +38 -40
- package/src/common/cli/npm.js +17 -17
- package/src/common/cli/npm.test.js +38 -40
- package/src/common/cli/yarn.js +17 -17
- package/src/common/cli/yarn.test.js +40 -40
- package/src/common/configure-git-workspace.js +11 -17
- package/src/common/get-config.js +63 -119
- package/src/common/get-package-json.js +4 -4
- package/src/common/get-release-config.js +4 -5
- package/src/common/index.js +10 -10
- package/src/common/run-command.js +26 -28
- package/src/common/run-command.test.js +35 -39
- package/src/index.js +10 -1
- package/src/semantic/core/analyze-commits.js +17 -0
- package/src/semantic/core/fail.js +29 -0
- package/src/semantic/core/generate-notes.js +11 -0
- package/src/semantic/core/prepare/bump-version.js +38 -0
- package/src/semantic/core/prepare/post.js +38 -0
- package/src/semantic/core/prepare/run.js +22 -0
- package/src/semantic/core/publish.js +9 -0
- package/src/semantic/core/success.js +37 -0
- package/src/semantic/core/verify-conditions.js +32 -0
- package/src/semantic/core/verify-release.js +9 -0
- package/src/semantic/define-config.js +68 -0
- package/src/semantic/docker/publish.js +5 -0
- package/src/semantic/docker/success.js +9 -0
- package/src/semantic/utils/bump-packages-version.js +52 -0
- package/src/semantic/utils/bump-packages-version.test.js +75 -0
- package/src/semantic/utils/calculate-snapshot-version.js +15 -0
- package/src/semantic/utils/calculate-snapshot-version.test.js +67 -0
- package/src/semantic/utils/display-package-info.js +11 -0
- package/src/semantic/utils/display-release-info.js +12 -0
- package/src/semantic/utils/docker-clean-tags.js +51 -0
- package/src/semantic/utils/docker-clean-tags.test.js +61 -0
- package/src/semantic/utils/docker-publish.js +23 -0
- package/src/semantic/utils/docker-publish.test.js +44 -0
- package/src/semantic/utils/log-section.js +5 -0
- package/src/semantic/utils/release-rules.js +5 -0
- package/src/semantic/utils/transform-writer.js +75 -0
- package/src/workflow/index.js +22 -22
- package/tsconfig.json +54 -0
- package/vitest.config.mts +10 -0
- package/bin/cm-publish-pages.js +0 -12
- package/semantic.js +0 -1
- package/src/commands/publish-pages.js +0 -29
- package/src/common/cli/heroku.js +0 -21
- package/src/common/cli/heroku.test.js +0 -62
- package/src/main.js +0 -10
- package/src/semantic-release/actions/analyze-commits.js +0 -14
- package/src/semantic-release/actions/fail.js +0 -16
- package/src/semantic-release/actions/generate-notes.js +0 -12
- package/src/semantic-release/actions/index.js +0 -8
- package/src/semantic-release/actions/prepare.js +0 -114
- package/src/semantic-release/actions/publish.js +0 -17
- package/src/semantic-release/actions/success.js +0 -32
- package/src/semantic-release/actions/verify-conditions.js +0 -30
- package/src/semantic-release/actions/verify-release.js +0 -9
- package/src/semantic-release/get-semantic-config.js +0 -115
- package/src/semantic-release/utils/bump-packages-version.js +0 -51
- package/src/semantic-release/utils/bump-packages-version.test.js +0 -78
- package/src/semantic-release/utils/calculate-snapshot-version.js +0 -10
- package/src/semantic-release/utils/calculate-snapshot-version.test.js +0 -69
- package/src/semantic-release/utils/display-package-info.js +0 -11
- package/src/semantic-release/utils/display-release-info.js +0 -12
- package/src/semantic-release/utils/docker-clean-tags.js +0 -45
- package/src/semantic-release/utils/docker-clean-tags.test.js +0 -63
- package/src/semantic-release/utils/docker-publish.js +0 -47
- package/src/semantic-release/utils/docker-publish.test.js +0 -67
- package/src/semantic-release/utils/ghpages-publish.js +0 -16
- package/src/semantic-release/utils/log-section.js +0 -5
- /package/src/{semantic-release → semantic}/utils/__mock__/test1/package.json +0 -0
- /package/src/{semantic-release → semantic}/utils/__mock__/test1/packages/a/package.json +0 -0
- /package/src/{semantic-release → semantic}/utils/__mock__/test1/packages/b/package.json +0 -0
- /package/src/{semantic-release → semantic}/utils/__mock__/test2/package.json +0 -0
- /package/src/{semantic-release → semantic}/utils/__mock__/test2/packages/a/package.json +0 -0
- /package/src/{semantic-release → semantic}/utils/__mock__/test2/packages/b/package.json +0 -0
|
@@ -1,53 +1,51 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
})
|
|
8
|
-
const {
|
|
9
|
-
const { lerna } = await import('./lerna.js')
|
|
10
|
-
const { Cli } = await import('./cli.js')
|
|
1
|
+
vi.mock("execa", () => {
|
|
2
|
+
const execaMock = vi.fn();
|
|
3
|
+
execaMock.sync = vi.fn();
|
|
4
|
+
return { default: execaMock };
|
|
5
|
+
});
|
|
6
|
+
const { default: execa } = await import("execa");
|
|
7
|
+
const { lerna } = await import("./lerna.js");
|
|
8
|
+
const { Cli } = await import("./cli.js");
|
|
11
9
|
|
|
12
10
|
execa.sync.mockImplementation((...args) => {
|
|
13
11
|
return {
|
|
14
|
-
stdout: `CMD: ${[].concat(...args.filter(arg => typeof arg ===
|
|
15
|
-
}
|
|
16
|
-
})
|
|
12
|
+
stdout: `CMD: ${[].concat(...args.filter((arg) => typeof arg === "string" || Array.isArray(arg))).join(" ")}`
|
|
13
|
+
};
|
|
14
|
+
});
|
|
17
15
|
|
|
18
|
-
execa.mockReturnValue({})
|
|
16
|
+
execa.mockReturnValue({});
|
|
19
17
|
|
|
20
|
-
describe(
|
|
18
|
+
describe("LernaCli", () => {
|
|
21
19
|
beforeEach(() => {
|
|
22
|
-
|
|
23
|
-
return `CMD: ${[].concat(...args.filter(arg => typeof arg ===
|
|
24
|
-
})
|
|
25
|
-
})
|
|
26
|
-
describe(
|
|
27
|
-
it(
|
|
28
|
-
const result = lerna.newVersion(
|
|
20
|
+
vi.spyOn(Cli, "getRaw").mockImplementation((...args) => {
|
|
21
|
+
return `CMD: ${[].concat(...args.filter((arg) => typeof arg === "string" || Array.isArray(arg))).join(" ")}`;
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
describe("newVersion", () => {
|
|
25
|
+
it("should run add cmd", () => {
|
|
26
|
+
const result = lerna.newVersion("1.0.0");
|
|
29
27
|
|
|
30
|
-
expect(result.stdout).toEqual(
|
|
31
|
-
})
|
|
32
|
-
})
|
|
33
|
-
describe(
|
|
28
|
+
expect(result.stdout).toEqual("CMD: lerna version 1.0.0 --exact --yes --no-git-tag-version --no-push");
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
describe("run", () => {
|
|
34
32
|
it('should run "run" cmd', async () => {
|
|
35
|
-
await lerna.run(
|
|
33
|
+
await lerna.run("run-arg");
|
|
36
34
|
|
|
37
|
-
expect(execa).toHaveBeenCalledWith(
|
|
35
|
+
expect(execa).toHaveBeenCalledWith("lerna", ["run", "run-arg"], {
|
|
38
36
|
cwd: process.cwd(),
|
|
39
|
-
stdio:
|
|
40
|
-
})
|
|
41
|
-
})
|
|
42
|
-
})
|
|
43
|
-
describe(
|
|
37
|
+
stdio: "inherit"
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
describe("install", () => {
|
|
44
42
|
it('should run "install" cmd', async () => {
|
|
45
|
-
await lerna.install(
|
|
43
|
+
await lerna.install("install-arg");
|
|
46
44
|
|
|
47
|
-
expect(execa).toHaveBeenCalledWith(
|
|
45
|
+
expect(execa).toHaveBeenCalledWith("lerna", ["install", "install-arg"], {
|
|
48
46
|
cwd: process.cwd(),
|
|
49
|
-
stdio:
|
|
50
|
-
})
|
|
51
|
-
})
|
|
52
|
-
})
|
|
53
|
-
})
|
|
47
|
+
stdio: "inherit"
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
});
|
package/src/common/cli/npm.js
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import { Cli } from
|
|
1
|
+
import { Cli } from "./cli.js";
|
|
2
2
|
|
|
3
3
|
class NpmCli extends Cli {
|
|
4
|
-
constructor
|
|
5
|
-
super(
|
|
4
|
+
constructor() {
|
|
5
|
+
super("npm");
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
newVersion
|
|
9
|
-
return this.version(
|
|
8
|
+
newVersion(version) {
|
|
9
|
+
return this.version("--no-git-tag-version", version);
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
version
|
|
13
|
-
return this.sync(
|
|
12
|
+
version(...args) {
|
|
13
|
+
return this.sync("version", ...args);
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
run
|
|
17
|
-
return super.run(
|
|
16
|
+
run(...args) {
|
|
17
|
+
return super.run("run", ...args);
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
install
|
|
21
|
-
return super.run(
|
|
20
|
+
install(...args) {
|
|
21
|
+
return super.run("install", ...args);
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
restore
|
|
29
|
-
return super.run(
|
|
25
|
+
* Reinstall dependencies without package-lock mutation
|
|
26
|
+
* @returns {Promise<unknown>}
|
|
27
|
+
*/
|
|
28
|
+
restore() {
|
|
29
|
+
return super.run("ci");
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
export const npm = new NpmCli()
|
|
33
|
+
export const npm = new NpmCli();
|
|
@@ -1,53 +1,51 @@
|
|
|
1
|
-
|
|
1
|
+
vi.mock("execa", () => {
|
|
2
|
+
const execaMock = vi.fn();
|
|
3
|
+
execaMock.sync = vi.fn();
|
|
4
|
+
return { default: execaMock };
|
|
5
|
+
});
|
|
2
6
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
return { default: execaMock }
|
|
7
|
-
})
|
|
8
|
-
|
|
9
|
-
const { default: execa } = await import('execa')
|
|
10
|
-
const { npm } = await import('./npm.js')
|
|
11
|
-
const { Cli } = await import('./cli.js')
|
|
7
|
+
const { default: execa } = await import("execa");
|
|
8
|
+
const { npm } = await import("./npm.js");
|
|
9
|
+
const { Cli } = await import("./cli.js");
|
|
12
10
|
|
|
13
11
|
execa.sync.mockImplementation((...args) => {
|
|
14
12
|
return {
|
|
15
|
-
stdout: `CMD: ${[].concat(...args.filter(arg => typeof arg ===
|
|
16
|
-
}
|
|
17
|
-
})
|
|
18
|
-
execa.mockReturnValue({})
|
|
13
|
+
stdout: `CMD: ${[].concat(...args.filter((arg) => typeof arg === "string" || Array.isArray(arg))).join(" ")}`
|
|
14
|
+
};
|
|
15
|
+
});
|
|
16
|
+
execa.mockReturnValue({});
|
|
19
17
|
|
|
20
|
-
describe(
|
|
18
|
+
describe("NpmCli", () => {
|
|
21
19
|
beforeEach(() => {
|
|
22
|
-
|
|
23
|
-
return `CMD: ${[].concat(...args.filter(arg => typeof arg ===
|
|
24
|
-
})
|
|
25
|
-
})
|
|
26
|
-
describe(
|
|
27
|
-
it(
|
|
28
|
-
const result = npm.newVersion(
|
|
20
|
+
vi.spyOn(Cli, "getRaw").mockImplementation((...args) => {
|
|
21
|
+
return `CMD: ${[].concat(...args.filter((arg) => typeof arg === "string" || Array.isArray(arg))).join(" ")}`;
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
describe("newVersion", () => {
|
|
25
|
+
it("should run newVersion cmd", () => {
|
|
26
|
+
const result = npm.newVersion("1.0.0");
|
|
29
27
|
|
|
30
|
-
expect(result.stdout).toEqual(
|
|
31
|
-
})
|
|
32
|
-
})
|
|
33
|
-
describe(
|
|
28
|
+
expect(result.stdout).toEqual("CMD: npm version --no-git-tag-version 1.0.0");
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
describe("run", () => {
|
|
34
32
|
it('should run "run" cmd', async () => {
|
|
35
|
-
await npm.run(
|
|
33
|
+
await npm.run("run-arg");
|
|
36
34
|
|
|
37
|
-
expect(execa).toHaveBeenCalledWith(
|
|
35
|
+
expect(execa).toHaveBeenCalledWith("npm", ["run", "run-arg"], {
|
|
38
36
|
cwd: process.cwd(),
|
|
39
|
-
stdio:
|
|
40
|
-
})
|
|
41
|
-
})
|
|
42
|
-
})
|
|
43
|
-
describe(
|
|
37
|
+
stdio: "inherit"
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
describe("install", () => {
|
|
44
42
|
it('should run "install" cmd', async () => {
|
|
45
|
-
await npm.install(
|
|
43
|
+
await npm.install("install-arg");
|
|
46
44
|
|
|
47
|
-
expect(execa).toHaveBeenCalledWith(
|
|
45
|
+
expect(execa).toHaveBeenCalledWith("npm", ["install", "install-arg"], {
|
|
48
46
|
cwd: process.cwd(),
|
|
49
|
-
stdio:
|
|
50
|
-
})
|
|
51
|
-
})
|
|
52
|
-
})
|
|
53
|
-
})
|
|
47
|
+
stdio: "inherit"
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
});
|
package/src/common/cli/yarn.js
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import { Cli } from
|
|
1
|
+
import { Cli } from "./cli.js";
|
|
2
2
|
|
|
3
3
|
class YarnCli extends Cli {
|
|
4
|
-
constructor
|
|
5
|
-
super(
|
|
4
|
+
constructor() {
|
|
5
|
+
super("yarn");
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
newVersion
|
|
9
|
-
return this.version(
|
|
8
|
+
newVersion(version) {
|
|
9
|
+
return this.version("--no-git-tag-version", "--new-version", version);
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
version
|
|
13
|
-
return this.sync(
|
|
12
|
+
version(...args) {
|
|
13
|
+
return this.sync("version", ...args);
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
run
|
|
17
|
-
return super.run(...args)
|
|
16
|
+
run(...args) {
|
|
17
|
+
return super.run(...args);
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
install
|
|
21
|
-
return super.run(
|
|
20
|
+
install(...args) {
|
|
21
|
+
return super.run("install", ...args);
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
restore
|
|
29
|
-
return super.run(
|
|
25
|
+
* Reinstall dependencies without yarn.lock mutation
|
|
26
|
+
* @returns {Promise<unknown>}
|
|
27
|
+
*/
|
|
28
|
+
restore() {
|
|
29
|
+
return super.run("install", "--immutable");
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
export const yarn = new YarnCli()
|
|
33
|
+
export const yarn = new YarnCli();
|
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
|
|
1
|
+
vi.mock("execa", () => {
|
|
2
|
+
const execaMock = vi.fn();
|
|
3
|
+
execaMock.sync = vi.fn();
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
})
|
|
8
|
-
const {
|
|
9
|
-
const { yarn } = await import('./yarn.js')
|
|
10
|
-
const { Cli } = await import('./cli.js')
|
|
5
|
+
return { default: execaMock };
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
const { default: execa } = await import("execa");
|
|
9
|
+
const { yarn } = await import("./yarn.js");
|
|
10
|
+
const { Cli } = await import("./cli.js");
|
|
11
11
|
|
|
12
12
|
execa.sync.mockImplementation((...args) => {
|
|
13
13
|
return {
|
|
14
|
-
stdout: `CMD: ${[].concat(...args.filter(arg => typeof arg ===
|
|
15
|
-
}
|
|
16
|
-
})
|
|
14
|
+
stdout: `CMD: ${[].concat(...args.filter((arg) => typeof arg === "string" || Array.isArray(arg))).join(" ")}`
|
|
15
|
+
};
|
|
16
|
+
});
|
|
17
17
|
|
|
18
|
-
execa.mockReturnValue({})
|
|
18
|
+
execa.mockReturnValue({});
|
|
19
19
|
|
|
20
|
-
describe(
|
|
20
|
+
describe("YarnCli", () => {
|
|
21
21
|
beforeEach(() => {
|
|
22
|
-
|
|
23
|
-
return `CMD: ${[].concat(...args.filter(arg => typeof arg ===
|
|
24
|
-
})
|
|
25
|
-
})
|
|
26
|
-
describe(
|
|
27
|
-
it(
|
|
28
|
-
const result = yarn.newVersion(
|
|
29
|
-
|
|
30
|
-
expect(result.stdout).toEqual(
|
|
31
|
-
})
|
|
32
|
-
})
|
|
33
|
-
describe(
|
|
22
|
+
vi.spyOn(Cli, "getRaw").mockImplementation((...args) => {
|
|
23
|
+
return `CMD: ${[].concat(...args.filter((arg) => typeof arg === "string" || Array.isArray(arg))).join(" ")}`;
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
describe("newVersion", () => {
|
|
27
|
+
it("should run newVersion cmd", () => {
|
|
28
|
+
const result = yarn.newVersion("1.0.0");
|
|
29
|
+
|
|
30
|
+
expect(result.stdout).toEqual("CMD: yarn version --no-git-tag-version --new-version 1.0.0");
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
describe("run", () => {
|
|
34
34
|
it('should run "run" cmd', async () => {
|
|
35
|
-
await yarn.run(
|
|
35
|
+
await yarn.run("run-arg");
|
|
36
36
|
|
|
37
|
-
expect(execa).toHaveBeenCalledWith(
|
|
37
|
+
expect(execa).toHaveBeenCalledWith("yarn", ["run-arg"], {
|
|
38
38
|
cwd: process.cwd(),
|
|
39
|
-
stdio:
|
|
40
|
-
})
|
|
41
|
-
})
|
|
42
|
-
})
|
|
43
|
-
describe(
|
|
39
|
+
stdio: "inherit"
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
describe("install", () => {
|
|
44
44
|
it('should run "install" cmd', async () => {
|
|
45
|
-
await yarn.install(
|
|
45
|
+
await yarn.install("install-arg");
|
|
46
46
|
|
|
47
|
-
expect(execa).toHaveBeenCalledWith(
|
|
47
|
+
expect(execa).toHaveBeenCalledWith("yarn", ["install", "install-arg"], {
|
|
48
48
|
cwd: process.cwd(),
|
|
49
|
-
stdio:
|
|
50
|
-
})
|
|
51
|
-
})
|
|
52
|
-
})
|
|
53
|
-
})
|
|
49
|
+
stdio: "inherit"
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
});
|
|
@@ -1,27 +1,21 @@
|
|
|
1
|
-
import { git } from
|
|
1
|
+
import { git } from "./cli/git.js";
|
|
2
2
|
|
|
3
|
-
export function configureGitWorkspace
|
|
3
|
+
export function configureGitWorkspace(context) {
|
|
4
4
|
const {
|
|
5
5
|
logger,
|
|
6
|
-
config: {
|
|
7
|
-
|
|
8
|
-
REPOSITORY_URL,
|
|
9
|
-
ORIGIN,
|
|
10
|
-
GIT_USER_NAME,
|
|
11
|
-
GIT_USER_EMAIL
|
|
12
|
-
}
|
|
13
|
-
} = context
|
|
6
|
+
config: { SCM_TOKEN, REPOSITORY_URL, ORIGIN, GIT_USER_NAME, GIT_USER_EMAIL }
|
|
7
|
+
} = context;
|
|
14
8
|
|
|
15
9
|
if (GIT_USER_NAME && GIT_USER_EMAIL) {
|
|
16
|
-
git.config(
|
|
17
|
-
git.config(
|
|
10
|
+
git.config("--global", "user.name", `"${GIT_USER_NAME}"`);
|
|
11
|
+
git.config("--global", "user.email", `"${GIT_USER_EMAIL}"`);
|
|
18
12
|
}
|
|
19
13
|
|
|
20
|
-
if (
|
|
21
|
-
const repository = REPOSITORY_URL.replace(
|
|
14
|
+
if (SCM_TOKEN) {
|
|
15
|
+
const repository = REPOSITORY_URL.replace("https://", "");
|
|
22
16
|
|
|
23
|
-
logger.info(`Configure remote repository ${repository}`)
|
|
24
|
-
git.remote(
|
|
25
|
-
git.remote(
|
|
17
|
+
logger.info(`Configure remote repository ${repository}`);
|
|
18
|
+
git.remote("remove", ORIGIN).sync();
|
|
19
|
+
git.remote("add", ORIGIN, `https://${SCM_TOKEN}@${repository}`).sync();
|
|
26
20
|
}
|
|
27
21
|
}
|