Skip to content

feat: Enhance APK output naming and enable ABI splits for optimized b… #5

feat: Enhance APK output naming and enable ABI splits for optimized b…

feat: Enhance APK output naming and enable ABI splits for optimized b… #5

Workflow file for this run

name: Release
on:
push:
branches:
- 'v[0-9]+*'
- 'release/**'
workflow_dispatch:
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false
permissions:
contents: write
jobs:
build-and-release:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Decode Keystore
run: |
echo "${{ secrets.KEYSTORE_BASE64 }}" | base64 -d > dailylife-release.jks
- name: Calculate Release Version
id: version
run: |
BRANCH_NAME="${{ github.ref_name }}"
BASE_VERSION=$(echo "$BRANCH_NAME" | grep -oE '(?:^|/)[v]?([0-9]+\.[0-9]+(\.[0-9]+)?)' | grep -oE '[0-9]+\.[0-9]+(\.[0-9]+)?' | head -n 1)
if [ -z "$BASE_VERSION" ]; then BASE_VERSION="1.0.0"; fi
IFS='.' read -r major minor patch <<< "$BASE_VERSION"
minor=${minor:-0}
patch=${patch:-0}
BASE_PREFIX="v${major}.${minor}"
latest_tag=$(git tag -l "${BASE_PREFIX}.*" | sort -V | tail -n 1)
if [ -n "$latest_tag" ]; then
latest_patch=${latest_tag##*.}
new_patch=$((latest_patch + 1))
NEW_TAG="${BASE_PREFIX}.${new_patch}"
NEW_APK_VERSION="${major}.${minor}.${new_patch}"
else
NEW_TAG="${BASE_PREFIX}.${patch}"
NEW_APK_VERSION="${major}.${minor}.${patch}"
fi
echo "Next tag computing to: $NEW_TAG"
echo "Next APK version: $NEW_APK_VERSION"
echo "tag=$NEW_TAG" >> $GITHUB_OUTPUT
echo "apk_version=$NEW_APK_VERSION" >> $GITHUB_OUTPUT
- name: Grant Execute Permission for Gradlew
run: chmod +x ./gradlew
- name: Build Android App (Release)
env:
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
run: ./gradlew assembleRelease -PversionName="${{ steps.version.outputs.apk_version }}" -PversionCode="${{ github.run_number }}"
- name: Rename APK Outputs
run: |
VERSION="${{ steps.version.outputs.apk_version }}"
shopt -s nullglob
apks=(app/build/outputs/apk/release/*.apk)
if [ ${#apks[@]} -eq 0 ]; then
echo "ERROR: No APK files found"
exit 1
fi
for apk in "${apks[@]}"; do
filename=$(basename "$apk")
stripped="${filename#app-}"
arch="${stripped%%-*}"
new_filename="dailylife-v${VERSION}-${arch}.apk"
mv "$apk" "$new_filename"
done
- name: Publish to GitHub Releases
uses: softprops/action-gh-release@v3
with:
tag_name: "${{ steps.version.outputs.tag }}"
name: "Release ${{ steps.version.outputs.tag }}"
files: dailylife-*.apk
generate_release_notes: true
make_latest: true