-
The project should be built with
Gradle
. -
Create
.github/workflows/apk.yml
# https://gist.github.com/dpcpnry/2dfc638cbe81b6b4763b592557acb522
name: Build Downloadable APK
on:
push:
branches: [master]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: setup JAVA 11
uses: actions/setup-java@v2
with:
java-version: 11
distribution: 'adopt'
cache: gradle
- name: build APK debug with gradlew
run: |
chmod +x gradlew
bash ./gradlew clean assembleDebug --stacktrace
# bash ./gradlew clean assembleDebug --stacktrace
- name: Find APK path
run: find . -name "*-debug.apk"
# use the result of the above find command for release path below
# It may look like: ./PROJECT/build/outputs/apk/debug/PROJECT-debug.apk
# PROJECT is normally your PROJECT name (often under it has: src/main/java)
# Or simply upload to somewhere else after knowing the apk path
# zip then curl upload it to https://transfer.sh
- name: Prepare TAGVERUTC
# https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#environment-files
run: echo "TAGVERUTC=$(echo $(date -u +%Y%m%d.%H%M%S))" >> $GITHUB_ENV
- name: Prepare DEBUG_APK_PATH
run: echo "DEBUG_APK_PATH=$(echo $(find . -name ""*-debug.apk""))" >> $GITHUB_ENV
# also works run: echo "DEBUG_APK_PATH=$(echo $(find . -name *-debug.apk))" >> $GITHUB_ENV
- name: Prepare APKNAME
run: echo "APKNAME=$(echo $(basename $ ))" >> $GITHUB_ENV
- name: Test echo DEBUG_APK_PATH
run: echo $
# - name: Upload APK to transfer.sh
# run: |
# cp $ ./$
# curl --upload-file ./$ https://transfer.sh/$
- name: Upload AK
uses: actions/upload-artifact@v2
with:
name: app
path: $
- name: Create release and upload apk
uses: underwindfall/[email protected]
env:
GITHUB_TOKEN: $
with:
# repeated release tag_name will cause error, remember to change the path accordingly
# tag_name: v2.2.2
# asset_path: ./PROJECT/build/outputs/apk/debug/PROJECT-debug.apk
# asset_name: PROJECT-debug.apk
tag_name: $
asset_path: $
asset_name: $
asset_content_type: application/zip
Read https://gist.github.com/dpcpnry/2dfc638cbe81b6b4763b592557acb522
-
It will make a new release attached with APK
-
Alternatively, can simply upload to somewhere else after knowing the apk path:
7z
with password and upload from CLI
to https://transfer.sh