-
Notifications
You must be signed in to change notification settings - Fork 1
Add automated winget package submission #142
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
base: main
Are you sure you want to change the base?
Conversation
|
|
Co-authored-by: justinmchase <10974+justinmchase@users.noreply.github.com>
Co-authored-by: justinmchase <10974+justinmchase@users.noreply.github.com>
Co-authored-by: justinmchase <10974+justinmchase@users.noreply.github.com>
justinmchase
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot Please address the following review comments.
We need to be able to test these out in every PR and locally before we get to the publish workflow.
So, can you put these files somewhere into the local file system and instead of inlining them all right from the action use some basic replacements to replace the variable elements of the files.
Also please add a scripts/ folder and add two scripts:
- winget-package.sh
- winget-publish.sh
Please add a --dry-run flag to the publish step so it does everything except creates a pull request with the remote repo.
Please add a --release flag to both scripts, which when the flag is specified it would use a github release to publish but when its not available its just using the local file system to hold the packages.
Please update the following workflows...
- publish.yml
- should run winget-package.sh and winget-publish.sh scripts
- should pass
--releaseflag ifgithub.event_name == 'release' - Should pass
--dry-runifinputs.prereleaseis true
- checks.yml
- should run winget-package.sh and winget-publish.sh in addition to everything else its already doing
- Should never send --release flag
- Should always pass the --dry-run flag
.github/workflows/publish.yml
Outdated
| gh release download "${VERSION}" --pattern "${asset_name}" --dir assets --repo Optum/semver-cli | ||
|
|
||
| # Calculate SHA256 (PowerShell command via bash, convert to lowercase) | ||
| sha=$(powershell -Command "(Get-FileHash -Algorithm SHA256 assets/${asset_name}).Hash.ToLower()") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot Can you do this without powershell? I don't think its necessary you should be able to do it right from bash directly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done! Removed PowerShell dependency in commit 2ff7692. Now using bash's sha256sum or shasum commands directly in the winget-package.sh script.
README.md
Outdated
| ## Winget (Windows Package Manager) | ||
|
|
||
| ```sh | ||
| winget install Optum.semver |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you make the packages name semver-cli in winget instead of Optum.semver?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done! Changed package name from Optum.semver to Optum.semver-cli in commit 2ff7692. Updated in all manifest templates and README.md.
.github/workflows/publish.yml
Outdated
| EOF | ||
|
|
||
| # Generate the locale manifest | ||
| cat > "${manifest_dir}/Optum.semver.locale.en-US.yaml" << EOF |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please move these files to be files in the repo in a manifests directory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done! Moved manifest files to the repo in commit 2ff7692. Created manifests/ directory with template files that use __PLACEHOLDER__ syntax for variable replacement during packaging.
.github/workflows/publish.yml
Outdated
| - deno | ||
| ReleaseNotesUrl: https://github.com/Optum/semver-cli/releases/tag/${VERSION} | ||
| ManifestType: defaultLocale | ||
| ManifestVersion: 1.6.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All of these versions need to be added to the .github/versions.yml file so they are updated when semver-cli version changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done! Added version patterns to .github/version.yml in commit 2ff7692. Added three regexp patterns to update PackageVersion in all three manifest template files.
.github/workflows/publish.yml
Outdated
| if: github.event_name == 'release' && matrix.target.name == 'x86_64-pc-windows-msvc' | ||
| run: | | ||
| cd bin | ||
| zip $APP_NAME.${{ matrix.target.name }}.zip ${APP_NAME}.exe |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't do this here, we're already uploading the exe file as an asset, if you need it zipped for winget then do it in the package step after you download the asset.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done! Removed ZIP creation from assets job in commit 2ff7692. Now the winget-package.sh script downloads the .exe from the release asset (tar.gz), extracts it, and creates the ZIP file. The ZIP is then uploaded as a separate release asset by the winget job.
Co-authored-by: justinmchase <10974+justinmchase@users.noreply.github.com>
Done! Refactored the winget integration in commit 2ff7692: Created:
Updated:
The scripts now work with local builds (default) or GitHub releases (with |
Co-authored-by: justinmchase <10974+justinmchase@users.noreply.github.com>
Co-authored-by: justinmchase <10974+justinmchase@users.noreply.github.com>
Automates submission of semver-cli releases to the Windows Package Manager (winget) repository.
Changes
Manifest Templates (
manifests/):__PLACEHOLDER__syntax for variable substitutioninstaller.yaml,locale.en-US.yaml,version.yamlOptum.semver-cliScripts (
scripts/):winget-package.sh: Packages Windows binary into ZIP and generates manifests--releaseflag: Downloads from GitHub release (extracts exe from tar.gz, creates zip)bin/semver.exesha256sum/shasum)winget-publish.sh: Validates and publishes manifests to microsoft/winget-pkgs--dry-runflag: Validates manifests without creating PR (for testing)--releaseflag: Indicates release mode for real publishingwinget validatewhen availablemicrosoft/winget-pkgsrepositoryPublish Workflow (
.github/workflows/publish.yml):wingetjob onwindows-latestrunner that:winget-package.sh --releaseto download and package from GitHub releasewinget-publish.sh --releaseto create PR to microsoft/winget-pkgsChecks Workflow (
.github/workflows/checks.yml):winget-checkjob for PR testing onwindows-latestwinget-package.shin local modewinget-publish.sh --dry-runfor validation--releaseflagVersion Management (
.github/version.yml):Documentation (
README.md):Optum.semver-cliBehavior
Triggers on release publish (non-prerelease only). Downloads Windows exe from release assets, packages into ZIP, generates manifests from templates, and submits PR to microsoft/winget-pkgs for review. Users can install via
winget install Optum.semver-cliafter Microsoft approval.The scripts can be tested locally and in PRs via the checks workflow, ensuring manifests are valid before release.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.