-
Notifications
You must be signed in to change notification settings - Fork 0
118 lines (99 loc) · 3.7 KB
/
android_cd.yml
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
name: DATEROAD CD
on:
push:
branches:
- main
pull_request:
branches:
- develop
defaults:
run:
shell: bash
working-directory: .
jobs:
build:
name: CD
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Gradle cache
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'temurin'
- name: Change gradlew permissions
run: chmod +x ./gradlew
- name: Touch local properties
run: touch local.properties
- name: Decode google-services.json
env:
FIREBASE_SECRET: ${{ secrets.FIREBASE_SECRET }}
run: echo $FIREBASE_SECRET > app/google-services.json
- name: Access local properties
env:
HFM_BASE_URL: ${{ secrets.BASE_URL }}
IO_SENTRY_TOKEN: ${{ secrets.IO_SENTRY_DSN }}
KAKAO_NATIVE_APP_KEY_MANIFEST: ${{ secrets.KAKAO_NATIVE_APP_KEY }}
KAKAO_NATIVE_APP_KEY: ${{ secrets.KAKAO_NATIVE_APP_KEY }}
run: |
echo "dev.base.url=\"$BASE_URL\"" >> local.properties
echo "io.sentry.dsn=\"$IO_SENTRY_DSN\"" >> local.properties
echo "kakao.native.app.key.manifest=\"$KAKAO_NATIVE_APP_KEY_MANIFEST\"" >> local.properties
echo "kakao.native.app.key=\"$KAKAO_NATIVE_APP_KEY\"" >> local.properties
- name: Access sentry properties
env:
DEFAULTS_ORG: ${{ secrets.DEFAULTS_ORG }}
DEFAULTS_PROJECT: ${{ secrets.DEFAULTS_PROJECT }}
run: |
echo "defaults.org=$DEFAULTS_ORG" >> sentry.properties
echo "defaults.project=$DEFAULTS_PROJECT" >> sentry.properties
- name: Build Release APK
run: |
./gradlew :app:assembleRelease
- name: Upload Release APK
uses: actions/upload-artifact@v3
with:
name: release
path: ./app/build/outputs/apk/release/app-release-unsigned.apk
- name: Get Release APK Download URL
id: get-artifact-url
run: |
ARTIFACTS=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts")
ARTIFACT_ID=$(echo "$ARTIFACTS" | jq -r '.artifacts[] | select(.name=="release") | .id')
if [ -z "$ARTIFACT_ID" ]; then
echo "Artifact ID not found. Exiting."
exit 1
fi
DOWNLOAD_URL="https://api.github.com/repos/${{ github.repository }}/actions/artifacts/${ARTIFACT_ID}/zip"
echo "::set-output name=url::$DOWNLOAD_URL"
- name: Discord Notify - Success
if: ${{ success() }}
uses: sarisia/actions-status-discord@v1
with:
title: ✅ Release Test가 완료되었습니다! 🔥
webhook: ${{ secrets.DISCORD_WEBHOOK_URL }}
color: B7FF1D
username: DATEROAD-ANDROID 🍫
content: |
Release Test가 완료되었습니다!
[❇️ APK를 다운로드해 보세요! ❇️](${{ steps.get-artifact-url.outputs.url }})
- name: Discord Notify - Failure
if: ${{ failure() }}
uses: sarisia/actions-status-discord@v1
with:
title: ❌ Release Test Failed ❌
webhook: ${{ secrets.DISCORD_WEBHOOK_URL }}
color: FF0000
username: DATEROAD-ANDROID 🍫
content: 에러를 확인해 주세요 🫨