-
Notifications
You must be signed in to change notification settings - Fork 1
/
.space.kts
95 lines (83 loc) · 2.85 KB
/
.space.kts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
job("[BE] Merge Request") {
startOn {
codeReviewOpened {
branchToCheckout = CodeReviewBranch.MERGE_REQUEST_SOURCE
}
gitPush {
anyRefMatching {
+"refs/merge/*/head"
}
}
}
parallel {
container(displayName = "build & test", image = "node:alpine") {
env["REVIEW_ID"] = "{{ run:review.id }}"
env["PROJECT_ID"] = "{{ run:project.id }}"
env["SPACE_AUTOMATION_AUTHORIZATION"] = "{{ project:SPACE_AUTOMATION_AUTHORIZATION }}"
cache {
// package.json 의 내용을 해시를 하고 그 값을 캐싱키로 사용
// 이를 통해 package.json 이 동일하면 캐시를 사용하도록 유도하고 달라지면 캐시를 새로 만든다
// 참고: https://www.jetbrains.com/help/space/cache-files.html#upload-and-reuse-cached-files
storeKey = "npm-{{ hashFiles('package.json') }}"
// Fallback 옵션인데 불필요 할것 같아서 주석처리
/*restoreKeys {
+"npm-master"
}*/
// 캐시가 들어갈 디렉토리
localPath = "node_modules"
}
shellScript {
content = """
set -e
yarn install
yarn reviewer &
yarn build
yarn test
wait
"""
}
}
container(displayName = "send automation result", image = "gradle:6.1.1-jre11") {
env["REVIEW_ID"] = "{{ run:review.id }}"
kotlinScript { api ->
api.space().chats.messages.sendMessage(
channel = ChannelIdentifier.Review(ReviewIdentifier.Id(System.getenv("REVIEW_ID"))),
content = ChatMessage.Text(
text = api.executionUrl()
)
)
}
}
}
}
job("[BE] Deploy Develop") {
startOn {
gitPush {
anyBranchMatching {
+"develop"
}
}
}
git {
refSpec {
+"refs/heads/develop"
}
depth = UNLIMITED_DEPTH
}
container(displayName = "Push heroku remote", image = "alpine:3.18") {
env["HEROKU_API_KEY"] = "{{ project:HEROKU_API_KEY }}"
shellScript {
content = """
apk update
apk add git
echo "Git Version:"
git --version
git switch develop
echo "Git Status:"
git status
git remote add heroku https://token:${'$'}[email protected]/bi-orbit.git
git push heroku develop:main -f
"""
}
}
}