distribute: fix $schema heredoc escaping + INSTALLER_URL ${{ }} substitution

Two pre-existing latent bugs in the WinGet job template:

1. The line '# yaml-language-server: $schema=...' was inside a
   <<EOF heredoc, so bash treated $schema as an undefined variable
   and stripped it down to '=https://...'. The resulting YAML still
   parsed (since the $schema line is just an editor comment), but
   IDE auto-complete and editor-side validation were broken.

   Fix: escape the $ as \$ in the heredoc so bash leaves it alone.

2. INSTALLER_URL was set in the workflow env: block with literal
   ${VERSION} placeholders. GitHub Actions only substitutes \${{ }}
   expressions in env values, not ${}. So the bash $VERSION got
   expanded but the URL kept ${VERSION} literal in the output —
   meaning the published manifest had a broken InstallerUrl that
   the Microsoft validator would 404 on (and a literal ${VERSION}
   string in SHA-source comparison).

   Fix: use ${{ env.VERSION }} in the workflow YAML so GitHub Actions
   substitutes it at runtime. Then bash gets the real version string
   and the heredoc just expands the resulting env var.
This commit is contained in:
Krystie
2026-06-22 20:57:16 -07:00
parent 20fc2ee6dd
commit 6726365872
+4 -4
View File
@@ -519,7 +519,7 @@ jobs:
PUBLISHER_INITIAL: c
PACKAGE_ID: CryptographicTriangles.TrianglesQt
PACKAGE_SHORT: TrianglesQt
INSTALLER_URL: https://github.com/SamiAhmed7777/triangles_v5/releases/download/v${VERSION}/Cryptographic-Triangles-${VERSION}-win-x64-setup.exe
INSTALLER_URL: https://github.com/SamiAhmed7777/triangles_v5/releases/download/v${{ env.VERSION }}/Cryptographic-Triangles-${{ env.VERSION }}-win-x64-setup.exe
run: |
set -e
# Install gh + jq if missing
@@ -575,7 +575,7 @@ jobs:
SCHEMA_BASE="https://raw.githubusercontent.com/microsoft/winget-cli/master/schemas/JSON/manifests/v1.12.0"
cat > "$MANIFEST_DIR/${PACKAGE_ID}.yaml" <<EOF
# yaml-language-server: $schema=${SCHEMA_BASE}/manifest.version.1.12.0.json
# yaml-language-server: \$schema=${SCHEMA_BASE}/manifest.version.1.12.0.json
PackageIdentifier: ${PACKAGE_ID}
PackageVersion: ${VERSION}
DefaultLocale: en-US
@@ -584,7 +584,7 @@ jobs:
EOF
cat > "$MANIFEST_DIR/${PACKAGE_ID}.locale.en-US.yaml" <<EOF
# yaml-language-server: $schema=${SCHEMA_BASE}/manifest.defaultLocale.1.12.0.json
# yaml-language-server: \$schema=${SCHEMA_BASE}/manifest.defaultLocale.1.12.0.json
PackageIdentifier: ${PACKAGE_ID}
PackageVersion: ${VERSION}
PackageLocale: en-US
@@ -604,7 +604,7 @@ jobs:
EOF
cat > "$MANIFEST_DIR/${PACKAGE_ID}.installer.yaml" <<EOF
# yaml-language-server: $schema=${SCHEMA_BASE}/manifest.installer.1.12.0.json
# yaml-language-server: \$schema=${SCHEMA_BASE}/manifest.installer.1.12.0.json
PackageIdentifier: ${PACKAGE_ID}
PackageVersion: ${VERSION}
InstallModes: