oto/assets/yaml/sample/06_git.yaml

101 lines
2 KiB
YAML

---
# [샘플] Git 작업
property:
workspace: /path/to/project
branch: main
commitMessage: "chore: automated update"
hasChange: false
pipeline:
id: main
workflow:
- exe: git-pull # 최신 소스로 업데이트
- exe: git-rev # 현재 리비전 저장
- exe: git-count # 커밋 수 저장
- exe: print-info
# 변경사항이 있을 때만 커밋 + 푸시
- if:
condition-bool: <!property.hasChange> == true
on-true:
- exe: git-commit
- exe: git-push
commands:
# 임의 git 명령 조합
- command: Git
id: git-update
param:
commands:
- fetch origin
- reset --hard origin/<!property.branch>
- clean -fd
# 최신 소스로 풀
- command: GitPull
id: git-pull
param:
branch: <!property.branch>
# 브랜치 체크아웃
- command: GitCheckout
id: git-checkout
param:
branch: <!property.branch>
executePull: true
# 현재 리비전 해시 저장
- command: GitRev
id: git-rev
param:
setValue: <@property.gitRev>
# 전체 커밋 수 저장
- command: GitCount
id: git-count
param:
setValue: <@property.gitCount>
- command: Print
id: print-info
param:
message: "rev: <!property.gitRev>, count: <!property.gitCount>"
# 변경 파일 스테이징 + 커밋
- command: GitCommit
id: git-commit
param:
message: <!property.commitMessage>
addNewFile: true
# 원격 브랜치에 푸시
- command: GitPush
id: git-push
param:
branch: <!property.branch>
# 브랜치 목록 조회 (최근 N일)
- command: GitBranch
id: git-branch-list
param:
path: <!property.workspace>
startDay: 30
setBranches: <@property.branches>
# 저장된 변경사항 일시 스테이징 ( stash push)
- command: GitStashPush
id: git-stash
param:
message: "WIP: my changes"
# 스테이된 변경사항 적용 + 삭제
- command: GitStashApply
id: git-stash-apply
param:
message: "stash-apply"
# 특정 커밋으로 리셋
- command: GitReset
id: git-reset
param:
force: false