Skip to content

Commit 6276c19

Browse files
committed
keep binary hotfix in 1 digit for patch digit
1 parent 73d1b3b commit 6276c19

4 files changed

Lines changed: 54 additions & 36 deletions

File tree

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
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-
# OTA hotfix: multi-digit patch whose last digit (patch % 10) is the OTA iteration.
6+
# Runway uses 2-digit patches: last digit (patch % 10) is the OTA iteration;
7+
# remaining digits (patch / 10) are the base binary patch.
78
#
89
# Without semver (local / legacy): increments in place — vX.XX.X -> v0, vN -> v(N+1), vA.B.C -> vA.B.(C+1)
910
set -euo pipefail

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

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +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 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.
4+
# Runway always creates 2-digit patches. This wrapper handles two cases:
65
#
7-
# This wrapper converts the Runway OTA version to a valid SemVer prerelease
8-
# for the changelog tool:
9-
# Runway 7.77.01 → SemVer 7.77.0-ota.1
10-
# Runway 7.77.21 → SemVer 7.77.2-ota.1
11-
# Runway 7.77.111 → SemVer 7.77.11-ota.1
6+
# 1) OTA hotfix: multi-digit patch whose last digit is non-zero (e.g. 01, 21, 111).
7+
# auto-changelog rejects these as invalid SemVer (leading zeros forbidden).
8+
# Converts to a valid SemVer prerelease for the changelog tool:
9+
# Runway 7.77.01 → SemVer 7.77.0-ota.1
10+
# Runway 7.77.21 → SemVer 7.77.2-ota.1
11+
# Runway 7.77.111 → SemVer 7.77.11-ota.1
12+
# Mapping: patch % 10 = OTA iteration, patch / 10 = base binary patch.
13+
#
14+
# 2) Binary hotfix / regular release: multi-digit patch ending in 0 (e.g. 00, 10, 20).
15+
# Normalized by dividing by 10: 00→0, 10→1, 20→2.
1216
#
1317
# The SemVer prerelease format stays in CHANGELOG.md permanently. auto-changelog
1418
# validates ALL version headers on every run, so non-SemVer versions like 7.77.01
1519
# would break all future changelog generation (not just OTA runs).
1620
#
1721
# The Runway version (7.77.01) is used only in branch names, OTA_VERSION, and PR titles.
18-
#
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.
2222
# Single-digit patches pass through unchanged.
2323
set -euo pipefail
2424

@@ -75,8 +75,12 @@ if [[ ${#PATCH} -ge 2 && $((10#$PATCH % 10)) -ne 0 ]]; then
7575
fi
7676
else
7777
# Regular release or binary hotfix.
78-
# Normalize leading zeros in patch for strict SemVer (e.g. 00 → 0).
79-
NORMALIZED_PATCH=$((10#$PATCH))
78+
# Runway 2-digit patches: normalize by dividing by 10 (e.g. 00→0, 10→1, 20→2).
79+
if [[ ${#PATCH} -ge 2 ]]; then
80+
NORMALIZED_PATCH=$(( 10#$PATCH / 10 ))
81+
else
82+
NORMALIZED_PATCH=$((10#$PATCH))
83+
fi
8084
if [[ "$PATCH" != "$NORMALIZED_PATCH" ]]; then
8185
NORMALIZED_VERSION="${RUNWAY_VERSION%.*}.${NORMALIZED_PATCH}"
8286
echo "Normalizing patch for strict SemVer: Runway ${RUNWAY_VERSION}${NORMALIZED_VERSION}"

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
name: Auto Create Release PR
22

33
# When Runway creates release/X.Y.Z, this workflow calls create-release-pr.yml.
4-
# Semver convention for mobile hotfixes:
5-
# - X.Y.0 or X.Y.00 — regular release (no OTA_VERSION bump; 00 is normalized to 0 for strict SemVer)
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.
4+
#
5+
# Runway always creates 2-digit patches. Convention:
6+
# - X.Y.00 — regular release; store version normalized to X.Y.0.
7+
# - X.Y.Z0 (last digit 0, e.g. 10, 20) — binary hotfix; store version X.Y.(Z0/10) e.g. 7.79.10 → 7.79.1.
8+
# - X.Y.ZN (last digit non-zero, e.g. 01, 21, 111) — OTA hotfix; OTA_VERSION is vX.Y.ZN.
9+
# Last digit = OTA iteration, remaining digits = base binary patch.
1010
# CHANGELOG.md uses the SemVer prerelease format (e.g. 7.73.0-ota.1) permanently
1111
# because auto-changelog validates all version headers as strict SemVer.
1212

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

Lines changed: 29 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -48,28 +48,40 @@ jobs:
4848
fi
4949
5050
patch="${SEMVER##*.}"
51-
normalized_patch=$((10#$patch))
52-
normalized_semver="${SEMVER%.*}.${normalized_patch}"
5351
is_ota=false
5452
55-
# OTA hotfix: multi-digit patch whose last digit is non-zero.
56-
# patch % 10 != 0 → OTA hotfix (last digit = OTA iteration, remaining digits = base binary patch).
57-
# patch % 10 == 0 → binary hotfix (e.g. 10, 20) or regular release (0, 00).
58-
# Single-digit patches (1-9) are always binary hotfixes; 0 is a regular release.
59-
if [[ ${#patch} -ge 2 && $((10#$patch % 10)) -ne 0 ]]; then
60-
is_ota=true
61-
echo "is_ota=true" >> "$GITHUB_OUTPUT"
62-
echo "OTA hotfix (patch: ${patch}, last digit: $((10#$patch % 10))): branch release/${SEMVER}; OTA_VERSION v${SEMVER}."
53+
# Runway always creates 2-digit patches. Convention:
54+
# patch % 10 != 0 → OTA hotfix (last digit = OTA iteration, remaining = base binary patch).
55+
# patch % 10 == 0 → binary hotfix or regular release; normalized by dividing by 10.
56+
# Single-digit patches (1-9) are binary hotfixes; 0 is a regular release.
57+
#
58+
# Normalization (non-OTA, multi-digit): patch / 10 → store version.
59+
# 00 → 0 (regular release), 10 → 1, 20 → 2, etc.
60+
if [[ ${#patch} -ge 2 ]]; then
61+
numeric_patch=$((10#$patch))
62+
if [[ $((numeric_patch % 10)) -ne 0 ]]; then
63+
is_ota=true
64+
normalized_patch=$numeric_patch
65+
echo "is_ota=true" >> "$GITHUB_OUTPUT"
66+
echo "OTA hotfix (patch: ${patch}, last digit: $((numeric_patch % 10))): branch release/${SEMVER}; OTA_VERSION v${SEMVER}."
67+
else
68+
normalized_patch=$((numeric_patch / 10))
69+
echo "is_ota=false" >> "$GITHUB_OUTPUT"
70+
echo "Binary hotfix or release (patch: ${patch} → normalized ${normalized_patch})."
71+
fi
6372
else
73+
normalized_patch=$((10#$patch))
6474
echo "is_ota=false" >> "$GITHUB_OUTPUT"
65-
echo "Not OTA hotfix (patch segment: ${patch})."
75+
echo "Single-digit patch (${patch}): binary hotfix or release."
6676
fi
6777
68-
# Detect if patch has leading zeros requiring local version bump
69-
# (e.g. 00 → normalized 0). The github-tools action rejects leading-zero patches.
78+
normalized_semver="${SEMVER%.*}.${normalized_patch}"
79+
80+
# Detect if the Runway patch differs from the normalized store version,
81+
# requiring a local version bump (github-tools rejects non-standard patches).
7082
if [[ "$patch" != "$normalized_patch" && "$is_ota" != "true" ]]; then
7183
echo "needs_local_bump=true" >> "$GITHUB_OUTPUT"
72-
echo "Patch has leading zeros (${patch} → ${normalized_patch}): will bump versions locally."
84+
echo "Runway patch ${patch} → store patch ${normalized_patch}: will bump versions locally."
7385
else
7486
echo "needs_local_bump=false" >> "$GITHUB_OUTPUT"
7587
fi
@@ -135,8 +147,9 @@ jobs:
135147
github-token: ${{ github.event_name == 'workflow_dispatch' && secrets.PR_TOKEN || secrets.github-token }}
136148
google-application-creds-base64: ${{ github.event_name == 'workflow_dispatch' && secrets.GCP_RLS_SHEET_ACCOUNT_BASE64 || secrets.google-application-creds-base64 }}
137149

138-
# --- Local version-bump path for Runway patches with leading zeros (e.g. 7.79.00) ---
139-
# The github-tools action rejects leading-zero patches as invalid strict SemVer.
150+
# --- Local version-bump path for Runway patches that differ from store version ---
151+
# Runway 2-digit patches (e.g. 7.79.00 → 0, 7.79.10 → 1) need normalization.
152+
# The github-tools action rejects these as invalid strict SemVer.
140153
# We check out the Runway branch directly and bump versions with the normalized semver.
141154
- name: Check for existing release PR (local bump)
142155
id: local_bump_pr

0 commit comments

Comments
 (0)