File tree 4 files changed +29
-22
lines changed
4 files changed +29
-22
lines changed Original file line number Diff line number Diff line change 1
1
name : " Build Android library"
2
2
description : " Create artifact for Android library"
3
3
inputs :
4
- gpg-key :
5
- required : false
6
- description : " The GPG key to use when signing the publication"
7
- gpg-password :
8
- required : false
9
- description : " Password for the GPG key."
4
+ sign-publication :
5
+ description : " Whether to sign the built library"
6
+ default : ' 1'
10
7
11
8
runs :
12
9
using : " composite"
@@ -31,14 +28,21 @@ runs:
31
28
i686-linux-android
32
29
cargo install cargo-ndk
33
30
34
- - name : Build for Android
31
+ - name : Build signed library
35
32
shell : bash
36
- env :
37
- GPG_PRIVATE_KEY : ${{ inputs.gpg-key }}
38
- GPG_PASSWORD : ${{ inputs.gpg-password }}
33
+ if : ${{ inputs.sign-publication == '1' }}
39
34
run : |
40
35
cd android
41
- ./gradlew build publishAllPublicationsToHereRepository
36
+ ./gradlew build publishAllPublicationsToHereRepository -PgpgKey=${{ secrets.GPG_PRIVATE_KEY }} -PgpgPassword=${{ secrets.GPG_PASSWORD }}
37
+ ls -lh build/outputs/aar
38
+ find build/repository
39
+
40
+ - name : Build library without signing
41
+ shell : bash
42
+ if : ${{ inputs.sign-publication == '0' }}
43
+ run : |
44
+ cd android
45
+ ./gradlew build publishAllPublicationsToHereRepository -PsignPublication=0
42
46
ls -lh build/outputs/aar
43
47
find build/repository
44
48
Original file line number Diff line number Diff line change 13
13
submodules : true
14
14
- name : Build Android
15
15
uses : ./.github/actions/android
16
+ with :
17
+ sign-publication : ' 0'
Original file line number Diff line number Diff line change 42
42
submodules : true
43
43
- name : Build Android
44
44
uses : ./.github/actions/android
45
- with :
46
- gpg-key : ${{ secrets.GPG_PRIVATE_KEY }}
47
- gpg-password : ${{ secrets.GPG_PASSWORD }}
48
45
49
46
publish_android :
50
47
permissions :
Original file line number Diff line number Diff line change @@ -129,14 +129,18 @@ publishing {
129
129
}
130
130
131
131
signing {
132
- val privateKey = System .getenv(" GPG_PRIVATE_KEY" )
133
-
134
- if (privateKey == null || privateKey == " null" ) {
135
- // Don't sign the publication.
136
- } else {
137
- var signingKey = String (Base64 .getDecoder().decode(System .getenv(" GPG_PRIVATE_KEY" ))).trim()
138
- var signingPassword = System .getenv(" GPG_PASSWORD" )
139
- useInMemoryPgpKeys(signingKey, signingPassword)
132
+ val sign = providers.gradleProperty(" signPublication" ).getOrElse(" 1" )
133
+
134
+ if (sign != " 0" ) {
135
+ val key = providers.gradleProperty(" gpgKey" )
136
+ val password = providers.gradleProperty(" gpgPassword" )
137
+
138
+ if (key.isPresent()) {
139
+ val signingKey = String (Base64 .getDecoder().decode(key.get())).trim()
140
+ useInMemoryPgpKeys(signingKey, password.get())
141
+ } else {
142
+ useGpgCmd()
143
+ }
140
144
141
145
sign(publishing.publications)
142
146
}
You can’t perform that action at this time.
0 commit comments