-
Notifications
You must be signed in to change notification settings - Fork 3
76 lines (70 loc) · 2.56 KB
/
build.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
name: Android Build
on: [push]
defaults:
run:
shell: bash
working-directory: .
jobs:
build:
runs-on: ubuntu-latest
name: InstrumentationTest + Build
if: "!contains(toJSON(github.event.commits.*.message), '[skip action]') && !startsWith(github.ref, 'refs/tags/')"
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Gradle cache
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
# - uses: actions/setup-java@v1
# with:
# java-version: '1.8'
# - name: Android Emulator Runner, Test
# uses: ReactiveCircus/android-emulator-runner@v2.14.2
# with:
# api-level: 29
# script: ./gradlew connectedCheck
- name: Build Release
if: ${{ contains(github.ref, 'main') }}
run: ./gradlew assembleRelease
- name: Build Debug
if: ${{ !contains(github.ref, 'main') }}
run: ./gradlew assembleDebug
- name: Archive artifacts
uses: actions/upload-artifact@v2
with:
path: app/build/outputs
- name: Update Release apk name
if: ${{ success() && contains(github.ref, 'main') }}
run: |
mv app/build/outputs/apk/release/app-release.apk 웨디-릴리즈.apk
echo 'apk=웨디-릴리즈.apk' >> $GITHUB_ENV
- name: Upload APK
if: ${{ success() && contains(github.ref, 'main') }}
run: |
curl -X POST \
-F file=@$apk \
-F channels=${{secrets.SLACK_CHANNEL_ID}} \
-H "Authorization: Bearer ${{secrets.SLACK_BOT_API_TOKEN}}" \
https://slack.com/api/files.upload
- name: On success, Notify with Slack
if: ${{ success() && contains(github.ref, 'main') }}
uses: rtCamp/action-slack-notify@master
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_ANDROID }}
SLACK_TITLE: '안드로이드 릴리즈 빌드 성공 ✅'
MSG_MINIMAL: true
SLACK_MESSAGE: 'apk가 생성되었습니다'
- name: On fail, Notify with Slack
if: ${{ failure() }}
uses: rtCamp/action-slack-notify@master
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_ANDROID }}
SLACK_TITLE: '안드로이드 빌드 실패 ❌'
MSG_MINIMAL: false
SLACK_MESSAGE: '에러를 확인해주세요'