[android] Auto-release from version
All checks were successful
Android Release / build-android-release (push) Successful in 5m59s
All checks were successful
Android Release / build-android-release (push) Successful in 5m59s
This commit is contained in:
@@ -52,12 +52,63 @@ jobs:
|
||||
working-directory: android
|
||||
run: ./gradlew assembleRelease
|
||||
|
||||
- name: Upload release artifacts
|
||||
uses: actions/upload-artifact@v3
|
||||
- name: Prepare release assets
|
||||
env:
|
||||
RELEASE_TAG: ${{ github.ref_name }}
|
||||
run: |
|
||||
set -eu
|
||||
|
||||
version="${RELEASE_TAG#release/android/}"
|
||||
if [ -z "$version" ] || [ "$version" = "$RELEASE_TAG" ]; then
|
||||
echo "Expected tag in the form release/android/{version}, got: $RELEASE_TAG" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
assets_dir="${{ gitea.workspace }}/release-assets/android"
|
||||
rm -rf "$assets_dir"
|
||||
mkdir -p "$assets_dir"
|
||||
|
||||
found_apk=0
|
||||
for apk in android/app/build/outputs/apk/release/*.apk; do
|
||||
if [ ! -e "$apk" ]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
found_apk=1
|
||||
base="$(basename "$apk")"
|
||||
|
||||
case "$base" in
|
||||
app-*-release*.apk)
|
||||
arch="${base#app-}"
|
||||
arch="${arch%%-release*}"
|
||||
;;
|
||||
app-release*.apk)
|
||||
arch="universal"
|
||||
;;
|
||||
*)
|
||||
echo "Unexpected APK filename: $base" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
cp "$apk" "$assets_dir/kordophone-${arch}-${version}.apk"
|
||||
done
|
||||
|
||||
if [ "$found_apk" -ne 1 ]; then
|
||||
echo "No release APKs were produced." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
{
|
||||
printf 'RELEASE_VERSION=%s\n' "$version"
|
||||
printf 'RELEASE_ASSETS_DIR=%s\n' "$assets_dir"
|
||||
} >> "$GITHUB_ENV"
|
||||
|
||||
- name: Create Gitea release
|
||||
uses: https://gitea.com/actions/gitea-release-action@v1
|
||||
with:
|
||||
name: kordophone-android-release
|
||||
path: |
|
||||
android/app/build/outputs/apk/release/*.apk
|
||||
android/app/build/outputs/apk/release/output-metadata.json
|
||||
if-no-files-found: error
|
||||
retention-days: 90
|
||||
name: Kordophone Android ${{ env.RELEASE_VERSION }}
|
||||
tag_name: ${{ github.ref_name }}
|
||||
target_commitish: ${{ github.sha }}
|
||||
files: |
|
||||
${{ env.RELEASE_ASSETS_DIR }}/*.apk
|
||||
|
||||
Reference in New Issue
Block a user