Skip to content

Instantly share code, notes, and snippets.

@StrongerMyself
Last active August 2, 2023 15:57
Show Gist options
  • Save StrongerMyself/c84dca89396d37a1bdbb87a135682c22 to your computer and use it in GitHub Desktop.
Save StrongerMyself/c84dca89396d37a1bdbb87a135682c22 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
const release = Machine( {
id: "release",
initial: "start",
context: {
level: "patch",
tag: "0.0.1",
fixVersion: "SSR_release_v0.0.1",
},
states: {
start: {
on: {
NEXT: "prepare",
},
},
prepare: {
description: "Подготовка релиза",
on: {
NEXT: "ready",
},
initial: "initiateTag",
states: {
initiateTag: {
invoke: {
src: "initiateTag",
onDone: "checkIssues",
},
},
checkIssues: {
invoke: {
src: "checkIssues",
onDone: "transitionToProcess",
},
},
transitionToProcess: {
invoke: {
src: "transitionToProcess",
onDone: "setFixVersion",
},
},
setFixVersion: {
type: "final",
invoke: {
src: "setFixVersion",
onDone: "",
},
},
},
},
ready: {
description: "Создание релизной ветки",
on: {
NEXT: "branch",
},
initial: "createReleaseBranch",
states: {
createReleaseBranch: {
invoke: {
src: "createReleaseBranch",
onDone: "createMergeRequest",
},
},
createMergeRequest: {
invoke: {
src: "createMergeRequest",
onDone: "updateTargetBranch",
},
},
updateTargetBranch: {
type: "final",
invoke: {
src: "updateTargetBranch",
onDone: "",
},
},
},
},
branch: {
description: "Влитие задач в релизную ветку",
on: {
NEXT: "push",
},
initial: "mergeBranches",
states: {
mergeBranches: {
invoke: {
src: "mergeBranches",
onDone: "pushReleaseBranch",
},
},
pushReleaseBranch: {
type: "final",
invoke: {
src: "mergeBranches",
onDone: "",
},
},
},
},
push: {
description: "Создание тега",
on: {
NEXT: "finalize",
},
initial: "createTag",
states: {
createTag: {
invoke: {
src: "createTag",
onDone: "showPipeline",
},
},
showPipeline: {
type: "final",
invoke: {
src: "showPipeline",
onDone: "",
},
},
},
},
finalize: {
description: "Закрытие релиза",
type: "final",
initial: "mergeReleaseBranch",
states: {
mergeReleaseBranch: {
invoke: {
src: "mergeReleaseBranch",
onDone: "deleteBranches",
},
},
deleteBranches: {
invoke: {
src: "deleteBranches",
onDone: "closeTask",
},
},
closeTask: {
type: "final",
invoke: {
src: "closeTask",
onDone: "",
},
},
},
},
},
},
{
actions: {
createReleaseBranch: () => console.log("createReleaseBranch"),
updateTargetBranch: () => console.log("updateTargetBranch"),
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment