|
| 1 | +#!/usr/bin/env bash |
| 2 | +# FILE: tools/winget/sync-manifest.sh |
| 3 | +# VERSION: 1.1.0 |
| 4 | +# START_MODULE_CONTRACT |
| 5 | +# PURPOSE: Generate winget-pkgs manifests for a published Mark Windows release and open the submission PR. |
| 6 | +# SCOPE: download the x64 NSIS installer from a live GitHub release, hash it, render installer/locale/version YAML, sparse-clone microsoft/winget-pkgs, push a branch to the xronocode fork, open the PR. |
| 7 | +# DEPENDS: gh (authenticated), git, curl, shasum; network access to github.com. |
| 8 | +# LINKS: .grace/changes/active/C-15/plan.xml T-105; C-15 spec Amendment #3 (winget pulled ahead of the site card); M-046 release lane. |
| 9 | +# ROLE: SCRIPT |
| 10 | +# MAP_MODE: LOCALS |
| 11 | +# END_MODULE_CONTRACT |
| 12 | +# |
| 13 | +# START_MODULE_MAP |
| 14 | +# main - tag -> rendered manifests -> fork branch -> PR to microsoft/winget-pkgs |
| 15 | +# render_manifests - write the three YAML files from tag/sha/date into a staging dir |
| 16 | +# END_MODULE_MAP |
| 17 | +# |
| 18 | +# Usage: tools/winget/sync-manifest.sh v2.2.0-beta |
| 19 | +# Requires the release to be LIVE (the installer URL must resolve). |
| 20 | + |
| 21 | +set -euo pipefail |
| 22 | + |
| 23 | +TAG="${1:?usage: sync-manifest.sh <tag, e.g. v2.2.0-beta>}" |
| 24 | +VER="${TAG#v}" |
| 25 | +REPO="xronocode/mark" |
| 26 | +PKG_ID="xronocode.Mark" |
| 27 | +ASSET="Mark_${VER}_x64-setup.exe" |
| 28 | +URL="https://github.com/${REPO}/releases/download/${TAG}/${ASSET}" |
| 29 | +WORK="$(mktemp -d /tmp/winget-sync.XXXXXX)" |
| 30 | +STAGE="${WORK}/stage" |
| 31 | +MANIFEST_DIR="manifests/x/xronocode/Mark/${VER}" |
| 32 | + |
| 33 | +echo "[winget-sync] ${PKG_ID} ${VER}" |
| 34 | +echo "[winget-sync] installer: ${URL}" |
| 35 | + |
| 36 | +# START_BLOCK_FETCH_AND_HASH |
| 37 | +curl -fSL --retry 3 -o "${WORK}/${ASSET}" "${URL}" |
| 38 | +HASH="$(shasum -a 256 "${WORK}/${ASSET}" | awk '{print $1}')" |
| 39 | +RELEASE_DATE="$(gh release view "${TAG}" -R "${REPO}" --json publishedAt --jq '.publishedAt[0:10]')" |
| 40 | +echo "[winget-sync] sha256=${HASH} date=${RELEASE_DATE}" |
| 41 | +# END_BLOCK_FETCH_AND_HASH |
| 42 | + |
| 43 | +# START_BLOCK_RENDER_MANIFESTS |
| 44 | +DEST="${STAGE}/${MANIFEST_DIR}" |
| 45 | +mkdir -p "${DEST}" |
| 46 | + |
| 47 | +cat > "${DEST}/Mark.installer.yaml" <<YAML |
| 48 | +PackageIdentifier: ${PKG_ID} |
| 49 | +PackageVersion: ${VER} |
| 50 | +InstallerType: nullsoft |
| 51 | +Installers: |
| 52 | +- Architecture: x64 |
| 53 | + InstallerType: nullsoft |
| 54 | + Scope: user |
| 55 | + InstallerUrl: ${URL} |
| 56 | + InstallerSha256: ${HASH} |
| 57 | + InstallModes: |
| 58 | + - silent |
| 59 | + - silentWithProgress |
| 60 | + AppsAndFeaturesEntries: |
| 61 | + - DisplayName: Mark |
| 62 | + DisplayVersion: ${VER} |
| 63 | + Publisher: xronocode |
| 64 | + ReleaseDate: ${RELEASE_DATE} |
| 65 | +ManifestType: installer |
| 66 | +ManifestVersion: 1.9.0 |
| 67 | +YAML |
| 68 | + |
| 69 | +cat > "${DEST}/Mark.locale.en-US.yaml" <<YAML |
| 70 | +PackageIdentifier: ${PKG_ID} |
| 71 | +PackageVersion: ${VER} |
| 72 | +PackageLocale: en-US |
| 73 | +Publisher: xronocode |
| 74 | +PublisherUrl: https://github.com/${REPO} |
| 75 | +PackageName: Mark |
| 76 | +Moniker: mark |
| 77 | +ShortDescription: Lightweight WYSIWYG markdown editor |
| 78 | +Description: Mark is a fast, lightweight WYSIWYG markdown editor — a ~10 MB native (Tauri) port of Mark Text for macOS and Windows with tabs, project tree, themes, pandoc export and a built-in updater. |
| 79 | +License: MIT |
| 80 | +LicenseUrl: https://github.com/${REPO}/blob/main/LICENSE |
| 81 | +Tags: |
| 82 | +- markdown |
| 83 | +- editor |
| 84 | +- wysiwyg |
| 85 | +- notes |
| 86 | +ReleaseNotesUrl: https://github.com/${REPO}/releases/tag/${TAG} |
| 87 | +ManifestType: defaultLocale |
| 88 | +ManifestVersion: 1.9.0 |
| 89 | +YAML |
| 90 | + |
| 91 | +cat > "${DEST}/Mark.yaml" <<YAML |
| 92 | +PackageIdentifier: ${PKG_ID} |
| 93 | +PackageVersion: ${VER} |
| 94 | +DefaultLocale: en-US |
| 95 | +ManifestType: version |
| 96 | +ManifestVersion: 1.9.0 |
| 97 | +YAML |
| 98 | +# END_BLOCK_RENDER_MANIFESTS |
| 99 | + |
| 100 | +# START_BLOCK_SUBMIT_PR |
| 101 | +# Blobless depth-1 clone + no-cone sparse on our publisher dir (new package: |
| 102 | +# the dir does not exist upstream yet — no-cone patterns allow that). |
| 103 | +cd "${WORK}" |
| 104 | +git clone --filter=blob:none --sparse --depth 1 https://github.com/microsoft/winget-pkgs.git |
| 105 | +cd winget-pkgs |
| 106 | +git sparse-checkout set --no-cone 'manifests/x/xronocode/*' |
| 107 | +BR="Mark-${VER}" |
| 108 | +git checkout -b "${BR}" |
| 109 | +mkdir -p "${MANIFEST_DIR}" |
| 110 | +cp "${STAGE}/${MANIFEST_DIR}"/*.yaml "${MANIFEST_DIR}/" |
| 111 | +git add "${MANIFEST_DIR}" |
| 112 | +git commit -m "Add ${PKG_ID} version ${VER}" |
| 113 | +gh repo fork microsoft/winget-pkgs --clone=false 2>/dev/null || true |
| 114 | +git remote add fork "https://github.com/xronocode/winget-pkgs.git" 2>/dev/null || true |
| 115 | +git push -u fork "${BR}" |
| 116 | +gh pr create -R microsoft/winget-pkgs \ |
| 117 | + --head "xronocode:${BR}" \ |
| 118 | + --title "Add ${PKG_ID} version ${VER}" \ |
| 119 | + --body "New version of ${PKG_ID}. |
| 120 | +
|
| 121 | +- Installer: \`${ASSET}\` from https://github.com/${REPO}/releases/tag/${TAG} |
| 122 | +- sha256: \`${HASH}\` |
| 123 | +- NSIS per-user installer (\`/S\` silent), x64 only. |
| 124 | +- Homepage: https://mark.xronocode.com |
| 125 | +
|
| 126 | +Generated with tools/winget/sync-manifest.sh in the Mark repo." |
| 127 | +echo "[winget-sync] PR opened for ${VER}" |
| 128 | +# END_BLOCK_SUBMIT_PR |
0 commit comments