File tree Expand file tree Collapse file tree 4 files changed +29
-22
lines changed
Expand file tree Collapse file tree 4 files changed +29
-22
lines changed Original file line number Diff line number Diff line change 11name : " Build Android library"
22description : " Create artifact for Android library"
33inputs :
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'
107
118runs :
129 using : " composite"
@@ -31,14 +28,21 @@ runs:
3128 i686-linux-android
3229 cargo install cargo-ndk
3330
34- - name : Build for Android
31+ - name : Build signed library
3532 shell : bash
36- env :
37- GPG_PRIVATE_KEY : ${{ inputs.gpg-key }}
38- GPG_PASSWORD : ${{ inputs.gpg-password }}
33+ if : ${{ inputs.sign-publication == '1' }}
3934 run : |
4035 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
4246 ls -lh build/outputs/aar
4347 find build/repository
4448
Original file line number Diff line number Diff line change 1313 submodules : true
1414 - name : Build Android
1515 uses : ./.github/actions/android
16+ with :
17+ sign-publication : ' 0'
Original file line number Diff line number Diff line change 4242 submodules : true
4343 - name : Build Android
4444 uses : ./.github/actions/android
45- with :
46- gpg-key : ${{ secrets.GPG_PRIVATE_KEY }}
47- gpg-password : ${{ secrets.GPG_PASSWORD }}
4845
4946 publish_android :
5047 permissions :
Original file line number Diff line number Diff line change @@ -170,14 +170,18 @@ publishing {
170170}
171171
172172signing {
173- val privateKey = System .getenv(" GPG_PRIVATE_KEY" )
174-
175- if (privateKey == null || privateKey == " null" ) {
176- // Don't sign the publication.
177- } else {
178- var signingKey = String (Base64 .getDecoder().decode(System .getenv(" GPG_PRIVATE_KEY" ))).trim()
179- var signingPassword = System .getenv(" GPG_PASSWORD" )
180- useInMemoryPgpKeys(signingKey, signingPassword)
173+ val sign = providers.gradleProperty(" signPublication" ).getOrElse(" 1" )
174+
175+ if (sign != " 0" ) {
176+ val key = providers.gradleProperty(" gpgKey" )
177+ val password = providers.gradleProperty(" gpgPassword" )
178+
179+ if (key.isPresent()) {
180+ val signingKey = String (Base64 .getDecoder().decode(key.get())).trim()
181+ useInMemoryPgpKeys(signingKey, password.get())
182+ } else {
183+ useGpgCmd()
184+ }
181185
182186 sign(publishing.publications)
183187 }
You can’t perform that action at this time.
0 commit comments