2022-10-20 13:30:44 +00:00
|
|
|
name: "Build: Android"
|
2022-07-14 17:27:14 +00:00
|
|
|
on:
|
|
|
|
workflow_dispatch:
|
2022-09-20 17:39:49 +00:00
|
|
|
workflow_call:
|
|
|
|
inputs:
|
|
|
|
semver:
|
|
|
|
required: true
|
|
|
|
type: string
|
2024-05-12 21:08:59 +00:00
|
|
|
secrets:
|
|
|
|
KEYSTORE:
|
|
|
|
required: true
|
|
|
|
KEY_ALIAS:
|
|
|
|
required: true
|
|
|
|
KEY_PASS:
|
|
|
|
required: true
|
|
|
|
KEY_STORE_PASS:
|
|
|
|
required: true
|
2022-07-14 17:27:14 +00:00
|
|
|
push:
|
2022-09-20 17:39:49 +00:00
|
|
|
branches: [ "main" ]
|
2022-07-14 17:27:14 +00:00
|
|
|
paths: [ "mobile", "frontend" ]
|
|
|
|
pull_request:
|
2022-09-20 17:39:49 +00:00
|
|
|
branches: [ "main" ]
|
2022-07-14 17:27:14 +00:00
|
|
|
paths: [ "mobile", "frontend" ]
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build-android:
|
2023-05-06 13:42:48 +00:00
|
|
|
permissions: write-all
|
2022-07-14 17:27:14 +00:00
|
|
|
runs-on: ubuntu-latest
|
2022-10-25 18:04:12 +00:00
|
|
|
steps:
|
2022-07-14 17:27:14 +00:00
|
|
|
- name: 'Checkout'
|
2023-09-11 16:00:32 +00:00
|
|
|
uses: actions/checkout@v4
|
2022-07-14 17:27:14 +00:00
|
|
|
|
2022-10-04 16:00:37 +00:00
|
|
|
- name: 'Download Android Web.bundle Artifact (built frontend)'
|
2022-09-29 12:49:01 +00:00
|
|
|
if: inputs.semver == '' # Only if workflow fired from frontend-build.yml
|
2024-06-13 07:34:10 +00:00
|
|
|
uses: dawidd6/action-download-artifact@v6
|
2022-07-14 17:27:14 +00:00
|
|
|
with:
|
|
|
|
workflow: frontend-build.yml
|
|
|
|
workflow_conclusion: success
|
2022-10-04 16:00:37 +00:00
|
|
|
name: mobile-web.bundle
|
2022-10-04 16:30:45 +00:00
|
|
|
path: mobile/html/Web.bundle
|
2022-07-14 17:27:14 +00:00
|
|
|
|
2022-09-29 12:49:01 +00:00
|
|
|
- name: 'Download main.js Artifact for a release'
|
|
|
|
if: inputs.semver != '' # Only if fired as job in release.yml
|
2023-12-25 13:16:37 +00:00
|
|
|
uses: actions/download-artifact@v4
|
2022-09-29 12:49:01 +00:00
|
|
|
with:
|
2022-10-04 16:30:45 +00:00
|
|
|
name: mobile-web.bundle
|
|
|
|
path: mobile/html/Web.bundle
|
2022-09-29 12:49:01 +00:00
|
|
|
|
2022-07-14 17:27:14 +00:00
|
|
|
- name: 'Install npm Dependencies'
|
|
|
|
run: |
|
|
|
|
cd mobile
|
2022-10-04 16:00:37 +00:00
|
|
|
npm install
|
2022-07-14 17:27:14 +00:00
|
|
|
|
2022-10-31 11:43:20 +00:00
|
|
|
- name: 'Patch modules' # react-native-tor and react-native-encrypted-storage rely on deprecated jcenter repositories. We patch the modules temporarily
|
|
|
|
run: |
|
|
|
|
cd mobile
|
|
|
|
cp -r patch_modules/* node_modules/
|
2023-11-30 15:56:12 +00:00
|
|
|
- uses: actions/setup-java@v4
|
2022-09-28 14:51:29 +00:00
|
|
|
with:
|
|
|
|
distribution: temurin
|
|
|
|
java-version: 11
|
2022-10-25 18:04:12 +00:00
|
|
|
|
2022-09-28 14:51:29 +00:00
|
|
|
- name: Setup Gradle
|
2024-02-04 21:43:46 +00:00
|
|
|
uses: gradle/gradle-build-action@v3
|
2022-09-28 14:51:29 +00:00
|
|
|
|
2024-05-05 20:01:19 +00:00
|
|
|
- name: Decode Keystore
|
|
|
|
id: decode_keystore
|
|
|
|
uses: timheuer/base64-to-file@v1.2
|
|
|
|
with:
|
|
|
|
fileName: 'keystore.jks'
|
|
|
|
fileDir: './'
|
|
|
|
encodedString: ${{ secrets.KEYSTORE }}
|
|
|
|
|
2022-07-14 17:27:14 +00:00
|
|
|
- name: 'Build Android Release'
|
|
|
|
run: |
|
|
|
|
cd mobile/android
|
|
|
|
./gradlew assembleRelease
|
2024-05-05 20:01:19 +00:00
|
|
|
env:
|
|
|
|
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
|
|
|
|
KEY_PASS: ${{ secrets.KEY_PASS }}
|
|
|
|
KEY_STORE_PASS: ${{ secrets.KEY_STORE_PASS }}
|
|
|
|
|
|
|
|
|
|
|
|
- name: 'Check for non-FOSS libraries'
|
|
|
|
run: |
|
|
|
|
wget https://github.com/iBotPeaches/Apktool/releases/download/v2.7.0/apktool_2.7.0.jar
|
|
|
|
wget https://github.com/iBotPeaches/Apktool/raw/master/scripts/linux/apktool
|
|
|
|
# clone the repo
|
|
|
|
git clone https://gitlab.com/IzzyOnDroid/repo.git
|
|
|
|
# create a directory for Apktool and move the apktool* files there
|
|
|
|
mkdir -p repo/lib/radar/tool
|
|
|
|
mv apktool* repo/lib/radar/tool
|
|
|
|
# create an alias for ease of use
|
|
|
|
chmod u+x repo/lib/radar/tool/apktool
|
|
|
|
mv repo/lib/radar/tool/apktool_2.7.0.jar repo/lib/radar/tool/apktool.jar
|
|
|
|
repo/bin/scanapk.php mobile/android/app/build/outputs/apk/release/app-universal-release.apk
|
2022-07-14 17:27:14 +00:00
|
|
|
|
|
|
|
- name: 'Get Commit Hash'
|
|
|
|
id: commit
|
2023-09-21 13:04:58 +00:00
|
|
|
uses: pr-mpt/actions-commit-hash@v3
|
2022-07-14 17:27:14 +00:00
|
|
|
|
2023-04-10 17:02:30 +00:00
|
|
|
# Create artifacts (only for Release)
|
|
|
|
# Create app-universal-release APK artifact asset for Release
|
|
|
|
- name: 'Upload universal .apk Release Artifact (for Release)'
|
2023-12-25 13:20:19 +00:00
|
|
|
uses: actions/upload-artifact@v4
|
2022-09-20 17:39:49 +00:00
|
|
|
if: inputs.semver != '' # If this workflow is called from release.yml
|
|
|
|
with:
|
2023-04-10 17:02:30 +00:00
|
|
|
name: robosats-${{ inputs.semver }}-universal.apk
|
|
|
|
path: mobile/android/app/build/outputs/apk/release/app-universal-release.apk
|
2022-09-20 17:39:49 +00:00
|
|
|
|
2023-04-10 17:02:30 +00:00
|
|
|
# Create app-arm64-v8a-release APK artifact asset for Release
|
|
|
|
- name: 'Upload arm64-v8a .apk Release Artifact (for Release)'
|
2023-12-25 13:20:19 +00:00
|
|
|
uses: actions/upload-artifact@v4
|
2023-04-10 17:02:30 +00:00
|
|
|
if: inputs.semver != '' # If this workflow is called from release.yml
|
|
|
|
with:
|
|
|
|
name: robosats-${{ inputs.semver }}-arm64-v8a.apk
|
|
|
|
path: mobile/android/app/build/outputs/apk/release/app-arm64-v8a-release.apk
|
|
|
|
|
|
|
|
# Create app-armeabi-v7a-release APK artifact asset for Release
|
|
|
|
- name: 'Upload armeabi-v7a .apk Release Artifact (for Release)'
|
2023-12-25 13:20:19 +00:00
|
|
|
uses: actions/upload-artifact@v4
|
2023-04-10 17:02:30 +00:00
|
|
|
if: inputs.semver != '' # If this workflow is called from release.yml
|
|
|
|
with:
|
|
|
|
name: robosats-${{ inputs.semver }}-armeabi-v7a.apk
|
|
|
|
path: mobile/android/app/build/outputs/apk/release/app-armeabi-v7a-release.apk
|
|
|
|
|
|
|
|
# Create app-x86_64-release APK artifact asset for Release
|
|
|
|
- name: 'Upload x86_64 .apk Release Artifact (for Release)'
|
2023-12-25 13:20:19 +00:00
|
|
|
uses: actions/upload-artifact@v4
|
2023-04-10 17:02:30 +00:00
|
|
|
if: inputs.semver != '' # If this workflow is called from release.yml
|
2022-07-14 17:27:14 +00:00
|
|
|
with:
|
2023-04-10 17:02:30 +00:00
|
|
|
name: robosats-${{ inputs.semver }}-x86_64.apk
|
|
|
|
path: mobile/android/app/build/outputs/apk/release/app-x86_64-release.apk
|
2022-09-20 17:39:49 +00:00
|
|
|
|
2023-04-10 17:02:30 +00:00
|
|
|
# Create app-x86-release APK artifact asset for Release
|
|
|
|
- name: 'Upload x86 .apk Release Artifact (for Release)'
|
2023-12-25 13:20:19 +00:00
|
|
|
uses: actions/upload-artifact@v4
|
2023-04-10 17:02:30 +00:00
|
|
|
if: inputs.semver != '' # If this workflow is called from release.yml
|
|
|
|
with:
|
|
|
|
name: robosats-${{ inputs.semver }}-x86.apk
|
|
|
|
path: mobile/android/app/build/outputs/apk/release/app-x86-release.apk
|
2022-09-28 14:51:29 +00:00
|
|
|
|
2022-09-20 17:39:49 +00:00
|
|
|
- name: 'Create Pre-release'
|
|
|
|
id: create_release
|
|
|
|
if: inputs.semver == '' # only if this workflow is not called from a push to tag (a Release)
|
2023-09-07 08:54:55 +00:00
|
|
|
uses: ncipollo/release-action@v1.13.0
|
2022-09-20 17:39:49 +00:00
|
|
|
with:
|
2023-05-06 13:42:48 +00:00
|
|
|
tag: android-${{ steps.commit.outputs.short }}
|
|
|
|
name: robosats-android-${{ steps.commit.outputs.short }}
|
2022-09-20 17:39:49 +00:00
|
|
|
prerelease: true
|
|
|
|
|
2023-04-10 17:02:30 +00:00
|
|
|
# Upload universal APK to pre-release
|
|
|
|
- name: 'Upload universal Pre-release APK Asset'
|
|
|
|
id: upload-release-universal-apk-asset
|
|
|
|
if: inputs.semver == '' # only if this workflow is not called from a push to tag (a Release)
|
|
|
|
uses: actions/upload-release-asset@v1
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
with:
|
|
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
|
|
asset_path: ./mobile/android/app/build/outputs/apk/release/app-universal-release.apk
|
|
|
|
asset_name: robosats-${{ steps.commit.outputs.short }}-universal.apk
|
|
|
|
asset_content_type: application/apk
|
|
|
|
|
|
|
|
# Upload arm64-v8a APK to pre-release
|
|
|
|
- name: 'Upload arm64-v8a Pre-release APK Asset'
|
|
|
|
id: upload-release-arm64-v8a-apk-asset
|
2022-09-20 17:39:49 +00:00
|
|
|
if: inputs.semver == '' # only if this workflow is not called from a push to tag (a Release)
|
|
|
|
uses: actions/upload-release-asset@v1
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
with:
|
|
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
2023-04-10 17:02:30 +00:00
|
|
|
asset_path: ./mobile/android/app/build/outputs/apk/release/app-arm64-v8a-release.apk
|
|
|
|
asset_name: robosats-${{ steps.commit.outputs.short }}-arm64-v8a.apk
|
2022-09-28 12:08:16 +00:00
|
|
|
asset_content_type: application/apk
|
2022-09-28 14:51:29 +00:00
|
|
|
|
2023-04-10 17:02:30 +00:00
|
|
|
# Upload armeabi-v7a APK to pre-release
|
|
|
|
- name: 'Upload armeabi-v7a Pre-release APK Asset'
|
|
|
|
id: upload-release-armeabi-v7a-apk-asset
|
|
|
|
if: inputs.semver == '' # only if this workflow is not called from a push to tag (a Release)
|
|
|
|
uses: actions/upload-release-asset@v1
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
with:
|
|
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
|
|
asset_path: ./mobile/android/app/build/outputs/apk/release/app-armeabi-v7a-release.apk
|
|
|
|
asset_name: robosats-${{ steps.commit.outputs.short }}-armeabi-v7a.apk
|
|
|
|
asset_content_type: application/apk
|
|
|
|
|
|
|
|
# Upload x86_64 APK to pre-release
|
|
|
|
- name: 'Upload x86_64 Pre-release APK Asset'
|
|
|
|
id: upload-release-x86_64-apk-asset
|
|
|
|
if: inputs.semver == '' # only if this workflow is not called from a push to tag (a Release)
|
|
|
|
uses: actions/upload-release-asset@v1
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
with:
|
|
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
|
|
asset_path: ./mobile/android/app/build/outputs/apk/release/app-x86_64-release.apk
|
|
|
|
asset_name: robosats-${{ steps.commit.outputs.short }}-x86_64.apk
|
|
|
|
asset_content_type: application/apk
|
|
|
|
|
|
|
|
# Upload x86 APK to pre-release
|
|
|
|
- name: 'Upload x86 Pre-release APK Asset'
|
|
|
|
id: upload-release-x86-apk-asset
|
|
|
|
if: inputs.semver == '' # only if this workflow is not called from a push to tag (a Release)
|
|
|
|
uses: actions/upload-release-asset@v1
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
with:
|
|
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
|
|
asset_path: ./mobile/android/app/build/outputs/apk/release/app-x86-release.apk
|
|
|
|
asset_name: robosats-${{ steps.commit.outputs.short }}-x86.apk
|
|
|
|
asset_content_type: application/apk
|