-
Notifications
You must be signed in to change notification settings - Fork 2
131 lines (113 loc) · 4.25 KB
/
ci.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
119
120
121
122
123
124
125
126
127
128
129
130
131
name: Build CI
on:
push:
branches: [ master ]
paths:
- 'app/**'
- 'gradle/**'
- 'build.gradle.kts'
- 'gradle.properties'
- 'settings.gradle.kts'
- '.github/workflows/ci.yml'
workflow_dispatch:
jobs:
buildMaster:
name: Build Ci APK from master
if: startsWith(github.ref, 'refs/heads/master')
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- uses: nttld/setup-ndk@v1
with:
ndk-version: r26c
- name: Get Commit Message
id: commitMessage
run: IN="${{ github.event.head_commit.message }}" && echo "::set-output name=message::${IN%%$'\n'*}"
- name: Setup JDK
uses: actions/setup-java@v4
with:
java-version: 21
distribution: temurin
- name: Cache Gradle dependencies
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
!~/.gradle/caches/build-cache-*
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle.kts') }}
restore-keys: ${{ runner.os }}-gradle-
- name: Cache build cache
uses: actions/cache@v4
with:
path: |
${{ github.workspace }}/.ccache
~/.gradle/caches/build-cache-*
key: ${{ runner.os }}-build-cache-${{ github.sha }}
restore-keys: ${{ runner.os }}-build-cache-
- name: Extract branch name
shell: bash
run: echo "::set-output name=BRANCH_NAME::$(echo ${GITHUB_REF#refs/heads/} | sed 's/\//_/g')"
id: extract_branch
- name: File Permissions
run: chmod +x gradlew
- name: Accept Preview SDK License
run: echo -n -e "\n84831b9409646a918e30573bab4c9c91346d8abd" > /usr/local/lib/android/sdk/licenses/android-sdk-preview-license
- name: Build apk
id: buildAllApks
uses: gradle/actions/setup-gradle@v3
with:
gradle-version: wrapper
arguments: assembleRelease
- name: Get JSON
id: metadataJson
run: |
content=`cat app/build/outputs/apk/release/output-metadata.json`
content="${content//'%'/'%25'}"
content="${content//$'\n'/'%0A'}"
content="${content//$'\r'/'%0D'}"
echo "::set-output name=json::$content"
- name: Sign artifact
id: signArtifact
uses: ilharp/sign-android-release@v1
with:
releaseDir: app/build/outputs/apk/release
keyAlias: ${{ secrets.KEYALIAS }}
signingKey: ${{ secrets.SIGNING_KEY }}
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
keyPassword: ${{ secrets.KEY_PASSWORD }}
buildToolsVersion: 35.0.0-rc1
- name: List files
run: ls app/build/outputs/apk/release
- name: Rename APK
run: mv app/build/outputs/apk/release/app-release-unsigned-signed.apk app/build/outputs/apk/release/app-release.apk
- name: Upload Artifact
uses: actions/upload-artifact@v4.3.1
with:
name: Release Artifact
path: app/build/outputs/apk/release/app-release.apk
- name: Create new Release
id: create_release
uses: marvinpinto/action-automatic-releases@latest
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
automatic_release_tag: ${{ fromJson(steps.metadataJson.outputs.json).elements[0].versionName }}
prerelease: false
title: Rboard Patcher Development ${{ fromJson(steps.metadataJson.outputs.json).elements[0].versionName }}
files: |
app/build/outputs/apk/release/app-release.apk
app/build/outputs/apk/release/output-metadata.json
- name: Create new Release
id: create_latest_release
uses: marvinpinto/action-automatic-releases@latest
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
automatic_release_tag: latest
prerelease: false
title: Rboard Patcher Development ${{ fromJson(steps.metadataJson.outputs.json).elements[0].versionName }}
files: |
app/build/outputs/apk/release/app-release.apk
app/build/outputs/apk/release/output-metadata.json