Skip to content

Commit

Permalink
Update android-publish.yml
Browse files Browse the repository at this point in the history
Change-Id: Ia3aa59bbfefb36b745c436c89e5ac93a0c64dadf
  • Loading branch information
yangkx1024 committed Nov 27, 2023
1 parent dc7d099 commit 69e5f8e
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 33 deletions.
62 changes: 41 additions & 21 deletions .github/workflows/android-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,44 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Import GPG
env:
signingSecret: ${{ secrets.GPG_SECRET }}
run: |
echo ${signingSecret} | base64 -di | gpg --dearmor > ./android/secret.gpg
- name: Android publish
env:
sonatypeUsername: ${{ secrets.SONATYPEUSERNAME }}
sonatypePassword: ${{ secrets.SONATYPEPASSWORD }}
signingKeyId: ${{ secrets.GPG_KEY_ID }}
signingPwd: ${{ secrets.GPG_PWD }}
run: |
cd ./android
echo sonatypeUsername=${sonatypeUsername} >> local.properties
echo sonatypePassword=${sonatypePassword} >> local.properties
echo signing.keyId=${signingKeyId} >> local.properties
echo signing.password=${signingPwd} >> local.properties
echo signing.secretKeyRingFile=secret.gpg >> local.properties
chmod +x gradlew
./gradlew publish
- uses: actions/checkout@v3

- name: set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: 'gradle'

- name: Decode Keystore
env:
ENCODED_KEYSTORE: ${{ secrets.KEYSTORE }}
GPG_SECRET: ${{ secrets.GPG_SECRET }}
run: |
echo ${ENCODED_KEYSTORE} | base64 -di > ./android/app/keystore.jks
echo ${GPG_SECRET} | base64 -di | gpg --dearmor > ./android/secret.gpg
- name: Android publish
env:
SIGN_KEY_STORE_PATH: keystore.jks
SIGN_STORE_PASSWORD: ${{ secrets.SIGN_STORE_PASSWORD }}
SIGN_KEY_ALIAS: ${{ secrets.SIGN_KEY_ALIAS }}
SIGN_KEY_PASSWORD: ${{ secrets.SIGN_KEY_PASSWORD }}
SONATYPEUSERNAME: ${{ secrets.SONATYPEUSERNAME }}
SONATYPEPASSWORD: ${{ secrets.SONATYPEPASSWORD }}
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}
GPG_PWD: ${{ secrets.GPG_PWD }}
run: |
cd ./android
echo SIGN_KEY_STORE_PATH=keystore.jks >> local.properties
echo SIGN_STORE_PASSWORD=${SIGN_STORE_PASSWORD} >> local.properties
echo SIGN_KEY_ALIAS=${SIGN_KEY_ALIAS} >> local.properties
echo SIGN_KEY_PASSWORD=${SIGN_KEY_PASSWORD} >> local.properties
echo sonatypeUsername=${SONATYPEUSERNAME} >> local.properties
echo sonatypePassword=${SONATYPEPASSWORD} >> local.properties
echo signing.keyId=${GPG_KEY_ID} >> local.properties
echo signing.password=${GPG_PWD} >> local.properties
echo signing.secretKeyRingFile=secret.gpg >> local.properties
chmod +x gradlew
./gradlew clean
./gradlew publish
18 changes: 11 additions & 7 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,21 @@ jobs:

- name: Decode Keystore
env:
ENCODED_STRING: ${{ secrets.KEYSTORE }}
run: echo $ENCODED_STRING | base64 -di > ./android/app/keystore.jks
ENCODED_KEYSTORE: ${{ secrets.KEYSTORE }}
run: echo ${ENCODED_KEYSTORE} | base64 -di > ./android/app/keystore.jks

- name: Build with Gradle
env:
SIGN_KEY_STORE_PATH: keystore.jks
SIGN_STORE_PASSWORD: ${{ secrets.SIGN_STORE_PASSWORD }}
SIGN_KEY_ALIAS: ${{ secrets.SIGN_KEY_ALIAS }}
SIGN_KEY_PASSWORD: ${{ secrets.SIGN_KEY_PASSWORD }}
run: |
cd ./android
echo SIGN_KEY_STORE_PATH=keystore.jks >> local.properties
echo SIGN_STORE_PASSWORD=${SIGN_STORE_PASSWORD} >> local.properties
echo SIGN_KEY_ALIAS=${SIGN_KEY_ALIAS} >> local.properties
echo SIGN_KEY_PASSWORD=${SIGN_KEY_PASSWORD} >> local.properties
chmod +x gradlew
./gradlew clean
./gradlew assembleDebug
env:
SIGN_KEY_STORE_PATH: keystore.jks
SIGN_KEY_ALIAS: ${{ secrets.SIGN_KEY_ALIAS }}
SIGN_KEY_PASSWORD: ${{ secrets.SIGN_KEY_PASSWORD }}
SIGN_STORE_PASSWORD: ${{ secrets.SIGN_STORE_PASSWORD }}
5 changes: 0 additions & 5 deletions android/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@ if (propFile.exists()) {
prop.forEach {
ext.set(it.key as String, it.value as String)
}
} else {
ext.set("SIGN_KEY_ALIAS", System.getenv("SIGN_KEY_ALIAS"))
ext.set("SIGN_KEY_PASSWORD", System.getenv("SIGN_KEY_PASSWORD"))
ext.set("SIGN_KEY_STORE_PATH", System.getenv("SIGN_KEY_STORE_PATH"))
ext.set("SIGN_STORE_PASSWORD", System.getenv("SIGN_STORE_PASSWORD"))
}

android {
Expand Down

0 comments on commit 69e5f8e

Please sign in to comment.