diff --git a/.github/hooks/pre-commit b/.github/hooks/pre-commit index d797febf..2ccc5554 100755 --- a/.github/hooks/pre-commit +++ b/.github/hooks/pre-commit @@ -1,5 +1,5 @@ #!/bin/sh -set -e +set -euo pipefail # 1) staged 파일 중 JS/TS 계열만 판별 all_files=$(git diff --cached --name-only --diff-filter=ACM) diff --git a/.github/hooks/pre-push b/.github/hooks/pre-push index 0f98b2c9..63ea88fc 100755 --- a/.github/hooks/pre-push +++ b/.github/hooks/pre-push @@ -1,5 +1,5 @@ #!/usr/bin/env bash -set -e +set -euo pipefail # 푸시를 실행한 원격 이름과 URL remote_name=$1 diff --git a/.github/workflows/pr-title-lint.yaml b/.github/workflows/pr-title-lint.yaml new file mode 100644 index 00000000..2a59234d --- /dev/null +++ b/.github/workflows/pr-title-lint.yaml @@ -0,0 +1,19 @@ +name: PR Title Lint + +on: + pull_request: + types: [opened, edited, synchronize, reopened] + +jobs: + title-lint: + runs-on: ubuntu-latest + permissions: + pull-requests: read + steps: + - uses: actions/checkout@v3 + - name: Lint PR title + uses: deepakputhraya/action-pr-title@v1.0.2 + with: + regex: '^\[(Feature|Fix|Chore|Docs|Style|Refactor|Test)\]!? .+(?: \(#\d+\))?$' + prefix_case_sensitive: true + github_token: ${{ github.token }} \ No newline at end of file diff --git a/package.json b/package.json index 4e2c37e8..7f933500 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "dev": "bash src/scripts/start-dev.sh", "build": "bash src/scripts/build.sh", "android": "react-native run-android", - "android:build": "bash android/gradlew assembleDebug", + "android:build": "cd android && bash gradlew assembleDebug", "windows": "npx react-native run-windows", "windows:build": "react-native run-windows --no-launch --no-deploy --no-packager", "windows:init": "react-native init-windows --overwrite && npx react-native run-windows --msbuildprops \"RestoreLockedMode=false;BinaryLogger=;UseSharedCompilation=false;MaximumCpuCount=1\"", diff --git a/src/scripts/build.sh b/src/scripts/build.sh index bfcde097..8eefc641 100755 --- a/src/scripts/build.sh +++ b/src/scripts/build.sh @@ -1,22 +1,35 @@ #!/bin/sh +set -e ## OS 확인 -if [[ "$OSTYPE" == "darwin"* ]]; then - echo "Detected OS: macOS" - npm run macos:build & - npm run ios:build & - wait +case "$OSTYPE" in + darwin*) + echo "Detected OS: macOS" + npm run macos:build & pid1=$! + npm run ios:build & pid2=$! + ;; + cygwin*|msys*|win32*) + echo "Detected OS: Windows" + npm run windows:build & pid1=$! + npm run android:build & pid2=$! + ;; + *) + echo "Unknown OS: $OSTYPE" >&2 + exit 1 + ;; +esac -elif [[ "$OSTYPE" == "cygwin" ]] || [[ "$OSTYPE" == "msys" ]] || [[ "$OSTYPE" == "win32" ]]; then - echo "Detected OS: Windows" - npm run windows:build & - npm run android:build & - wait +# 백그라운드 작업 완료 대기 후 exit code 수집 +wait "$pid1" +ec1=$? +wait "$pid2" +ec2=$? -else - echo "Unknown OS: $OSTYPE" +# 둘 중 하나라도 실패하면 exit 1 +if [ "$ec1" -ne 0 ] || [ "$ec2" -ne 0 ]; then + echo "❌ 빌드 중 에러가 발생하였습니다. (desktop app: $ec1, mobile app: $ec2)" >&2 exit 1 fi -echo "모든 빌드가 완료되었습니다." +echo "✅ 모든 빌드가 성공적으로 완료되었습니다." exit 0 diff --git a/src/scripts/generate-cert.sh b/src/scripts/generate-cert.sh index c95a53cf..a23d42e6 100755 --- a/src/scripts/generate-cert.sh +++ b/src/scripts/generate-cert.sh @@ -21,7 +21,7 @@ elif [[ "$OSTYPE" == "cygwin" ]] || [[ "$OSTYPE" == "msys" ]] || [[ "$OSTYPE" == curl -L -o mkcert.exe https://github.com/FiloSottile/mkcert/releases/latest/download/mkcert-v1.4.4-windows-amd64.exe else - echo "Unknown OS: $OSTYPE" + echo "Unknown OS: $OSTYPE" >&2 exit 1 fi diff --git a/src/scripts/start-dev.sh b/src/scripts/start-dev.sh index 3f21c8a8..fe49da39 100755 --- a/src/scripts/start-dev.sh +++ b/src/scripts/start-dev.sh @@ -14,7 +14,7 @@ elif [[ "$OSTYPE" == "cygwin" ]] || [[ "$OSTYPE" == "msys" ]] || [[ "$OSTYPE" == wait else - echo "Unknown OS: $OSTYPE" + echo "Unknown OS: $OSTYPE" >&2 exit 1 fi