File tree Expand file tree Collapse file tree
src/com/bpmct/trmnl_nook_simple_touch Expand file tree Collapse file tree Original file line number Diff line number Diff line change 6969 git commit -m "Bump version to ${GITHUB_REF_NAME#v}"
7070 git push origin HEAD:main
7171 fi
72+ - name : Move tag to version-bumped commit
73+ if : startsWith(github.ref, 'refs/tags/')
74+ shell : bash
75+ run : |
76+ set -euo pipefail
77+ # After committing the version bump to main, the tag still points
78+ # to the pre-bump commit. Move it so raw.githubusercontent.com
79+ # serves the correct AndroidManifest.xml for this tag.
80+ BUMP_SHA="$(git rev-parse HEAD)"
81+ git tag -f "${GITHUB_REF_NAME}" "${BUMP_SHA}"
82+ git push origin "${GITHUB_REF_NAME}" --force
83+
7284
7385 - name : Configure release signing
7486 if : startsWith(github.ref, 'refs/tags/')
Original file line number Diff line number Diff line change @@ -6,10 +6,23 @@ unless the user explicitly requests it.
66
77## Release flow (tags + GitHub Actions)
88
9- Releases are driven by annotated tags like ` v0.1.0 ` . The CI workflow
9+ Releases are driven by tags like ` v0.1.0 ` . The CI workflow
1010` build-apk.yml ` stamps the manifest version, builds a signed release APK,
1111and publishes a GitHub Release with the APK attached.
1212
13+ ### Safety guards (automated)
14+
15+ - ** versionCode regression check** — ` set-version.sh ` compares the computed
16+ versionCode against the previous tag's manifest and ** fails the build** if
17+ it hasn't increased. This prevents releasing a tag with a stale or duplicate
18+ versionCode.
19+ - ** Tag moves to version-bumped commit** — After CI commits the version bump
20+ to ` main ` , it force-pushes the tag to that commit. This ensures
21+ ` raw.githubusercontent.com/.../v0.9.4/AndroidManifest.xml ` serves the
22+ correct version (not the pre-bump snapshot). Without this, downstream
23+ consumers (e.g. ` bpmct/nooks ` ) that read the manifest from the tag ref
24+ would see stale version info.
25+
1326### Versioning nuance (when to bump major/minor/patch)
1427
1528This project follows semantic-versioning * in spirit* :
Original file line number Diff line number Diff line change 11<?xml version =" 1.0" encoding =" utf-8" ?>
22<manifest xmlns : android =" http://schemas.android.com/apk/res/android"
33 package =" com.bpmct.trmnl_nook_simple_touch"
4- android : versionCode =" 90399 "
5- android : versionName =" 0.9.3 " >
4+ android : versionCode =" 90599 "
5+ android : versionName =" 0.9.5 " >
66
77 <uses-permission android : name =" android.permission.INTERNET" />
88 <uses-permission android : name =" android.permission.ACCESS_WIFI_STATE" />
Original file line number Diff line number Diff line change @@ -1010,6 +1010,16 @@ private void showGiftModeScreen() {
10101010
10111011 // Write gift mode screen to screensaver so NOOK shows it when asleep
10121012 writeGiftModeScreensaver (code , fromName , toName );
1013+
1014+ // Allow device to sleep; user tap wakes it
1015+ if (ApiPrefs .isAllowSleep (this )) {
1016+ setKeepScreenAwake (false );
1017+ if (ApiPrefs .isAutoDisableWifi (this )) {
1018+ WifiManager wifi = (WifiManager ) getSystemService (Context .WIFI_SERVICE );
1019+ if (wifi != null ) wifi .setWifiEnabled (false );
1020+ }
1021+ logD ("gift mode: sleep-ready (tap to wake)" );
1022+ }
10131023 }
10141024
10151025 private LinearLayout createStepRow (String number , String text ) {
Original file line number Diff line number Diff line change @@ -35,6 +35,21 @@ if [[ ! -f "${MANIFEST}" ]]; then
3535 exit 1
3636fi
3737
38+ # Guard: ensure new versionCode is strictly higher than the previous release tag
39+ PREV_TAG=" $( git describe --tags --abbrev=0 HEAD^ 2> /dev/null || true) "
40+ if [[ -n " ${PREV_TAG} " ]]; then
41+ PREV_CODE=" $( git show " ${PREV_TAG} :${MANIFEST} " 2> /dev/null \
42+ | sed -n ' s/.*android:versionCode="\([0-9]*\)".*/\1/p' || true) "
43+ if [[ -n " ${PREV_CODE} " && " ${VERSION_CODE} " -le " ${PREV_CODE} " ]]; then
44+ echo " error: new versionCode ${VERSION_CODE} is not higher than previous tag ${PREV_TAG} (versionCode=${PREV_CODE} )" >&2
45+ echo " hint: this usually means the tag version was not bumped correctly" >&2
46+ exit 1
47+ fi
48+ if [[ -n " ${PREV_CODE} " ]]; then
49+ echo " versionCode check passed: ${VERSION_CODE} > ${PREV_CODE} (${PREV_TAG} )"
50+ fi
51+ fi
52+
3853python3 - << PY
3954import re
4055from pathlib import Path
You can’t perform that action at this time.
0 commit comments