@simplysf/simply-cicd 0.27.0 → 0.28.0
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 +186 -35
- package/lib/commands/simply/cicd/happy-soup/release/create.d.ts +28 -0
- package/lib/commands/simply/cicd/happy-soup/release/create.js +114 -0
- package/lib/commands/simply/cicd/happy-soup/release/create.js.map +1 -0
- package/lib/commands/simply/cicd/happy-soup/release/stage.d.ts +37 -0
- package/lib/commands/simply/cicd/happy-soup/release/stage.js +111 -0
- package/lib/commands/simply/cicd/happy-soup/release/stage.js.map +1 -0
- package/lib/common/happySoup/flags.d.ts +27 -0
- package/lib/common/happySoup/flags.js +57 -0
- package/lib/common/happySoup/flags.js.map +1 -0
- package/messages/simply.cicd.happy-soup.md +39 -0
- package/messages/simply.cicd.happy-soup.release.create.md +65 -0
- package/messages/simply.cicd.happy-soup.release.stage.md +75 -0
- package/oclif.manifest.json +496 -1
- package/package.json +10 -4
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
2
|
+
import { applicationsForTeam, type HappySoupReleaseConfig, type ReleaseTeam, type StageReleaseBranchResult } from '@simplysf/simply-cicd-core';
|
|
3
|
+
import { type SelectOption } from '@simplysf/simply-plugin-kit';
|
|
4
|
+
export type HappySoupReleaseStageResult = StageReleaseBranchResult;
|
|
5
|
+
/** Starts a `<team>/<app>/<name>` staging branch for work headed into a happy-soup release. */
|
|
6
|
+
export default class HappySoupReleaseStage extends SfCommand<HappySoupReleaseStageResult> {
|
|
7
|
+
static readonly summary: string;
|
|
8
|
+
static readonly description: string;
|
|
9
|
+
static readonly examples: string[];
|
|
10
|
+
static readonly enableJsonFlag = true;
|
|
11
|
+
static readonly flags: {
|
|
12
|
+
config: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
+
'base-branch': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
|
+
remote: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
|
+
'dry-run': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
16
|
+
'no-prompt': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
17
|
+
team: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
18
|
+
app: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
19
|
+
name: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
20
|
+
'flags-dir': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
21
|
+
};
|
|
22
|
+
run(): Promise<HappySoupReleaseStageResult>;
|
|
23
|
+
/** A configured team's own spelling when the name matches one, ignoring case; otherwise the name as typed. */
|
|
24
|
+
protected resolveTeam(config: HappySoupReleaseConfig, name: string): {
|
|
25
|
+
name: string;
|
|
26
|
+
config?: ReleaseTeam;
|
|
27
|
+
};
|
|
28
|
+
protected promptForTeam(config: HappySoupReleaseConfig): Promise<{
|
|
29
|
+
name: string;
|
|
30
|
+
config?: ReleaseTeam;
|
|
31
|
+
}>;
|
|
32
|
+
protected promptForApp(applications: ReturnType<typeof applicationsForTeam>): Promise<string>;
|
|
33
|
+
protected promptForName(): Promise<string>;
|
|
34
|
+
protected promptForBase(productionBranch: string, remote: string): Promise<string>;
|
|
35
|
+
/** A list ending in "Other", which asks for a name. With nothing configured, it asks straight away. */
|
|
36
|
+
protected pickOrType(message: string, options: Array<SelectOption<string>>, typeMessage: string): Promise<string>;
|
|
37
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2026, SimplySF.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { Messages } from '@salesforce/core';
|
|
17
|
+
import { Flags, SfCommand } from '@salesforce/sf-plugins-core';
|
|
18
|
+
import { applicationsForTeam, findReleaseTeam, listStagingBaseBranches, loadReleaseConfig, stageReleaseBranch, } from '@simplysf/simply-cicd-core';
|
|
19
|
+
import { select, text } from '@simplysf/simply-plugin-kit';
|
|
20
|
+
import { canPrompt, OTHER, releaseConfigFlags, repositoryRoot } from '../../../../../common/happySoup/flags.js';
|
|
21
|
+
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
22
|
+
const messages = Messages.loadMessages('@simplysf/simply-cicd', 'simply.cicd.happy-soup.release.stage');
|
|
23
|
+
const shared = Messages.loadMessages('@simplysf/simply-cicd', 'simply.cicd.happy-soup');
|
|
24
|
+
/** Starts a `<team>/<app>/<name>` staging branch for work headed into a happy-soup release. */
|
|
25
|
+
export default class HappySoupReleaseStage extends SfCommand {
|
|
26
|
+
static summary = messages.getMessage('summary');
|
|
27
|
+
static description = messages.getMessage('description');
|
|
28
|
+
static examples = messages.getMessages('examples');
|
|
29
|
+
static enableJsonFlag = true;
|
|
30
|
+
static flags = {
|
|
31
|
+
...SfCommand.baseFlags,
|
|
32
|
+
team: Flags.string({ summary: messages.getMessage('flags.team.summary') }),
|
|
33
|
+
app: Flags.string({ char: 'a', summary: messages.getMessage('flags.app.summary') }),
|
|
34
|
+
name: Flags.string({ char: 'n', summary: messages.getMessage('flags.name.summary') }),
|
|
35
|
+
...releaseConfigFlags,
|
|
36
|
+
};
|
|
37
|
+
async run() {
|
|
38
|
+
const { flags } = await this.parse(HappySoupReleaseStage);
|
|
39
|
+
const interactive = canPrompt(flags['no-prompt'], this.jsonEnabled());
|
|
40
|
+
if (!interactive) {
|
|
41
|
+
const missing = ['team', 'app', 'name'].filter((flag) => !flags[flag]).map((flag) => `--${flag}`);
|
|
42
|
+
if (missing.length > 0) {
|
|
43
|
+
this.error(messages.getMessage('error.flagsRequired', [missing.join(', ')]));
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
const { config } = loadReleaseConfig({ configPath: flags.config, stopAt: await repositoryRoot() });
|
|
47
|
+
const team = flags.team ? this.resolveTeam(config, flags.team) : await this.promptForTeam(config);
|
|
48
|
+
const app = flags.app ?? (await this.promptForApp(applicationsForTeam(config, team.config)));
|
|
49
|
+
const name = flags.name ?? (await this.promptForName());
|
|
50
|
+
const baseBranch = flags['base-branch'] ??
|
|
51
|
+
(interactive ? await this.promptForBase(config.productionBranch, flags.remote) : config.productionBranch);
|
|
52
|
+
const result = await stageReleaseBranch({
|
|
53
|
+
team: team.name,
|
|
54
|
+
app,
|
|
55
|
+
name,
|
|
56
|
+
baseBranch,
|
|
57
|
+
remote: flags.remote,
|
|
58
|
+
dryRun: flags['dry-run'],
|
|
59
|
+
});
|
|
60
|
+
for (const warning of result.warnings) {
|
|
61
|
+
this.warn(warning);
|
|
62
|
+
}
|
|
63
|
+
this.table({
|
|
64
|
+
title: messages.getMessage('tableTitle'),
|
|
65
|
+
data: [
|
|
66
|
+
{ field: 'Branch', value: result.branch },
|
|
67
|
+
{ field: 'Base', value: result.base },
|
|
68
|
+
{ field: 'Status', value: result.status },
|
|
69
|
+
],
|
|
70
|
+
});
|
|
71
|
+
return result;
|
|
72
|
+
}
|
|
73
|
+
/** A configured team's own spelling when the name matches one, ignoring case; otherwise the name as typed. */
|
|
74
|
+
// eslint-disable-next-line class-methods-use-this
|
|
75
|
+
resolveTeam(config, name) {
|
|
76
|
+
const configured = findReleaseTeam(config, name);
|
|
77
|
+
return configured ? { name: configured.name, config: configured } : { name };
|
|
78
|
+
}
|
|
79
|
+
async promptForTeam(config) {
|
|
80
|
+
const picked = await this.pickOrType(messages.getMessage('prompt.team'), config.teams.map((team) => ({ value: team.name, label: team.label ?? team.name })), messages.getMessage('prompt.teamName'));
|
|
81
|
+
return this.resolveTeam(config, picked);
|
|
82
|
+
}
|
|
83
|
+
async promptForApp(applications) {
|
|
84
|
+
return this.pickOrType(messages.getMessage('prompt.app'), applications.map((app) => ({ value: app.name, label: app.label ?? app.name, hint: app.description })), messages.getMessage('prompt.appName'));
|
|
85
|
+
}
|
|
86
|
+
// eslint-disable-next-line class-methods-use-this -- kept as a method so tests can stub the prompt
|
|
87
|
+
async promptForName() {
|
|
88
|
+
return text({ message: messages.getMessage('prompt.name'), placeholder: 'PROJ-1058' });
|
|
89
|
+
}
|
|
90
|
+
async promptForBase(productionBranch, remote) {
|
|
91
|
+
const branches = await listStagingBaseBranches({ remote, productionBranch });
|
|
92
|
+
const choices = branches.length > 0 ? branches : [productionBranch];
|
|
93
|
+
return this.pickOrType(messages.getMessage('prompt.base'), choices.map((branch) => ({ value: branch, label: branch })), messages.getMessage('prompt.baseName'));
|
|
94
|
+
}
|
|
95
|
+
/** A list ending in "Other", which asks for a name. With nothing configured, it asks straight away. */
|
|
96
|
+
// eslint-disable-next-line class-methods-use-this
|
|
97
|
+
async pickOrType(message, options, typeMessage) {
|
|
98
|
+
if (options.length > 0) {
|
|
99
|
+
const picked = await select({
|
|
100
|
+
message,
|
|
101
|
+
options: [...options, { value: OTHER, label: shared.getMessage('prompt.other') }],
|
|
102
|
+
maxItems: 10,
|
|
103
|
+
});
|
|
104
|
+
if (picked !== OTHER) {
|
|
105
|
+
return picked;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return text({ message: typeMessage });
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
//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AAE,OAAO,EAAE,WAAW,EAAE,CAAC,CAAC;IACxC,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flags shared by the developer-run `happy-soup` commands. Unlike the pipeline stages' flags, these
|
|
3
|
+
* read no `SIMPLY_CICD_*` variables: a developer's shell isn't a CI job.
|
|
4
|
+
*/
|
|
5
|
+
export declare const releaseConfigFlags: {
|
|
6
|
+
config: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
+
'base-branch': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
|
+
remote: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
|
+
'dry-run': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
10
|
+
'no-prompt': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* The merge request's VCS settings. No default provider: an unset flag falls through to
|
|
14
|
+
* `SIMPLY_VCS_PROVIDER`, then `.sfdevrc.json`, then GitLab, in `resolveVcsSettings`.
|
|
15
|
+
*/
|
|
16
|
+
export declare const mergeRequestVcsFlags: {
|
|
17
|
+
'vcs-provider': import("@oclif/core/interfaces").OptionFlag<"gitlab" | "github" | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
18
|
+
'vcs-host': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
19
|
+
'vcs-project-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
20
|
+
'vcs-token': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
21
|
+
};
|
|
22
|
+
/** Sentinel for the "Other" entry at the end of a prompt's list. Can't collide with a git ref name. */
|
|
23
|
+
export declare const OTHER = "\0other";
|
|
24
|
+
/** Prompts run only in a terminal, and never with `--no-prompt` or `--json`. */
|
|
25
|
+
export declare function canPrompt(noPrompt: boolean, jsonEnabled: boolean): boolean;
|
|
26
|
+
/** @returns The root of the git repository containing the current directory. Runs git without a shell. */
|
|
27
|
+
export declare function repositoryRoot(): Promise<string>;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2026, SimplySF.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { execFile } from 'node:child_process';
|
|
17
|
+
import { promisify } from 'node:util';
|
|
18
|
+
import { Messages } from '@salesforce/core';
|
|
19
|
+
import { Flags } from '@salesforce/sf-plugins-core';
|
|
20
|
+
import { listVcsProviderKinds } from '@simplysf/simply-cicd-core';
|
|
21
|
+
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
22
|
+
const messages = Messages.loadMessages('@simplysf/simply-cicd', 'simply.cicd.happy-soup');
|
|
23
|
+
/**
|
|
24
|
+
* Flags shared by the developer-run `happy-soup` commands. Unlike the pipeline stages' flags, these
|
|
25
|
+
* read no `SIMPLY_CICD_*` variables: a developer's shell isn't a CI job.
|
|
26
|
+
*/
|
|
27
|
+
export const releaseConfigFlags = {
|
|
28
|
+
config: Flags.string({ char: 'c', summary: messages.getMessage('flags.config.summary') }),
|
|
29
|
+
'base-branch': Flags.string({ char: 'b', summary: messages.getMessage('flags.base-branch.summary') }),
|
|
30
|
+
remote: Flags.string({ summary: messages.getMessage('flags.remote.summary'), default: 'origin' }),
|
|
31
|
+
'dry-run': Flags.boolean({ summary: messages.getMessage('flags.dry-run.summary'), default: false }),
|
|
32
|
+
'no-prompt': Flags.boolean({ summary: messages.getMessage('flags.no-prompt.summary'), default: false }),
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* The merge request's VCS settings. No default provider: an unset flag falls through to
|
|
36
|
+
* `SIMPLY_VCS_PROVIDER`, then `.sfdevrc.json`, then GitLab, in `resolveVcsSettings`.
|
|
37
|
+
*/
|
|
38
|
+
export const mergeRequestVcsFlags = {
|
|
39
|
+
'vcs-provider': Flags.custom({ options: listVcsProviderKinds() })({
|
|
40
|
+
summary: messages.getMessage('flags.vcs-provider.summary'),
|
|
41
|
+
}),
|
|
42
|
+
'vcs-host': Flags.string({ summary: messages.getMessage('flags.vcs-host.summary') }),
|
|
43
|
+
'vcs-project-id': Flags.string({ summary: messages.getMessage('flags.vcs-project-id.summary') }),
|
|
44
|
+
'vcs-token': Flags.string({ summary: messages.getMessage('flags.vcs-token.summary'), env: 'SIMPLY_VCS_TOKEN' }),
|
|
45
|
+
};
|
|
46
|
+
/** Sentinel for the "Other" entry at the end of a prompt's list. Can't collide with a git ref name. */
|
|
47
|
+
export const OTHER = '\0other';
|
|
48
|
+
/** Prompts run only in a terminal, and never with `--no-prompt` or `--json`. */
|
|
49
|
+
export function canPrompt(noPrompt, jsonEnabled) {
|
|
50
|
+
return !noPrompt && !jsonEnabled && Boolean(process.stdin.isTTY);
|
|
51
|
+
}
|
|
52
|
+
/** @returns The root of the git repository containing the current directory. Runs git without a shell. */
|
|
53
|
+
export async function repositoryRoot() {
|
|
54
|
+
const { stdout } = await promisify(execFile)('git', ['rev-parse', '--show-toplevel']);
|
|
55
|
+
return stdout.trim();
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=flags.js.map
|
|
@@ -0,0 +1 @@
|
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E,OAAO,EAAE,KAAK,EAAE,CAAC;CACxG,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,cAAc,EAAE,KAAK,CAAC,MAAM,CAAkB,EAAE,OAAO,EAAE,oBAAoB,EAAE,EAAE,CAAC,CAAC;QACjF,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,4BAA4B,CAAC;KAC3D,CAAC;IACF,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,wBAAwB,CAAC,EAAE,CAAC;IACpF,gBAAgB,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,8BAA8B,CAAC,EAAE,CAAC;IAChG,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,yBAAyB,CAAC,EAAE,GAAG,EAAE,kBAAkB,EAAE,CAAC;CAChH,CAAC;AAEF,uGAAuG;AACvG,MAAM,CAAC,MAAM,KAAK,GAAG,SAAS,CAAC;AAE/B,gFAAgF;AAChF,MAAM,UAAU,SAAS,CAAC,QAAiB,EAAE,WAAoB;IAC/D,OAAO,CAAC,QAAQ,IAAI,CAAC,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AACnE,CAAC;AAED,0GAA0G;AAC1G,MAAM,CAAC,KAAK,UAAU,cAAc;IAClC,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,SAAS,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,CAAC,WAAW,EAAE,iBAAiB,CAAC,CAAC,CAAC;IACtF,OAAO,MAAM,CAAC,IAAI,EAAE,CAAC;AACvB,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# flags.config.summary
|
|
2
|
+
|
|
3
|
+
Path to the release configuration file. Defaults to config/release.json or release.json, searched for from the current directory up to the repository root.
|
|
4
|
+
|
|
5
|
+
# flags.base-branch.summary
|
|
6
|
+
|
|
7
|
+
Branch to start from. Defaults to productionBranch in the release configuration, which defaults to environment/production.
|
|
8
|
+
|
|
9
|
+
# flags.remote.summary
|
|
10
|
+
|
|
11
|
+
Remote to fetch from and push to.
|
|
12
|
+
|
|
13
|
+
# flags.dry-run.summary
|
|
14
|
+
|
|
15
|
+
Print the plan without changing anything.
|
|
16
|
+
|
|
17
|
+
# flags.no-prompt.summary
|
|
18
|
+
|
|
19
|
+
Don't ask for anything. Values that would be asked for must then be passed as flags.
|
|
20
|
+
|
|
21
|
+
# flags.vcs-provider.summary
|
|
22
|
+
|
|
23
|
+
VCS platform for the merge request. Defaults to SIMPLY_VCS_PROVIDER, then vcs.provider in .sfdevrc.json, then gitlab.
|
|
24
|
+
|
|
25
|
+
# flags.vcs-host.summary
|
|
26
|
+
|
|
27
|
+
VCS hostname, for a self-hosted instance. Defaults to SIMPLY_VCS_HOST, then vcs.host in .sfdevrc.json.
|
|
28
|
+
|
|
29
|
+
# flags.vcs-project-id.summary
|
|
30
|
+
|
|
31
|
+
GitLab project ID or GitHub owner/repo. Defaults to SIMPLY_VCS_PROJECT_ID, then vcs.projectId in .sfdevrc.json.
|
|
32
|
+
|
|
33
|
+
# flags.vcs-token.summary
|
|
34
|
+
|
|
35
|
+
VCS API token for the merge request.
|
|
36
|
+
|
|
37
|
+
# prompt.other
|
|
38
|
+
|
|
39
|
+
Other (type a name)
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# summary
|
|
2
|
+
|
|
3
|
+
Open a dated happy-soup release: create release/YYYY-MM-DD with its deployment files, push it, and open a draft merge request.
|
|
4
|
+
|
|
5
|
+
# description
|
|
6
|
+
|
|
7
|
+
Run this from a local clone of a happy-soup repository. It creates `release/<date>` from the remote's copy of the production branch (`productionBranch` in `config/release.json`, by default `environment/production`), without checking out or pulling any other branch, and checks it out.
|
|
8
|
+
|
|
9
|
+
It then copies the deployment steps template to `deployment-steps/<date>.md` and the deployment configs template to `deployment-configs/<date>.json`, which is the file the `simply cicd deploy happy-soup` stages use for this branch, and commits both in one commit. The templates are read from the base branch, from the paths `deploymentStepsTemplate` and `deploymentConfigsTemplate` in `config/release.json` (by default `xdocs/deployment-steps-template.md` and `xdocs/deployment-configs-template.json`). A template that doesn't exist is skipped and reported. A deployment file that already exists on the base branch is left alone.
|
|
10
|
+
|
|
11
|
+
Finally, it pushes the branch and opens a draft merge request back into the base branch, unless `--no-push` or `--no-merge-request`. The merge request needs a token, from `--vcs-token` or `SIMPLY_VCS_TOKEN`, and a project ID, from `--vcs-project-id`, `SIMPLY_VCS_PROJECT_ID`, or `vcs.projectId` in `.sfdevrc.json`. These are checked before anything changes.
|
|
12
|
+
|
|
13
|
+
A working tree with uncommitted changes is refused. Nothing is ever force-checked-out, reset, or force-pushed, and your repository's commit hooks always run. If a hook rejects the commit, nothing is pushed and the files stay staged: commit them, push the branch, and run this command again to open the merge request.
|
|
14
|
+
|
|
15
|
+
If the branch is already on the remote, nothing is created: it is checked out (a local copy that is only behind is fast-forwarded), and the merge request is opened if it's missing.
|
|
16
|
+
|
|
17
|
+
# flags.date.summary
|
|
18
|
+
|
|
19
|
+
Release date, in YYYY-MM-DD form. Asked for when omitted in a terminal.
|
|
20
|
+
|
|
21
|
+
# flags.message.summary
|
|
22
|
+
|
|
23
|
+
Commit message template for the deployment files, with an optional {DATE} placeholder. Defaults to "chore: set up release {DATE}".
|
|
24
|
+
|
|
25
|
+
# flags.no-push.summary
|
|
26
|
+
|
|
27
|
+
Create and commit the branch locally only. Implies --no-merge-request.
|
|
28
|
+
|
|
29
|
+
# flags.no-merge-request.summary
|
|
30
|
+
|
|
31
|
+
Push the branch without opening a draft merge request.
|
|
32
|
+
|
|
33
|
+
# error.dateRequired
|
|
34
|
+
|
|
35
|
+
Pass --date with the release date, in YYYY-MM-DD form.
|
|
36
|
+
|
|
37
|
+
# prompt.date
|
|
38
|
+
|
|
39
|
+
What is the release date (YYYY-MM-DD)?
|
|
40
|
+
|
|
41
|
+
# tableTitle
|
|
42
|
+
|
|
43
|
+
Release branch
|
|
44
|
+
|
|
45
|
+
# examples
|
|
46
|
+
|
|
47
|
+
- Open the release for 19 October 2026:
|
|
48
|
+
|
|
49
|
+
<%= config.bin %> <%= command.id %> --date 2026-10-19
|
|
50
|
+
|
|
51
|
+
- See what would happen, without changing anything:
|
|
52
|
+
|
|
53
|
+
<%= config.bin %> <%= command.id %> --date 2026-10-19 --dry-run
|
|
54
|
+
|
|
55
|
+
- Ask for the date:
|
|
56
|
+
|
|
57
|
+
<%= config.bin %> <%= command.id %>
|
|
58
|
+
|
|
59
|
+
- Create the branch and its files, but push and open the merge request yourself:
|
|
60
|
+
|
|
61
|
+
<%= config.bin %> <%= command.id %> --date 2026-10-19 --no-push
|
|
62
|
+
|
|
63
|
+
- Use a commit message your repository's rules accept:
|
|
64
|
+
|
|
65
|
+
<%= config.bin %> <%= command.id %> --date 2026-10-19 --message "chore: PROJ-123 set up release {DATE}"
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# summary
|
|
2
|
+
|
|
3
|
+
Start a staging branch, <team>/<app>/<name>, for work headed into a happy-soup release.
|
|
4
|
+
|
|
5
|
+
# description
|
|
6
|
+
|
|
7
|
+
Run this from a local clone of a happy-soup repository. It creates `<team>/<app>/<name>`, such as `platform/core/PROJ-1058`, from the remote's copy of the base branch, without checking out or pulling any other branch, and checks it out. The branch isn't pushed.
|
|
8
|
+
|
|
9
|
+
In a terminal, anything you leave out is asked for. The teams, and each team's applications, come from `config/release.json`. A team with no applications of its own offers the file's top-level `applications`. Each list ends with "Other", for a name that isn't configured. The base branches offered are the remote's `environment/*` and `release/*` branches, with `productionBranch` first. Without prompts, `--team`, `--app`, and `--name` are required, and the base defaults to `productionBranch` (by default `environment/production`).
|
|
10
|
+
|
|
11
|
+
`--team` matches a configured team ignoring case. Each part of the name must be a single valid git branch component: no `/`, spaces, `..`, or the other characters git refuses.
|
|
12
|
+
|
|
13
|
+
A working tree with uncommitted changes is refused. If the branch already exists, on the remote or only locally, it is checked out instead of created.
|
|
14
|
+
|
|
15
|
+
# flags.team.summary
|
|
16
|
+
|
|
17
|
+
Team, the first part of the branch name. Asked for when omitted in a terminal.
|
|
18
|
+
|
|
19
|
+
# flags.app.summary
|
|
20
|
+
|
|
21
|
+
Application, the second part of the branch name. Asked for when omitted in a terminal.
|
|
22
|
+
|
|
23
|
+
# flags.name.summary
|
|
24
|
+
|
|
25
|
+
Release name or ticket, the last part of the branch name, such as PROJ-1058. Asked for when omitted in a terminal.
|
|
26
|
+
|
|
27
|
+
# error.flagsRequired
|
|
28
|
+
|
|
29
|
+
Pass %s, or run this in a terminal to be asked.
|
|
30
|
+
|
|
31
|
+
# prompt.team
|
|
32
|
+
|
|
33
|
+
Which team is this for?
|
|
34
|
+
|
|
35
|
+
# prompt.teamName
|
|
36
|
+
|
|
37
|
+
What is the team name?
|
|
38
|
+
|
|
39
|
+
# prompt.app
|
|
40
|
+
|
|
41
|
+
Which application is this for?
|
|
42
|
+
|
|
43
|
+
# prompt.appName
|
|
44
|
+
|
|
45
|
+
What is the application name?
|
|
46
|
+
|
|
47
|
+
# prompt.name
|
|
48
|
+
|
|
49
|
+
What is the release name or ticket?
|
|
50
|
+
|
|
51
|
+
# prompt.base
|
|
52
|
+
|
|
53
|
+
Which branch do you want to stage from?
|
|
54
|
+
|
|
55
|
+
# prompt.baseName
|
|
56
|
+
|
|
57
|
+
What is the branch name?
|
|
58
|
+
|
|
59
|
+
# tableTitle
|
|
60
|
+
|
|
61
|
+
Staging branch
|
|
62
|
+
|
|
63
|
+
# examples
|
|
64
|
+
|
|
65
|
+
- Start platform/core/PROJ-1058 from the production branch:
|
|
66
|
+
|
|
67
|
+
<%= config.bin %> <%= command.id %> --team platform --app core --name PROJ-1058
|
|
68
|
+
|
|
69
|
+
- Stage from a release branch instead:
|
|
70
|
+
|
|
71
|
+
<%= config.bin %> <%= command.id %> --team platform --app core --name PROJ-1058 --base-branch release/2026-10-19
|
|
72
|
+
|
|
73
|
+
- Pick the team, application, and base branch from lists:
|
|
74
|
+
|
|
75
|
+
<%= config.bin %> <%= command.id %>
|