Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

winget: auto-update license/copyright urls #562

Merged
merged 1 commit into from
Feb 2, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions .github/workflows/release-winget.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ on:
release:
types: [released]

workflow_dispatch:
ldennington marked this conversation as resolved.
Show resolved Hide resolved
inputs:
release:
description: 'Release Id'
required: true
default: 'latest'

jobs:
release:
runs-on: windows-latest
Expand All @@ -17,7 +24,17 @@ 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_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}
Comment on lines +33 to +34
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is some fun script magic. It looks sensible, but we will only be sure once we run it for real.

Copy link
Collaborator Author

@ldennington ldennington Feb 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Welp. I did run it for real yesterday lol. I tried to write to the test repo, but the config failed and submitted a PR to the real repo instead, which I closed immediately. You can check it out here though:

https://github.com/microsoft/winget-pkgs/pull/95353/files

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see that it wrote https://github.com/microsoft/git/blob/vfs-2.39.10/COPYING (note .10 instead of .1).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or, perhaps you had created a v2.39.10.vfs.0.5 tag, based on the rest of the context. Carry on.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that was one of the experimental tags I created for testing!

sed -i "s/vfs-[.0-9]*/vfs-$shortenedVersion/g" "$manifestPath"

# Submit manifests
$manifestDirectory = Split-Path "$manifestPath"
.\wingetcreate.exe submit -t "${{ secrets.WINGET_TOKEN }}" $manifestDirectory
shell: powershell