Skip to content

Commit

Permalink
Set up Android APK build workflow for releases
Browse files Browse the repository at this point in the history
  • Loading branch information
Reckless-Satoshi committed Sep 28, 2022
1 parent 344ba2a commit ab4d83b
Show file tree
Hide file tree
Showing 8 changed files with 80 additions and 35 deletions.
43 changes: 38 additions & 5 deletions .github/workflows/android-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,28 @@ jobs:
with:
workflow: frontend-build.yml
workflow_conclusion: success
name: main-js
name: mobile-main-js
path: mobile/html/Web.bundle/js/

- name: 'Install npm Dependencies'
run: |
cd mobile
npm install --force
- uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 11

- name: Setup Gradle
uses: gradle/gradle-build-action@v2

- name: 'Build Android Debug'
if: inputs.semver == '' # Only build debug if this is a pre-release
run: |
cd mobile/android
./gradlew assembleDebug
- name: 'Build Android Release'
run: |
cd mobile/android
Expand All @@ -42,7 +56,7 @@ jobs:
id: commit
uses: pr-mpt/actions-commit-hash@v1

- name: 'Upload .apk Artifact (for Release)'
- name: 'Upload .apk Release Artifact (for Release)'
uses: actions/upload-artifact@v3
if: inputs.semver != '' # If this workflow is called from release.yml
with:
Expand All @@ -56,6 +70,13 @@ jobs:
name: robosats-${{ steps.commit.outputs.short }}.apk
path: mobile/android/app/build/outputs/apk/release/app-release.apk

- name: 'Upload .apk Debug Artifact (for Pre-release)'
uses: actions/upload-artifact@v3
if: inputs.semver != '' # only if this workflow is not called from a push to tag (a Release)
with:
name: robosats-debug-${{ steps.commit.outputs.short }}.apk
path: mobile/android/app/build/outputs/apk/debug/app-debug.apk

- name: 'Create Pre-release'
id: create_release
if: inputs.semver == '' # only if this workflow is not called from a push to tag (a Release)
Expand All @@ -64,12 +85,12 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: android-${{ steps.commit.outputs.short }}
release_name: robosats-alpha-${{ steps.commit.outputs.short }}
release_name: robosats-android-${{ steps.commit.outputs.short }}
draft: false
prerelease: true

- name: 'Upload Pre-release APK Asset'
id: upload-release-asset
- name: 'Upload Pre-release APK Release Asset'
id: upload-release-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:
Expand All @@ -79,3 +100,15 @@ jobs:
asset_path: ./mobile/android/app/build/outputs/apk/release/app-release.apk
asset_name: robosats-${{ steps.commit.outputs.short }}.apk
asset_content_type: application/apk

- name: 'Upload Pre-release APK Debug Asset'
id: upload-debug-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/debug/app-debug.apk
asset_name: robosats-debug-${{ steps.commit.outputs.short }}.apk
asset_content_type: application/apk
2 changes: 1 addition & 1 deletion .github/workflows/client-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
with:
workflow: frontend-build.yml
workflow_conclusion: success
name: main-js
name: web-main-js
path: nodeapp/static/frontend/

- name: 'Log in to Docker Hub'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/coordinator-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
with:
workflow: frontend-build.yml
workflow_conclusion: success
name: main-js
name: web-main-js
path: frontend/static/frontend/

- name: 'Log in to Docker Hub'
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/frontend-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,13 @@ jobs:
- name: 'Archive Built Results'
uses: actions/upload-artifact@v3
with:
name: main-js
name: web-main-js
path: frontend/static/frontend/main.js
- name: 'Archive Built Results'
uses: actions/upload-artifact@v3
with:
name: mobile-main-js
path: mobile/html/Web.bundle/js/main.js

# Invoke pre-release image build if this was not a tag push
# Docker images tagged only with short commit hash
Expand Down
47 changes: 23 additions & 24 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,11 @@ jobs:
needs: frontend-build
secrets: inherit

# Disabled until first Android APK release
# android-build:
# uses: reckless-satoshi/robosats/.github/workflows/coordinator-image.yml@main
# needs: frontend-build
# with:
# semver: ${{ needs.check-versions.outputs.semver }}
android-build:
uses: reckless-satoshi/robosats/.github/workflows/coordinator-image.yml@main
needs: frontend-build
with:
semver: ${{ needs.check-versions.outputs.semver }}

release:
needs: [check-versions, coordinator-image, client-image] #, android-build]
Expand All @@ -79,21 +78,21 @@ jobs:
with:
body: ${{ steps.changelog.outputs.changelog }}

# Disabled until first Android APK release
# - name: 'Download APK Artifact'
# uses: dawidd6/action-download-artifact@v2
# with:
# workflow: android-build.yml
# workflow_conclusion: success
# name: robosats-${{ needs.check-versions.outputs.semver }}.apk
# path: .
# - name: 'Upload APK Asset'
# id: upload-release-asset
# uses: actions/upload-release-asset@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# upload_url: ${{ steps.create-release.outputs.upload_url }}
# asset_path: app-release.apk
# asset_name: robosats-${{ needs.check-versions.outputs.semver }}.apk
# asset_content_type: application/apk
# Upload APK artifact
- name: 'Download APK Artifact'
uses: dawidd6/action-download-artifact@v2
with:
workflow: android-build.yml
workflow_conclusion: success
name: robosats-${{ needs.check-versions.outputs.semver }}.apk
path: .
- name: 'Upload APK Asset'
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create-release.outputs.upload_url }}
asset_path: app-release.apk
asset_name: robosats-${{ needs.check-versions.outputs.semver }}.apk
asset_content_type: application/apk
4 changes: 2 additions & 2 deletions mobile/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Android Pre-release

To be prepared for Android releases.
Android pre-release for testing. This pre-releases has @KoalaSats #247 torified requests through webview. While the app is not fully functioional (no cookies, therefore no permanent robot and no authenticated requests are possible), it would be great to start testing Tor requests in different systems.

App should not be used as of now. It uses the clearnet unsafe tor2web bridge.
This releases has two assets. A release-like APK and a debug APK (it will show logs for errors).
7 changes: 7 additions & 0 deletions mobile/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,13 @@ android {
main { assets.srcDirs = ['src/main/assets', '../../html'] }
}

packagingOptions {
pickFirst 'lib/armeabi-v7a/libruntimeexecutor.so'
pickFirst 'lib/arm64-v8a/libruntimeexecutor.so'
pickFirst 'lib/x86_64/libruntimeexecutor.so'
pickFirst 'lib/x86/libruntimeexecutor.so'
}

defaultConfig {
applicationId "com.robosats"
minSdkVersion rootProject.ext.minSdkVersion
Expand Down
3 changes: 2 additions & 1 deletion mobile/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ buildscript {
minSdkVersion = 26
compileSdkVersion = 31
targetSdkVersion = 31
kotlin_version = "1.7.10"

if (System.properties['os.arch'] == "aarch64") {
// For M1 Users we need to use the NDK 24 which added support for aarch64
Expand All @@ -22,7 +23,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.0"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.10"
classpath("com.android.tools.build:gradle:7.1.1")
classpath("com.facebook.react:react-native-gradle-plugin")
classpath("de.undercouch:gradle-download-task:5.0.1")
Expand Down

0 comments on commit ab4d83b

Please sign in to comment.