-
Notifications
You must be signed in to change notification settings - Fork 9
/
action.yml
71 lines (56 loc) · 1.92 KB
/
action.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
name: "Build Signed APK"
description: "Build a signed APK of your Android application"
branding:
icon: cpu
color: red
inputs:
keystore_b64:
description: "The contents of the keystore file, encoded as base64"
required: false
keystore_file:
description: "The path to the .jks keystore file"
required: false
keystore_password:
description: "Keystore file password"
required: true
key_alias:
description: "Key alias"
required: true
key_password:
description: "Key password"
required: true
gradlew_dir:
description: "Directory of the gradlew file"
required: false
default: "."
java_version:
description: "Java version to build the project with"
required: false
default: '11'
runs:
using: "composite"
steps:
- name: Setup Android SDK
uses: android-actions/setup-android@v2
- name: Write keystore file from content
if: inputs.keystore_b64
shell: bash
run: echo "${{ inputs.keystore_b64 }}" | base64 -d > "$GITHUB_WORKSPACE/signing-key.jks"
- name: Copy keystore file to right location
if: inputs.keystore_file && !inputs.keystore_b64
shell: bash
run: cp "${{ inputs.keystore_file }}" "$GITHUB_WORKSPACE/signing-key.jks"
- name: Build APK
shell: bash
working-directory: ${{ inputs.gradlew_dir }}
run: |
export JAVA_HOME="/usr/lib/jvm/temurin-${{ inputs.java_version }}-jdk-amd64"
chmod +x ./gradlew
./gradlew build --no-daemon
./gradlew assembleRelease --no-daemon \
-Pandroid.injected.signing.store.file="$GITHUB_WORKSPACE/signing-key.jks" \
-Pandroid.injected.signing.store.password="${{ inputs.keystore_password }}" \
-Pandroid.injected.signing.key.alias="${{ inputs.key_alias }}" \
-Pandroid.injected.signing.key.password="${{ inputs.key_password }}"
- shell: bash
run: rm "$GITHUB_WORKSPACE/signing-key.jks"