Skip to content

Commit cb1e882

Browse files
committed
modify workflow to accept 2 digits
1 parent aa88381 commit cb1e882

4 files changed

Lines changed: 23 additions & 18 deletions

File tree

.github/scripts/bump-ota-version-constants.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44
# With a semver second argument (OTA hotfix release workflow): sets OTA_VERSION to v<semver>
55
# exactly as provided (e.g. 7.73.01 -> v7.73.01, 7.73.21 -> v7.73.21). No normalization is applied.
6-
# Two-digit patch AB means OTA hotfix: base patch A, iteration B.
6+
# OTA hotfix: multi-digit patch whose last digit (patch % 10) is the OTA iteration.
77
#
88
# Without semver (local / legacy): increments in place — vX.XX.X -> v0, vN -> v(N+1), vA.B.C -> vA.B.(C+1)
99
set -euo pipefail

.github/scripts/run-update-release-changelog-mobile.sh

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,24 @@
11
#!/usr/bin/env bash
22
# Invokes MetaMask github-tools update-release-changelog.sh with OTA version handling.
33
#
4-
# OTA hotfix detection: a two-digit patch in the branch version (e.g. release/7.77.01).
5-
# auto-changelog rejects these as invalid SemVer (leading zeros are forbidden).
4+
# OTA hotfix detection: a multi-digit patch whose last digit is non-zero (e.g. release/7.77.01, release/7.77.11).
5+
# auto-changelog rejects leading-zero patches as invalid SemVer.
66
#
77
# This wrapper converts the Runway OTA version to a valid SemVer prerelease
88
# for the changelog tool:
99
# Runway 7.77.01 → SemVer 7.77.0-ota.1
1010
# Runway 7.77.21 → SemVer 7.77.2-ota.1
11+
# Runway 7.77.111 → SemVer 7.77.11-ota.1
1112
#
1213
# The SemVer prerelease format stays in CHANGELOG.md permanently. auto-changelog
1314
# validates ALL version headers on every run, so non-SemVer versions like 7.77.01
1415
# would break all future changelog generation (not just OTA runs).
1516
#
1617
# The Runway version (7.77.01) is used only in branch names, OTA_VERSION, and PR titles.
1718
#
18-
# Mapping (two-digit patch AB): X.Y.AB → X.Y.A-ota.B
19+
# Mapping: patch % 10 = OTA iteration, patch / 10 = base binary patch.
20+
# X.Y.{patch} → X.Y.{patch/10}-ota.{patch%10}
21+
# Multi-digit patches with last digit 0 (e.g. 10, 20) are binary hotfixes, not OTA.
1922
# Single-digit patches pass through unchanged.
2023
set -euo pipefail
2124

@@ -40,10 +43,10 @@ fi
4043

4144
PATCH="${RUNWAY_VERSION##*.}"
4245

43-
if [[ ${#PATCH} -eq 2 ]]; then
44-
# OTA hotfix: two-digit patch AB → X.Y.A-ota.B
45-
BASE_PATCH="${PATCH:0:1}"
46-
OTA_NUM="${PATCH:1:1}"
46+
if [[ ${#PATCH} -ge 2 && $((10#$PATCH % 10)) -ne 0 ]]; then
47+
# OTA hotfix: last digit = OTA iteration, remaining digits = base binary patch
48+
BASE_PATCH=$((10#$PATCH / 10))
49+
OTA_NUM=$((10#$PATCH % 10))
4750
SEMVER_VERSION="${RUNWAY_VERSION%.*}.${BASE_PATCH}-ota.${OTA_NUM}"
4851

4952
echo "OTA hotfix detected: Runway ${RUNWAY_VERSION} → SemVer ${SEMVER_VERSION}"

.github/workflows/auto-create-release-pr.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ name: Auto Create Release PR
33
# When Runway creates release/X.Y.Z, this workflow calls create-release-pr.yml.
44
# Semver convention for mobile hotfixes:
55
# - X.Y.0 — regular release (no OTA_VERSION bump)
6-
# - X.Y.Z with a single-digit patch (e.g. 7.71.1, 7.71.2) — regular hotfix (no OTA_VERSION bump)
7-
# - X.Y.AB with a two-digit patch (e.g. 7.73.01, 7.73.21) — OTA hotfix; OTA_VERSION is v7.73.01.
8-
# Two-digit patch AB → base patch A, OTA iteration B.
6+
# - X.Y.Z with a single-digit patch (e.g. 7.71.1, 7.71.2) — binary hotfix (no OTA_VERSION bump)
7+
# - X.Y.Z where Z is multi-digit and Z % 10 == 0 (e.g. 7.73.10, 7.73.20) — binary hotfix (no OTA_VERSION bump)
8+
# - X.Y.Z where Z is multi-digit and Z % 10 != 0 (e.g. 7.73.01, 7.73.21, 7.73.111) — OTA hotfix;
9+
# OTA_VERSION is vX.Y.Z. Last digit = OTA iteration, remaining digits = base binary patch.
910
# CHANGELOG.md uses the SemVer prerelease format (e.g. 7.73.0-ota.1) permanently
1011
# because auto-changelog validates all version headers as strict SemVer.
1112

.github/workflows/create-release-pr.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,13 @@ jobs:
4646
fi
4747
4848
patch="${SEMVER##*.}"
49-
# OTA hotfix: patch has exactly two digits (e.g. 01, 21, 22).
50-
# Two-digit patch AB → base patch A, OTA iteration B.
51-
# Single-digit patches are regular hotfixes; single-digit 0 is a regular release.
52-
if [[ ${#patch} -eq 2 ]]; then
49+
# OTA hotfix: multi-digit patch whose last digit is non-zero.
50+
# patch % 10 != 0 → OTA hotfix (last digit = OTA iteration, remaining digits = base binary patch).
51+
# patch % 10 == 0 → binary hotfix (e.g. 10, 20) or regular release (0).
52+
# Single-digit patches (1-9) are always binary hotfixes; 0 is a regular release.
53+
if [[ ${#patch} -ge 2 && $((10#$patch % 10)) -ne 0 ]]; then
5354
echo "is_ota=true" >> "$GITHUB_OUTPUT"
54-
echo "OTA hotfix (two-digit patch: ${patch}): branch release/${SEMVER}; OTA_VERSION v${SEMVER}."
55+
echo "OTA hotfix (patch: ${patch}, last digit: $((10#$patch % 10))): branch release/${SEMVER}; OTA_VERSION v${SEMVER}."
5556
else
5657
echo "is_ota=false" >> "$GITHUB_OUTPUT"
5758
echo "Not OTA hotfix (patch segment: ${patch})."
@@ -165,7 +166,7 @@ jobs:
165166
git push origin "$BRANCH"
166167
fi
167168
168-
# Changelog: run-update-release-changelog-mobile.sh converts OTA two-digit patches to valid SemVer prereleases. The SemVer format stays in CHANGELOG.md permanently.
169+
# Changelog: run-update-release-changelog-mobile.sh converts OTA patches to valid SemVer prereleases. The SemVer format stays in CHANGELOG.md permanently.
169170
- name: Checkout github-tools (release changelog)
170171
if: needs.resolve-bases.outputs.is_ota == 'true' && steps.ota_release_pr.outputs.exists != 'true'
171172
uses: actions/checkout@v4
@@ -210,7 +211,7 @@ jobs:
210211
set -euo pipefail
211212
BRANCH="release/${SEMVER}"
212213
PATCH="${SEMVER##*.}"
213-
SEMVER_CL="${SEMVER%.*}.${PATCH:0:1}-ota.${PATCH:1:1}"
214+
SEMVER_CL="${SEMVER%.*}.$((10#$PATCH / 10))-ota.$((10#$PATCH % 10))"
214215
BODY="OTA hotfix: branch \`${BRANCH}\`."
215216
BODY="${BODY}"$'\n\n'"- Native semver and build version are **not** bumped."
216217
BODY="${BODY}"$'\n'"- \`OTA_VERSION\` in \`app/constants/ota.ts\` is \`v${SEMVER}\`."

0 commit comments

Comments
 (0)