Skip to content

Commit f4ceaff

Browse files
committed
feat: CI 워크플로우 추가
1 parent 2f81a2c commit f4ceaff

1 file changed

Lines changed: 98 additions & 2 deletions

File tree

.github/workflows/android.yml

Lines changed: 98 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
name: Android CI
22

33
on:
4-
push:
5-
branches: [ "master" ]
64
pull_request:
75
branches: [ "master" ]
86

@@ -22,5 +20,103 @@ jobs:
2220

2321
- name: Grant execute permission for gradlew
2422
run: chmod +x gradlew
23+
24+
- name: Add Local Properties
25+
env:
26+
BASE_URL: ${{secrets.BASE_URL}}
27+
GOOGLE_API_KEY: ${{secrets.GOOGLE_API_KEY}}
28+
KAKAO_API_KEY: ${{secrets.KAKAO_API_KEY}}
29+
SIGNING_STORE_PASSWORD: ${{secrets.SIGNING_STORE_PASSWORD}}
30+
SIGNING_KEY_ALIAS: ${{secrets.SIGNING_KEY_ALIAS}}
31+
SIGNING_KEY_PASSWORD: ${{secrets.SIGNING_KEY_PASSWORD}}
32+
run: |
33+
echo "BASE_URL=$BASE_URL" >> ./local.properties
34+
echo "GOOGLE_API_KEY=$GOOGLE_API_KEY" >> ./local.properties
35+
echo "KAKAO_API_KEY=$KAKAO_API_KEY" >> ./local.properties
36+
echo "SIGNING_STORE_PASSWORD=$SIGNING_STORE_PASSWORD" >> ./local.properties
37+
echo "SIGNING_KEY_ALIAS=$SIGNING_KEY_ALIAS" >> ./local.properties
38+
echo "SIGNING_KEY_PASSWORD=$SIGNING_KEY_PASSWORD" >> ./local.properties
39+
40+
- name: Get Google Services JSON
41+
env:
42+
GOOGLE_SERVICES_JSON: ${{secrets.GOOGLE_SERVICES_JSON}}
43+
run:
44+
echo '$GOOGLE_SERVICES_JSON' > ./app/google-services.json
45+
46+
- name: Create Keystore File
47+
env:
48+
KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }}
49+
run: |
50+
echo $KEYSTORE_BASE64 | base64 -d > ./app/runcombi-keystore.jks
51+
2552
- name: Build with Gradle
2653
run: ./gradlew build
54+
55+
- name: Build Release APK
56+
run: ./gradlew assembleRelease
57+
58+
- name: Extract App Version
59+
id: app_version
60+
run: |
61+
VERSION_NAME=$(grep 'versionName' app/build.gradle.kts | sed 's/.*versionName = "\(.*\)"/\1/')
62+
VERSION_CODE=$(grep 'versionCode' app/build.gradle.kts | sed 's/.*versionCode = \([0-9]*\)/\1/')
63+
echo "version_name=$VERSION_NAME" >> $GITHUB_OUTPUT
64+
echo "version_code=$VERSION_CODE" >> $GITHUB_OUTPUT
65+
66+
- name: Upload Release Build to Artifacts
67+
uses: actions/upload-artifact@v4
68+
with:
69+
name: release-artifacts
70+
path: app/build/outputs/apk/release/
71+
if-no-files-found: error
72+
73+
- name: Create Github Release
74+
uses: softprops/action-gh-release@v1
75+
with:
76+
tag_name: v${{ steps.app_version.outputs.version_name }}
77+
release_name: RunCombi Android v${{ steps.app_version.outputs.version_name }}
78+
generate_release_notes: true
79+
files: |
80+
app/build/outputs/apk/release/app-release.apk
81+
body: |
82+
## RunCombi Android v${{ steps.app_version.outputs.version_name }}
83+
84+
**Version Code:** ${{ steps.app_version.outputs.version_code }}
85+
**Build Date:** ${{ github.event.head_commit.timestamp }}
86+
87+
### Changes
88+
- PR: ${{ github.event.pull_request.title }}
89+
- Author: @${{ github.event.pull_request.user.login }}
90+
- Branch: ${{ github.event.pull_request.head.ref }} → ${{ github.event.pull_request.base.ref }}
91+
92+
- name: Upload APK to Slack
93+
if: ${{success()}}
94+
uses: 8398a7/action-slack@v3
95+
with:
96+
status: success
97+
webhook_url: ${{ secrets.SLACK_WEBHOOK_URL }}
98+
channel: '#general'
99+
text: 'RunCombi Android APK 빌드 완료! 🎉'
100+
file: app/build/outputs/apk/release/app-release.apk
101+
102+
- name: If Success, Send notification on Slack
103+
if: ${{success()}}
104+
uses: rtCamp/action-slack-notify@v2
105+
env:
106+
SLACK_COLOR: '#60E0C5'
107+
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
108+
SLACK_TITLE: 'RunCombi Android PR Check Success ✅'
109+
MSG_MINIMAL: true
110+
SLACK_USERNAME: RunCombi Android
111+
SLACK_MESSAGE: 'RunCombi Android PR 체크 성공 🎉 (v${{ steps.app_version.outputs.version_name }} - ${{ steps.app_version.outputs.version_code }})%0A%0A**PR 제목:** ${{ github.event.pull_request.title }}%0A**PR 설명:** ${{ github.event.pull_request.body }}%0A**작성자:** @${{ github.event.pull_request.user.login }}%0A**브랜치:** ${{ github.event.pull_request.head.ref }} → ${{ github.event.pull_request.base.ref }}'
112+
113+
- name: If Fail, Send notification on Slack
114+
if: ${{failure()}}
115+
uses: rtCamp/action-slack-notify@v2
116+
env:
117+
SLACK_COLOR: '#ff0000'
118+
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
119+
SLACK_TITLE: 'RunCombi Android PR Check Failed ❌'
120+
MSG_MINIMAL: true
121+
SLACK_USERNAME: RunCombi Android
122+
SLACK_MESSAGE: 'RunCombi Android PR 체크 실패 - 확인이 필요합니다 🔍 (v${{ steps.app_version.outputs.version_name }} - ${{ steps.app_version.outputs.version_code }})%0A%0A**PR 제목:** ${{ github.event.pull_request.title }}%0A**PR 설명:** ${{ github.event.pull_request.body }}%0A**작성자:** @${{ github.event.pull_request.user.login }}%0A**브랜치:** ${{ github.event.pull_request.head.ref }} → ${{ github.event.pull_request.base.ref }}'

0 commit comments

Comments
 (0)