-
Notifications
You must be signed in to change notification settings - Fork 140
102 lines (86 loc) · 2.89 KB
/
main.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
name: Debug & Release
on:
# Triggers the workflow on every pull request to master branch
pull_request:
branches:
- master
push:
branches:
- master
tags:
- v*.*.*
paths:
- 'Android/**'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
debug:
runs-on: ubuntu-latest
defaults:
run:
working-directory: Android/MASTG-Android-Kotlin-App
steps:
- name: Checkout the code
uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/buildSrc/**/*.kt') }}
- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '11'
- name: Build debug APK
run: ./gradlew assembleDebug
- name: Upload debug APK
uses: actions/upload-artifact@v2
with:
name: app-debug
path: ./Android/MASTG-Android-Kotlin-App/app/build/outputs/apk/debug/app-debug.apk
release:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
defaults:
run:
working-directory: Android/MASTG-Android-Kotlin-App
steps:
- name: Checkout the code
uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/buildSrc/**/*.kt') }}
- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '11'
- name: Build release APK
run: ./gradlew assembleRelease
- uses: ilharp/sign-android-release@v1
name: Sign app APK
# ID used to access action output
id: sign_app
with:
releaseDir: ./Android/MASTG-Android-Kotlin-App/app/build/outputs/apk/release
signingKey: ${{ secrets.KEYSTORE }}
keyAlias: ${{ secrets.SIGNING_KEY_ALIAS }}
keyStorePassword: ${{ secrets.SIGNING_STORE_PASSWORD }}
keyPassword: ${{ secrets.SIGNING_KEY_PASSWORD }}
- name: Rename signed APK
run: mv ./app/build/outputs/apk/release/app-release-unsigned-signed.apk ./app/build/outputs/apk/release/MASTG-Android.apk
- name: Release
uses: softprops/action-gh-release@v1
with:
prerelease: false
draft: true
generate_release_notes: true
files: |
./Android/MASTG-Android-Kotlin-App/app/build/outputs/apk/release/MASTG-Android.apk
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}