OPS: build & sign release APK on GA

This commit is contained in:
Overtorment 2022-04-29 22:49:13 +01:00 committed by GitHub
parent 579baf4bb9
commit fac41af2a2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 66 additions and 2 deletions

45
.github/workflows/build-release-apk.yml vendored Normal file
View file

@ -0,0 +1,45 @@
name: BuildReleaseApk
on: [pull_request]
jobs:
buildReleaseApk:
runs-on: macos-latest
steps:
- name: Checkout project
uses: actions/checkout@v3
- name: Specify node version
uses: actions/setup-node@v2-beta
with:
node-version: 16
- name: Use npm caches
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-
- name: Use specific Java version for sdkmanager to work
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '11'
cache: 'gradle'
- name: Install node_modules
run: npm install
- name: Build
env:
KEYSTORE_FILE_HEX: ${{ secrets.KEYSTORE_FILE_HEX }}
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
run: ./scripts/build-release-apk.sh
- uses: actions/upload-artifact@v2
if: success()
with:
name: apk
path: ./android/app/build/outputs/apk/release/app-release.apk

2
package-lock.json generated
View file

@ -25235,7 +25235,6 @@
"node_modules/rn-ldk": {
"version": "0.8.2",
"resolved": "git+ssh://git@github.com/BlueWallet/rn-ldk.git#b48d09b5db0fc0fa529fcee0c38a04d1be9c0cc3",
"integrity": "sha512-DbrDhB9W1I+hg4ADPFfR/k2UgJ9E3rsEf2LEMGm0Q2Ie/Eqb8crxoh1O1k8V780DVvF6fUADmuVWaSkZ9sSqQA==",
"license": "MIT",
"peerDependencies": {
"react": "*",
@ -47955,7 +47954,6 @@
},
"rn-ldk": {
"version": "git+ssh://git@github.com/BlueWallet/rn-ldk.git#b48d09b5db0fc0fa529fcee0c38a04d1be9c0cc3",
"integrity": "sha512-DbrDhB9W1I+hg4ADPFfR/k2UgJ9E3rsEf2LEMGm0Q2Ie/Eqb8crxoh1O1k8V780DVvF6fUADmuVWaSkZ9sSqQA==",
"from": "rn-ldk@github:BlueWallet/rn-ldk#v0.8.2",
"requires": {}
},

21
scripts/build-release-apk.sh Executable file
View file

@ -0,0 +1,21 @@
#!/bin/bash
# assumes 2 env variables: KEYSTORE_FILE_HEX & KEYSTORE_PASSWORD
#
# PS. to turn file to hex and back:
# $ xxd -plain test.txt > test.hex
# $ xxd -plain -revert test.hex test2.txt
echo $KEYSTORE_FILE_HEX > bluewallet-release-key.keystore.hex
xxd -plain -revert bluewallet-release-key.keystore.hex > ./android/bluewallet-release-key.keystore
rm bluewallet-release-key.keystore.hex
cd android
TIMESTAMP=$(date +%s)
sed -i'.original' "s/versionCode 1/versionCode $TIMESTAMP/g" app/build.gradle
./gradlew assembleRelease
mv ./app/build/outputs/apk/release/app-release-unsigned.apk ./app/build/outputs/apk/release/app-release.apk
$ANDROID_HOME/build-tools/30.0.2/apksigner sign --ks ./bluewallet-release-key.keystore --ks-pass=pass:$KEYSTORE_PASSWORD ./app/build/outputs/apk/release/app-release.apk