Skip to content

Commit 19559d1

Browse files
yunabyteYuna
andauthored
cicd: pre-push 트리거 build test script 작성 (#111)
* cicd: pre-push build script 작성 * add: pre-push-build.sh --------- Co-authored-by: Yuna <yuna@Yunaui-MacBookPro.local>
1 parent ea51d45 commit 19559d1

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

.github/scripts/install-hooks.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/sh
2+
3+
# sh .github/scripts/install-hooks.sh 명령어로 실행하시면 됩니다.
4+
cp .github/scripts/pre-push-build.sh .git/hooks/pre-push
5+
chmod +x .git/hooks/pre-push
6+
echo "pre-push hook 설치 완료!"

.github/scripts/pre-push-build.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/sh
2+
3+
BRANCH=$(git rev-parse --abbrev-ref HEAD)
4+
echo "현재 브랜치: $BRANCH"
5+
6+
if [ "$BRANCH" = "develop" ]; then
7+
echo "develop 브랜치 빌드 검사 시작 (spring.profiles.active=dev)..."
8+
9+
./gradlew clean build -x test -Dspring.profiles.active=dev
10+
if [ $? -ne 0 ]; then
11+
echo "빌드 실패! push 차단"
12+
exit 1
13+
fi
14+
15+
echo "빌드 성공! push 진행."
16+
else
17+
echo "$BRANCH 브랜치는 빌드 체크 없이 push 허용"
18+
fi
19+
20+
exit 0

0 commit comments

Comments
 (0)