66 - ' *.*.*'
77 - ' !*-*'
88 workflow_dispatch :
9+ inputs :
10+ version :
11+ description : " Version number (e.g. 1.0.0). Leave empty for auto-increment."
12+ required : false
13+ default : " "
14+ type : string
15+ create_release :
16+ description : " Create a GitHub Release with the APK?"
17+ required : false
18+ default : true
19+ type : boolean
920
1021jobs :
1122 build-android :
@@ -131,16 +142,28 @@ jobs:
131142 KEY_PASS_SECRET : ${{ secrets.ANDROID_SIGNING_KEY_PASSWORD }}
132143 STORE_PASS_SECRET : ${{ secrets.ANDROID_SIGNING_STORE_PASSWORD }}
133144
134- - name : Set version
145+ - name : Determine version
135146 id : version
136147 run : |
148+ # Priority: manual input > tag name > auto-increment from run number
149+ INPUT_VERSION="${{ inputs.version }}"
137150 REF="${{ github.ref_name }}"
138- if [[ "$REF" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
139- echo "version=$REF" >> "$GITHUB_OUTPUT"
151+
152+ if [[ -n "$INPUT_VERSION" && "$INPUT_VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
153+ VERSION="$INPUT_VERSION"
154+ echo "📦 Using manually specified version: $VERSION"
155+ elif [[ "$REF" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
156+ VERSION="$REF"
157+ echo "📦 Using version from tag: $VERSION"
140158 else
141- echo "version=0.0.0" >> "$GITHUB_OUTPUT"
159+ # Auto-generate: YYYY.MMDD.run_number
160+ VERSION="$(date -u +%Y).$(date -u +%-m%d).${{ github.run_number }}"
161+ echo "📦 Auto-generated version: $VERSION"
142162 fi
143163
164+ echo "version=$VERSION" >> "$GITHUB_OUTPUT"
165+ echo "tag=v$VERSION" >> "$GITHUB_OUTPUT"
166+
144167 - name : Build Android APK
145168 run : >
146169 dotnet publish -c Release
@@ -156,7 +179,7 @@ jobs:
156179 -p:AndroidSigningStorePass="${{ steps.keystore.outputs.store_pass }}"
157180 -p:CustomBeforeMicrosoftCommonTargets="${{ github.workspace }}/build/SuppressSubmoduleWarnings.targets"
158181
159- - name : Find APK
182+ - name : Find and rename APK
160183 id : find_apk
161184 run : |
162185 APK=$(find "osu.Android/bin/Release/net10.0-android/publish" -maxdepth 1 -name "*-Signed.apk" 2>/dev/null | head -1)
@@ -170,10 +193,15 @@ jobs:
170193 exit 1
171194 fi
172195
173- APK_SIZE=$(stat -c %s "$APK" 2>/dev/null || stat -f %z "$APK" 2>/dev/null || wc -c < "$APK")
196+ # Rename to a clean versioned filename for the release
197+ VERSION="${{ steps.version.outputs.version }}"
198+ FINAL_APK="$(dirname "$APK")/osu-lazer-$VERSION.apk"
199+ cp "$APK" "$FINAL_APK"
200+
201+ APK_SIZE=$(stat -c %s "$FINAL_APK" 2>/dev/null || stat -f %z "$FINAL_APK" 2>/dev/null || wc -c < "$FINAL_APK")
174202 APK_SIZE_MB=$((APK_SIZE / 1048576))
175- echo "Found APK: $APK ($APK_SIZE_MB MB)"
176- echo "apk_path=$APK " >> "$GITHUB_OUTPUT"
203+ echo "Found APK: $FINAL_APK ($APK_SIZE_MB MB)"
204+ echo "apk_path=$FINAL_APK " >> "$GITHUB_OUTPUT"
177205
178206 - name : Verify APK signature
179207 run : |
@@ -190,7 +218,7 @@ jobs:
190218 - name : Upload APK artifact
191219 uses : actions/upload-artifact@v7
192220 with :
193- name : osu-android-${{ github.ref_name }}
221+ name : osu-android-${{ steps.version.outputs.version }}
194222 path : ${{ steps.find_apk.outputs.apk_path }}
195223 if-no-files-found : error
196224
@@ -235,11 +263,25 @@ jobs:
235263 echo " same keystore automatically — no more setup needed."
236264 echo "=================================================================="
237265
266+ # Create a GitHub Release with the APK attached.
267+ # Works for both tag pushes and manual workflow_dispatch runs.
268+ # For manual runs: creates a tag automatically.
238269 - name : Create GitHub Release
239- if : startsWith(github.ref, 'refs/tags/')
270+ if : inputs.create_release != false
240271 uses : softprops/action-gh-release@v2
241272 with :
273+ tag_name : ${{ steps.version.outputs.tag }}
274+ name : " osu! Android ${{ steps.version.outputs.version }}"
242275 files : ${{ steps.find_apk.outputs.apk_path }}
243276 generate_release_notes : true
277+ body : |
278+ ## osu! Android v${{ steps.version.outputs.version }}
279+
280+ ### Download
281+ Grab the APK below and install it on your Android device.
282+
283+ > **Minimum Android version:** 13 (API 33)
284+ > **Architecture:** arm64-v8a
285+ make_latest : true
244286 env :
245287 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments