@atomist/sdm
Version:
Atomist Software Delivery Machine SDK
66 lines • 2.88 kB
TypeScript
import { RemoteRepoRef } from "@atomist/automation-client/lib/operations/common/RepoId";
import { GitProject } from "@atomist/automation-client/lib/project/git/GitProject";
import { ExecuteGoalResult } from "../../api/goal/ExecuteGoalResult";
import { Goal } from "../../api/goal/Goal";
import { ExecuteGoal } from "../../api/goal/GoalInvocation";
import { FulfillableGoal, FulfillableGoalDetails, ImplementationRegistration } from "../../api/goal/GoalWithFulfillment";
import { SdmGoalEvent } from "../../api/goal/SdmGoalEvent";
import { ProgressLog } from "../../spi/log/ProgressLog";
/**
* Arguments passed to a [[VersionIncrementer]].
*/
export interface VersionIncrementerArguments {
/**
* The release semantic version for the goal set triggering this
* increment request. If the version in the project is not equal
* to the provided current version, it is up to function whether
* to increment the version or not. If the function makes
* changes, they will be committed and pushed. If it does not
* make changes, nothing will be committed.
*/
currentVersion: string;
/** SDM event triggering this goal. */
goalEvent: SdmGoalEvent;
/** Remote repository reference. */
id: RemoteRepoRef;
/** The part of the semantic version to increment. */
increment: "major" | "minor" | "patch";
/** Progress log to write status updates to. */
log: ProgressLog;
/** Project to increment version in. */
project: GitProject;
}
/**
* A function capable of incrementing the specified semantic version
* element in the project that is used by the fulfillment goal
* executor.
*/
export declare type VersionIncrementer = (args: VersionIncrementerArguments) => Promise<ExecuteGoalResult>;
/**
* [[IncrementVersion]] fulfillment options.
*/
export interface IncrementVersionRegistration extends Partial<ImplementationRegistration> {
/** Function capable of incrementing version. */
versionIncrementer: VersionIncrementer;
}
/**
* Class that abstracts incrementing project version after a release.
*/
export declare class IncrementVersion extends FulfillableGoal {
constructor(goalDetailsOrUniqueName?: FulfillableGoalDetails | string, ...dependsOn: Goal[]);
/**
* Add fulfillment to this goal.
*/
with(registration: IncrementVersionRegistration): this;
}
/**
* Return goal executor that increments version using the provided
* increment function and then commits & pushes the changes.
*
* Since this function changes and commits to the project at a time
* when several other goals may be doing the same, it first checks out
* the branch associated with the goal invocation and pulls to get the
* latest head from the remote.
*/
export declare function executeIncrementVersion(versionIncrementer: VersionIncrementer): ExecuteGoal;
//# sourceMappingURL=increment.d.ts.map