From c09013a2770807f3930e8141d777406fa03daa3b Mon Sep 17 00:00:00 2001 From: Lessley Dennington Date: Wed, 1 Feb 2023 15:41:58 -0700 Subject: [PATCH] winget: update license/copyright urls One of our winget manifests currently has hardcoded, outdated values for its LicenseUrl and CopyrightUrl fields. This is because the winget-create tool that we use to automatically generate and publish our manifests cannot change these fields. In light of this, instead of creating and submitting manifests with a single command, update the workflow to do the following: 1. Create the manifests. 2. Update the LicenseUrl and CopyrightUrl fields with the correct version. 3. Submit the manifests. Additionally, add workflow_dispatch trigger for easier testing in the future. Signed-off-by: Lessley Dennington --- .github/workflows/release-winget.yml | 37 ++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release-winget.yml b/.github/workflows/release-winget.yml index 029cd624292d03..4623b928d7033e 100644 --- a/.github/workflows/release-winget.yml +++ b/.github/workflows/release-winget.yml @@ -2,6 +2,13 @@ name: "release-winget" on: release: types: [released] + + workflow_dispatch: + inputs: + release: + description: 'Release Id' + required: true + default: 'latest' jobs: release: @@ -17,7 +24,33 @@ jobs: $github.release.tag_name -match '\d.*' $version = $Matches[0] -replace ".vfs","" - # Download and run wingetcreate + # Download wingetcreate and create manifests Invoke-WebRequest https://aka.ms/wingetcreate/latest -OutFile wingetcreate.exe - .\wingetcreate.exe update Microsoft.Git -u $asset.browser_download_url -v $version -o manifests -t "${{ secrets.WINGET_TEST_TOKEN }}" -s + .\wingetcreate.exe update Microsoft.Git -u $asset.browser_download_url -v $version -o manifests + + # Manually substitute the name of the default branch in the License + # and Copyright URLs since the tooling cannot do that for us. + $shortenedVersion = $version -replace ".{4}$" + $manifestPath = dir -Path ./manifests -Filter Microsoft.Git.locale.en-US.yaml -Recurse | %{$_.FullName} + sed "s/vfs-[.0-9]*/vfs-$shortenedVersion/g" "$manifestPath" + + # Update settings to write to test repo + New-Item "$APPDATA/Local/Microsoft/WindowsPackageManagerManifestCreator/settings.json" -ItemType File -Force + $json = @' + { + "$schema": "https://aka.ms/wingetcreate-settings.schema.0.1.json", + "Telemetry": { + "disable": false + }, + "WindowsPackageManagerRepository": { + "owner": "ldennington", + "name": "winget-pkgs" + } + } + '@ + $json | Out-File -FilePath "C:/Users/lessley/AppData/Local/Microsoft/WindowsPackageManagerManifestCreator/settings.json" + + # Submit manifests + $manifestDirectory = Split-Path "$manifestPath" + .\wingetcreate.exe submit -t "${{ secrets.WINGET_TOKEN }}" $manifestDirectory shell: powershell