forked from bggRGjQaUbCoE/c001apk
-
Notifications
You must be signed in to change notification settings - Fork 0
90 lines (77 loc) · 2.69 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
name: CI
on:
workflow_dispatch:
push:
branches: [ main ]
paths-ignore:
- '**.md'
- '**.txt'
- '.github/**'
- '.idea/**'
- '!.github/workflows/**'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Gradle wrapper validation
uses: gradle/actions/wrapper-validation@v3
- name: set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'adopt'
cache: gradle
- name: Write key
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
run: |
if [ ! -z "${{ secrets.SIGN_KEYSTORE_BASE64 }}" ]; then
echo "${{ secrets.SIGN_KEYSTORE_BASE64 }}" | base64 --decode > key.jks
echo KEYSTORE_PATH='${{ github.workspace }}/key.jks' >> local.properties
echo KEYSTORE_PASSWORD='${{ secrets.KEYSTORE_PASSWORD }}' >> local.properties
echo KEY_ALIAS='${{ secrets.KEY_ALIAS }}' >> local.properties
echo KEY_PASSWORD='${{ secrets.KEY_PASSWORD }}' >> local.properties
fi
- name: Cache Gradle Dependencies
uses: actions/[email protected]
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
!~/.gradle/caches/build-cache-*
key: gradle-deps-core-${{ hashFiles('**/build.gradle.kts', '**/build.gradle', '**/libs.versions.toml') }}
restore-keys: |
gradle-deps
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build release
id: buildRelease
run: |
./gradlew :app:assembleRelease
echo "releaseName=$(ls app/build/outputs/apk/release/*.apk | awk -F '(/|\\.apk)' '{print $6}')" >> $GITHUB_OUTPUT
- name: Upload release
if: success()
uses: actions/upload-artifact@v4
with:
name: ${{ steps.buildRelease.outputs.releaseName }}
path: "app/build/outputs/apk/release/*.apk"
- name: Upload mappings
if: success()
uses: actions/upload-artifact@v4
with:
name: mappings
path: "app/build/outputs/mapping/release"
- name: Build debug
id: buildDebug
run: |
./gradlew :app:assembleDebug
echo "debugName=$(ls app/build/outputs/apk/debug/*.apk | awk -F '(/|\\.apk)' '{print $6}')" >> $GITHUB_OUTPUT
- name: Upload debug
if: success()
uses: actions/upload-artifact@v4
with:
name: ${{ steps.buildDebug.outputs.debugName }}
path: "app/build/outputs/apk/debug/*.apk"