Skip to content

Commit dbd05d1

Browse files
fix(release): require committed versionName for tag builds (#155)
- Verify committed versionName matches the release tag instead of rewriting mobile/build.gradle during CI (keeps tagged source, GitHub releases, and F-Droid builds on the same version) - Update README with pre-tag versionName update step - Update mobile/build.gradle versionName comment to reflect new workflow Closes #24.
1 parent ef703ce commit dbd05d1

3 files changed

Lines changed: 20 additions & 9 deletions

File tree

.github/workflows/build.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -219,13 +219,20 @@ jobs:
219219
run: |
220220
test -e mobile/src/main/jniLibs/x86_64/libaw_server.so
221221
222-
- name: Set versionName
222+
- name: Verify versionName matches tag
223223
if: startsWith(github.ref, 'refs/tags/v') # only on runs triggered from tag
224224
run: |
225-
# Sets versionName, tail used to skip "v" at start of tag name
226-
SHORT_VERSION=$(echo "${{ github.ref_name }}" | tail -c +2 -)
227-
sed -i "s/versionName \".*\"/versionName \"$SHORT_VERSION\"/g" \
228-
mobile/build.gradle
225+
SHORT_VERSION="${GITHUB_REF_NAME#v}"
226+
COMMITTED_VERSION=$(sed -n -E "s/^[[:space:]]*versionName[[:space:]]+['\"]([^'\"]+)['\"].*/\\1/p" mobile/build.gradle)
227+
if [ -z "$COMMITTED_VERSION" ]; then
228+
echo "Failed to parse versionName from mobile/build.gradle."
229+
exit 1
230+
fi
231+
if [ "$COMMITTED_VERSION" != "$SHORT_VERSION" ]; then
232+
echo "mobile/build.gradle versionName must match the release tag."
233+
echo "tag=$SHORT_VERSION committed=$COMMITTED_VERSION"
234+
exit 1
235+
fi
229236
230237
- name: Set versionCode
231238
run: |

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,12 @@ Once both aw-server-rust and aw-webui is built, you can build the Android app as
5757

5858
### Making a release
5959

60-
To make a release, make a signed tag and push it to GitHub:
60+
Before tagging, update `mobile/build.gradle` so `versionName` matches the
61+
release you are about to cut. The release workflow verifies the committed
62+
`versionName` instead of patching it after checkout, which keeps tagged source,
63+
GitHub release builds, and F-Droid builds on the same version.
64+
65+
Then make a signed tag and push it to GitHub:
6166

6267
```sh
6368
git tag -s v0.1.0

mobile/build.gradle

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@ android {
1010
minSdkVersion 24
1111
targetSdkVersion 34
1212

13-
// Set in CI on tagged commit
14-
// FIXME: should be set before tagging, so that F-droid picks it up correctly
15-
// https://gitlab.com/fdroid/fdroiddata/-/merge_requests/11786?commit_id=d2cedcbe3d26db59378d582a8cf952af16b6407f#note_1966750559
13+
// Keep versionName committed in source so tagged builds and F-Droid agree.
14+
// Tag workflows verify it matches refs/tags/v* instead of rewriting the checkout.
1615
versionName "0.12.1"
1716

1817
// Set in CI by `bundle exec fastlane update_version`

0 commit comments

Comments
 (0)