Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enable workflow_dispatch and attach debug APK for Android CI #339

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: Android CI

on:
workflow_dispatch:
push:
branches: [ master ]
pull_request:
Expand All @@ -25,3 +26,38 @@ jobs:
uses: gradle/actions/setup-gradle@v3
with:
arguments: build

- name: Setup environment variable
run: |
APK_VERSION="$(grep 'def baseline' build.gradle | sed -E "s/.+'(.+)'/\1/")"
APK_FULL_VERSION="$APK_VERSION($(date +%y%m%d))"
APK_BUILD_DATE="$(date +%Y-%m-%d)"
APK_DIR_PATH="./build/outputs/apk/debug"

echo "APK_VERSION=$APK_VERSION" >> $GITHUB_ENV
echo "APK_FULL_VERSION=$APK_FULL_VERSION" >> $GITHUB_ENV
echo "APK_BUILD_DATE=$APK_BUILD_DATE" >> $GITHUB_ENV
echo "APK_DIR_PATH=$APK_DIR_PATH" >> $GITHUB_ENV

- name: Generate sha256sum file
run: |
(cd "$APK_DIR_PATH"; sha256sum "osu!droid-$APK_FULL_VERSION-debug-$APK_BUILD_DATE.apk" > "osu!droid-$APK_FULL_VERSION-$APK_BUILD_DATE.sha256sum") || {
echo "Failed to generate sha256sum for 'osu!droid-$APK_FULL_VERSION-$APK_BUILD_DATE' APK."
exit 1
}

- name: Attach APK file
uses: actions/upload-artifact@v4
with:
name: osu!droid-${{ env.APK_FULL_VERSION }}-${{ env.APK_BUILD_DATE }}_apk
path: |
${{ env.APK_DIR_PATH }}/osu!droid-${{ env.APK_FULL_VERSION }}-debug-${{ env.APK_BUILD_DATE }}.apk
${{ env.APK_DIR_PATH }}/output-metadata.json

- name: Attach sha256sum file
uses: actions/upload-artifact@v4
with:
name: osu!droid-${{ env.APK_FULL_VERSION }}-${{ env.APK_BUILD_DATE }}_sha256sum
path: |
${{ env.APK_DIR_PATH }}/osu!droid-${{ env.APK_FULL_VERSION }}-${{ env.APK_BUILD_DATE }}.sha256sum
${{ env.APK_DIR_PATH }}/output-metadata.json