Dough Git

commit

Release via manual workflow with version input

commit
6c59e0309845e944784942b47c2bc81b188debae
author
Clove Twilight <[email protected]>
date
2026-08-01 11:17

diff --git a/api-helper/.github/workflows/build.yml b/api-helper/.github/workflows/build.yml
index 3375619..5ae8f50 100644
--- a/api-helper/.github/workflows/build.yml
+++ b/api-helper/.github/workflows/build.yml
@@ -6,9 +6,14 @@ on:
     tags: [ "v*" ]
   pull_request:
   workflow_dispatch:
+    inputs:
+      version:
+        description: "Release version, e.g. v1.0.0. Leave blank to just build a debug APK."
+        required: false
+        type: string
 
 jobs:
-  # Every push/PR: build an unsigned debug APK you can grab from the run's artifacts.
+  # Every push/PR/manual run: build an unsigned debug APK, downloadable from the run's artifacts.
   debug:
     runs-on: ubuntu-latest
     steps:
@@ -26,12 +31,18 @@ jobs:
           path: app/build/outputs/apk/debug/app-debug.apk
           if-no-files-found: error
 
-  # Push a tag like v1.0.0: build a SIGNED release APK and publish it as the latest Release.
+  # Builds a SIGNED release and publishes it as the latest Release.
+  # Triggered by: "Run workflow" with a version filled in, OR pushing a v* tag.
   release:
-    if: startsWith(github.ref, 'refs/tags/v')
+    if: >
+      (github.event_name == 'workflow_dispatch' && inputs.version != '') ||
+      startsWith(github.ref, 'refs/tags/v')
     runs-on: ubuntu-latest
     permissions:
       contents: write
+    env:
+      # Version from the manual input, falling back to the tag name on a tag push.
+      VERSION: ${{ inputs.version || github.ref_name }}
     steps:
       - uses: actions/checkout@v4
       - uses: actions/setup-java@v4
@@ -52,16 +63,16 @@ jobs:
           SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }}
         run: ./gradlew assembleRelease --stacktrace
 
-      - name: Rename APK with version tag
+      - name: Rename APK with version
         run: |
           mkdir -p dist
-          cp app/build/outputs/apk/release/app-release.apk "dist/device-reporter-${GITHUB_REF_NAME}.apk"
+          cp app/build/outputs/apk/release/app-release.apk "dist/device-reporter-${VERSION}.apk"
 
-      - name: Publish GitHub Release (marked latest)
+      - name: Publish GitHub Release (creates the tag, marked latest)
         uses: softprops/action-gh-release@v2
         with:
-          files: dist/device-reporter-${{ github.ref_name }}.apk
-          name: Device Reporter ${{ github.ref_name }}
-          tag_name: ${{ github.ref_name }}
+          files: dist/device-reporter-${{ env.VERSION }}.apk
+          name: Device Reporter ${{ env.VERSION }}
+          tag_name: ${{ env.VERSION }}
           make_latest: true
           generate_release_notes: true
diff --git a/api-helper/README.md b/api-helper/README.md
index 4e39fef..fcd13df 100644
--- a/api-helper/README.md
+++ b/api-helper/README.md
@@ -72,13 +72,10 @@ There's no Android Studio needed — GitHub builds it for you.
 under the **Actions** tab and download the **device-reporter-debug-apk** artifact. Good for
 trying things out; signed with Android's throwaway debug key.
 
-**Proper signed release:** push a version tag and GitHub builds a signed APK and publishes it
-as the latest Release (see setup below). This is the one to actually keep on your phone.
-
-```bash
-git tag v1.0.0
-git push origin v1.0.0
-```
+**Proper signed release:** go to the **Actions** tab → **Build APK** → **Run workflow**, type
+a version like `v1.0.0` in the box, and run it. GitHub builds a signed APK, creates that tag,
+and publishes it as the latest Release. This is the one to actually keep on your phone.
+(If you'd rather, pushing a `v*` tag from your terminal does the exact same thing.)
 
 A minute later, your repo's **Releases** page has `device-reporter-v1.0.0.apk` sitting at the
 top marked "Latest". Download it straight onto the Pixel.