Skip to content

Commit

Permalink
Upload android debug apk on Release (#74)
Browse files Browse the repository at this point in the history
* Use working-dir instead of cd in android build job

* Add apk release upload

* Upload Android README.md with info about the release apk

* Rename apk upload asset to OpenBot-[tag-version].apk

* Use concat of secrets.GITHUB_TOKEN and secrets.GH_TOKEN in release Action
  • Loading branch information
francisduvivier authored Oct 2, 2020
1 parent c1496c3 commit b899405
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 12 deletions.
17 changes: 7 additions & 10 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ jobs:
build:
name: Gradle Checks
runs-on: ubuntu-latest

defaults:
run:
working-directory: android
steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
Expand All @@ -33,19 +35,14 @@ jobs:
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle
- name: Style
run: |
cd android
./gradlew checkStyle
run: ./gradlew checkStyle
- name: Lint
run: |
cd android
./gradlew lint
run: ./gradlew lint
- name: Build
run: |
cd android
./gradlew build
run: ./gradlew build
- name: Upload
uses: actions/upload-artifact@v2
with:
name: app-debug.apk
path: android/app/build/outputs/apk/debug/app-debug.apk

42 changes: 42 additions & 0 deletions .github/workflows/releases.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
on:
release:
types:
- published # We are using published instead of created because otherwise, it would never trigger if it was first created as a draft and then published.

name: Upload Android Apk to Release

jobs:
upload-apk-to-release:
name: Add Android Debug Apk to Release Assets
runs-on: ubuntu-latest
defaults:
run:
working-directory: android
steps:
- uses: actions/checkout@v2
- name: Print Release Url
run: echo "${{ github.event.release.html_url }}"
- name: Cache Gradle packages
uses: actions/cache@v2
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle
- name: Assemble Debug Apk
id: assemble_debug_apk
run: |
./gradlew assembleDebug
echo "::set-output name=debug_apk_path::$(pwd)/app/build/outputs/apk/debug/app-debug.apk"
- name: Specify Release Asset Name using tag [${{github.event.release.tag_name}}]
id: make_asset_name
run: echo "::set-output name=asset_name::OpenBot-$(echo ${{github.event.release.tag_name}}| sed 's/[^-a-zA-Z0-9.]/_/g'| sed 's/^v//').apk"
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ${{ steps.assemble_debug_apk.outputs.debug_apk_path }}
asset_name: ${{steps.make_asset_name.outputs.asset_name}}
asset_content_type: application/vnd.android.package-archive
4 changes: 2 additions & 2 deletions android/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ Our application is derived from the [TensorFlow Lite Object Detection Android De

### Prerequisites

- Setup [Android Studio](https://developer.android.com/studio/index.html)
- [Android Studio 3.2 or later](https://developer.android.com/studio/index.html) for building and installing the apk, or otherwise download the apk from the assets of the [latest release](https://github.com/intel-isl/OpenBot/releases/latest).
- Android device and Android development environment with minimum API 21
- Android Studio 3.2 or later

### Building

- In case you are using the apk from the assets of the [latest release](https://github.com/intel-isl/OpenBot/releases/latest), you can skip the below steps and instead just [install](https://www.lifewire.com/install-apk-on-android-4177185) it on your phone directly. Note that that apk is signed with a debug key.
- Open Android Studio and select *Open an existing Android Studio project*.
- Select the OpenBot/android directory and click OK.
- Confirm Gradle Sync if neccessary.
Expand Down

0 comments on commit b899405

Please sign in to comment.