-
-
Notifications
You must be signed in to change notification settings - Fork 2
78 lines (65 loc) · 1.97 KB
/
gen-android-apk.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
name: Release APK
env:
main_project_module: app
on:
# Allows to run this workflow automatically when a tag is pushed
push:
tags:
- 'v*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code at the latest commit in branch
id: checkout-code
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
fetch-depth: 0
- name: Set Up JDK
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: "17"
cache: "gradle"
- name: Cache Gradle and wrapper
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
- name: Cache dependencies
uses: actions/cache@v4
with:
path: |
~/.gradle/caches/modules-2
~/.gradle/caches/jars-3
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Change wrapper permissions
run: chmod +x ./gradlew
- name: Run tests
run: ./gradlew test
- name: Build project
run: ./gradlew build
- name: Build Debug APK
run: ./gradlew assembleDebug
- name: Create Github Release
env:
GH_PAT: ${{ secrets.GH_PAT }}
tag: ${{ github.ref_name }}
run: |
gh auth login --with-token <<< "$GH_PAT"
gh release create "$tag" \
--repo="$GITHUB_REPOSITORY" \
--title="$tag" \
--generate-notes
- name: Upload Debug APK to Github Release
env:
GH_PAT: ${{ secrets.GH_PAT }}
tag: ${{ github.ref_name }}
run: |
gh auth login --with-token <<< "$GH_PAT"
gh release upload "$tag" ./app/build/outputs/apk/debug/app-debug.apk --clobber