-
Notifications
You must be signed in to change notification settings - Fork 1
86 lines (73 loc) Β· 3.41 KB
/
android-ci.yml
File metadata and controls
86 lines (73 loc) Β· 3.41 KB
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
name: BuyOrNot CI
on:
push:
branches:
- main
- develop
pull_request:
jobs:
ktlint:
runs-on: ubuntu-latest
if: github.actor != 'github-actions[bot]'
concurrency:
group: ktlint-${{ github.ref }}
cancel-in-progress: true
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref || github.ref }}
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '17'
- name: Create local.properties
run: |
echo "signed.store.file=keystore.jks" >> local.properties
echo "signed.store.password=${{ secrets.SIGNED_STORE_PASSWORD }}" >> local.properties
echo "signed.key.alias=${{ secrets.SIGNED_KEY_ALIAS }}" >> local.properties
echo "signed.key.password=${{ secrets.SIGNED_KEY_PASSWORD }}" >> local.properties
echo "debug.base.url=${{ secrets.DEBUG_BASE_URL }}" >> local.properties
echo "release.base.url=${{ secrets.RELEASE_BASE_URL }}" >> local.properties
echo "google.webClientId=${{ secrets.GOOGLE_WEB_CLIENT_ID }}" >> local.properties
echo "kakao.nativeAppKey=${{ secrets.KAKAO_NATIVE_APP_KEY }}" >> local.properties
echo "kakao.nativeAppKeyDebug=${{ secrets.KAKAO_NATIVE_APP_KEY_DEBUG }}" >> local.properties
- name: Decode Keystore
run: echo "${{ secrets.KEYSTORE_BASE64 }}" | base64 --decode > app/keystore.jks
- name: Decode google-services.json
run: echo "${{ secrets.GOOGLE_SERVICES_JSON_BASE64 }}" | base64 --decode > app/google-services.json
- name: Configure Gradle
uses: gradle/actions/setup-gradle@v3
- name: Run ktlint check
id: ktlint
run: ./gradlew ktlintCheck
continue-on-error: true
- name: Fail with guide message (fork PR)
if: steps.ktlint.outcome == 'failure' && github.event.pull_request.head.repo.full_name != github.repository
run: |
echo "::error::ktlint κ²μ¬μ μ€ν¨νμ΅λλ€. Fork PRμ μλ ν¬λ§·ν
μ΄ μ§μλμ§ μμ΅λλ€."
echo "::error::λ‘컬μμ ./gradlew ktlintFormat μ€ν ν λ€μ push ν΄μ£ΌμΈμ."
exit 1
- name: Auto-fix with ktlintFormat (internal branch only)
if: steps.ktlint.outcome == 'failure' && github.event.pull_request.head.repo.full_name == github.repository
run: ./gradlew ktlintFormat
- name: Commit and push ktlint fixes (internal branch only)
if: steps.ktlint.outcome == 'failure' && github.event.pull_request.head.repo.full_name == github.repository
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
BRANCH="${GITHUB_HEAD_REF:-${GITHUB_REF_NAME}}"
ISSUE=$(echo "$BRANCH" | grep -oP '#\d+' | head -1)
if [ -n "$ISSUE" ]; then
MSG="chore/${ISSUE}: ktlint ν¬λ§·ν
"
else
MSG="chore: ktlint ν¬λ§·ν
"
fi
git diff --quiet || (git add -A && git commit -m "$MSG")
git push origin HEAD:${GITHUB_HEAD_REF}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Fail if ktlint had errors (internal branch only)
if: steps.ktlint.outcome == 'failure' && github.event.pull_request.head.repo.full_name == github.repository
run: exit 1