Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 22, 2026

Automates submission of semver-cli releases to the Windows Package Manager (winget) repository.

Changes

Manifest Templates (manifests/):

  • Created three template files with __PLACEHOLDER__ syntax for variable substitution
  • Files: installer.yaml, locale.en-US.yaml, version.yaml
  • Package identifier: Optum.semver-cli
  • Templates are versioned in the repository for testability

Scripts (scripts/):

  • winget-package.sh: Packages Windows binary into ZIP and generates manifests

    • --release flag: Downloads from GitHub release (extracts exe from tar.gz, creates zip)
    • Local mode (default): Uses local build from bin/semver.exe
    • SHA256 hash calculated using bash (sha256sum/shasum)
    • Generates manifests via sed replacement from templates
  • winget-publish.sh: Validates and publishes manifests to microsoft/winget-pkgs

    • --dry-run flag: Validates manifests without creating PR (for testing)
    • --release flag: Indicates release mode for real publishing
    • Validates with winget validate when available
    • Creates PR to microsoft/winget-pkgs repository

Publish Workflow (.github/workflows/publish.yml):

  • New winget job on windows-latest runner that:
    • Runs winget-package.sh --release to download and package from GitHub release
    • Uploads ZIP as release asset to GitHub
    • Runs winget-publish.sh --release to create PR to microsoft/winget-pkgs
    • Only runs on actual releases (non-prerelease)

Checks Workflow (.github/workflows/checks.yml):

  • Added winget-check job for PR testing on windows-latest
  • Compiles Windows binary locally
  • Tests winget-package.sh in local mode
  • Tests winget-publish.sh --dry-run for validation
  • Never uses --release flag

Version Management (.github/version.yml):

  • Added regex patterns to auto-update PackageVersion in all three manifest templates

Documentation (README.md):

  • Added winget installation section with package identifier Optum.semver-cli

Behavior

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-cli after Microsoft approval.

The scripts can be tested locally and in PRs via the checks workflow, ensuring manifests are valid before release.

Original prompt

This section details on the original issue you should resolve

<issue_title>feature: Add packages to winget</issue_title>
<issue_description>## Feature Request

When a new version is created package and submit it to the winget repository.

  1. Package .exe into an installer of some kind
  2. Update winget manifest as needed
  3. Run on a windows build agent to run winget tool
  4. Automatically generate PR in winget gitops repo

Docs

https://learn.microsoft.com/en-us/windows/package-manager/package/</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copilot AI and others added 3 commits January 22, 2026 18:26
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>
Copilot AI changed the title [WIP] Add packages to winget repository Add automated winget package submission Jan 22, 2026
Copilot AI requested a review from justinmchase January 22, 2026 18:31
Copy link
Collaborator

@justinmchase justinmchase left a 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:

  1. winget-package.sh
  2. 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...

  1. publish.yml
  • should run winget-package.sh and winget-publish.sh scripts
  • should pass --release flag if github.event_name == 'release'
  • Should pass --dry-run if inputs.prerelease is true
  1. 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

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()")
Copy link
Collaborator

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.

Copy link
Contributor Author

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
Copy link
Collaborator

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?

Copy link
Contributor Author

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.

EOF

# Generate the locale manifest
cat > "${manifest_dir}/Optum.semver.locale.en-US.yaml" << EOF
Copy link
Collaborator

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.

Copy link
Contributor Author

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.

- deno
ReleaseNotesUrl: https://github.com/Optum/semver-cli/releases/tag/${VERSION}
ManifestType: defaultLocale
ManifestVersion: 1.6.0
Copy link
Collaborator

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.

Copy link
Contributor Author

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.

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
Copy link
Collaborator

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.

Copy link
Contributor Author

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>
Copy link
Contributor Author

Copilot AI commented Feb 3, 2026

@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....

Done! Refactored the winget integration in commit 2ff7692:

Created:

  • manifests/ directory with template files (installer.yaml, locale.en-US.yaml, version.yaml)
  • scripts/winget-package.sh with --release flag support
  • scripts/winget-publish.sh with --dry-run and --release flags

Updated:

  • publish.yml - uses scripts with --release flag when github.event_name == 'release'
  • checks.yml - added winget-check job that compiles Windows binary and runs both scripts with --dry-run (never with --release)

The scripts now work with local builds (default) or GitHub releases (with --release flag). Manifests use templating with simple sed replacements.

Copilot AI and others added 2 commits February 3, 2026 01:01
Co-authored-by: justinmchase <10974+justinmchase@users.noreply.github.com>
Co-authored-by: justinmchase <10974+justinmchase@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feature: Add packages to winget

3 participants