Просмотр исходного кода

MSIX: third version part = patch*10 + store build, so a Store resubmission of the same release gets a new version (the fourth part must stay 0)

Ka1-S 1 месяц назад
Родитель
Сommit
77313d54e7
3 измененных файлов с 21 добавлено и 6 удалено
  1. 5 0
      .github/workflows/release.yml
  2. 4 2
      docs/STORE.md
  3. 12 4
      scripts/make-msix-layout.py

+ 5 - 0
.github/workflows/release.yml

@@ -21,6 +21,10 @@ on:
   push:
     tags: ['v*']
   workflow_dispatch:
+    inputs:
+      store_build:
+        description: 'MSIX store build 0..9 (a repackaged Store resubmission of the same release; scripts/make-msix-layout.py)'
+        default: '0'
 
 permissions:
   contents: read
@@ -243,6 +247,7 @@ jobs:
           MSIX_PUBLISHER: ${{ vars.MSIX_PUBLISHER }}
           MSIX_PUBLISHER_DISPLAY: ${{ vars.MSIX_PUBLISHER_DISPLAY }}
           MSIX_DISPLAY_NAME: ${{ vars.MSIX_DISPLAY_NAME }}
+          MSIX_STORE_BUILD: ${{ inputs.store_build || '0' }}
         run: |
           $sdk = Get-ChildItem "${env:ProgramFiles(x86)}\Windows Kits\10\bin\10.*\x64\makeappx.exe" | Sort-Object { [version]$_.Directory.Parent.Name } | Select-Object -Last 1
           if (-not $sdk) { throw "Windows SDK (makeappx) not found" }

+ 4 - 2
docs/STORE.md

@@ -32,8 +32,10 @@ is in the repository:
   `Package/Properties/DisplayName` and the listing title. Since v0.1.20 the product itself is named LYNX SHARE, so
   Start menu, taskbar, Explorer's *Open with* and the app say **LYNX SHARE** too (`VisualElements DisplayName` /
   `ShortName`); the Application Id, `LYNX.exe` and the settings folders keep "LYNX".
-- **Version:** `project(LYNX VERSION x.y.z)` → `x.y.z.0` (the Store requires the fourth part to be 0). Every
-  submission needs a higher version than the last one.
+- **Version:** `project(LYNX VERSION x.y.z)` → `x.y.(z·10 + b).0`. The Store requires the fourth part to be 0 and
+  never accepts a different package under a version it has seen, so `b` (0..9, the `store_build` input of a manual
+  Release run) numbers repackaged builds of one release: 0.1.20 → 0.1.200.0, a resubmission → 0.1.201.0, 0.1.21 →
+  0.1.210.0. (0.1.20 was first uploaded as 0.1.20.0, below all of these.)
 - **Identity:** Partner Center › the app › *Product management › Product identity* shows `Package/Identity/Name`,
   `Package/Identity/Publisher` and `Package/Properties/PublisherDisplayName`. Copy them into the repository variables
   (GitHub › Settings › Secrets and variables › Actions › *Variables*):

+ 12 - 4
scripts/make-msix-layout.py

@@ -30,12 +30,18 @@ UNSIGNED_OID = "OID.2.25.311729368913984317654407730594956997722=1"
 APP_FILES = ("LYNX.exe", "lynx-asio.dll")  # (lynx-asio32.dll is for registering with 32-bit hosts: not in the package)
 
 
-def msix_version(version):
-    """'0.1.20' / '0.1.20-alpha' -> '0.1.20.0' (the Store wants the fourth part 0; each part 0..65535)."""
+def msix_version(version, store_build=0):
+    """'0.1.20' / '0.1.20-alpha' -> '0.1.200.0'. The Store reserves the fourth part (it must be 0), so a repackaged
+    build of the same release (a resubmission after a failed certification) needs a higher third part: the third part
+    is patch * 10 + store_build (0..9), which keeps every later release above every rebuild (0.1.209 < 0.1.210).
+    0.1.20 shipped as 0.1.20.0, below all of these. Each part 0..65535."""
     m = re.match(r"^(\d+)\.(\d+)\.(\d+)(?:[-+].*)?$", version.strip())
     if not m:
         raise ValueError(f"not a version: {version!r}")
-    parts = [int(p) for p in m.groups()]
+    if not 0 <= store_build <= 9:
+        raise ValueError(f"store build must be 0..9: {store_build!r}")
+    major, minor, patch = (int(p) for p in m.groups())
+    parts = [major, minor, patch * 10 + store_build]
     if any(p > 65535 for p in parts):
         raise ValueError(f"version part above 65535: {version!r}")
     return ".".join(str(p) for p in parts) + ".0"
@@ -54,6 +60,8 @@ def main(argv):
     ap.add_argument("--publisher", default=os.environ.get("MSIX_PUBLISHER") or DEFAULT_PUBLISHER)
     ap.add_argument("--publisher-display", default=os.environ.get("MSIX_PUBLISHER_DISPLAY") or DEFAULT_DISPLAY)
     ap.add_argument("--display-name", default=os.environ.get("MSIX_DISPLAY_NAME") or "LYNX SHARE")
+    ap.add_argument("--store-build", type=int, default=int(os.environ.get("MSIX_STORE_BUILD") or 0),
+                    help="0..9: repackaged build of the same release (see msix_version)")
     ap.add_argument("--test-identity", action="store_true")
     ap.add_argument("--loose", action="store_true",
                     help="also write unqualified logo names, for Add-AppxPackage -Register without makepri's resources.pri")
@@ -89,7 +97,7 @@ def main(argv):
         "@IDENTITY_NAME@": a.identity_name,
         "@PUBLISHER@": publisher,
         "@PUBLISHER_DISPLAY@": a.publisher_display,
-        "@VERSION@": msix_version(a.version),
+        "@VERSION@": msix_version(a.version, a.store_build),
         "@DISPLAY_NAME@": a.display_name,
     }
     for key, value in fields.items():