Skip to content

telegramdesktop/winget-releaser

Β 
Β 

Repository files navigation

Logo WinGet Releaser (GitHub Action)

GitHub contributors (via allcontributors.org) GitHub issues GitHub release (latest by date) GitHub Repo stars GitHub Playground-dry-run

Publish new releases of your application to the Windows Package Manager easily.

pr-example-screenshot

Creating manifests and pull requests for every release of your application can be time-consuming and error-prone.

WinGet Releaser allows you to automate this process, with pull requests that are trusted amongst the community, often expediting the amount of time it takes for a submission to be reviewed.

Getting Started πŸš€

  1. Atleast one version of your package should already be present in the Windows Package Manager Community Repository. The action will use that version as a base to create manifests for new versions of the package.

  2. You will need to create a classic Personal Access Token (PAT) with public_repo scope. New fine-grained PATs can't access GitHub's GraphQL API, so they aren't supported by this action. Refer to cli/cli#6680 for more information.

Personal Access Token Required Scopes

  1. Fork the winget-pkgs repository under the same account/organization as your repository on which you want to use this action. Ensure that the fork is up-to-date with the upstream repository. You can do this using one of the following methods:
  • Give workflow permission to the token you created in Step 1. This will allow the action to automatically update your fork with the upstream repository.
  • You can use Pull App which keeps your fork up-to-date with the upstream repository via automated pull requests.
  1. Add the action to your workflow file (e.g. .github/workflows/<name>.yml). Some quick & important points to note:
  • The action can only be run on Windows runners, so the job must run on windows-latest.
  • The action will only work when the release is published (not a draft), because the release assets (binaries) aren't available publicly until the release is published.

Examples

Workflow with the minimal configuration Workflow with a filter to only publish .exe files
name: Publish to WinGet
on:
  release:
    types: [released]
jobs:
  publish:
    # Action can only be run on windows
    runs-on: windows-latest
    steps:
      - uses: vedantmgoyal2009/winget-releaser@v2
        with:
          identifier: Package.Identifier
          max-versions-to-keep: 5 # keep only latest 5 versions
          token: ${{ secrets.WINGET_TOKEN }}
name: Publish to WinGet
on:
  release:
    types: [released]
jobs:
  publish:
    runs-on: windows-latest
    steps:
      - uses: vedantmgoyal2009/winget-releaser@v2
        with:
          identifier: Package.Identifier
          installers-regex: '\.exe$' # Only .exe files
          token: ${{ secrets.WINGET_TOKEN }}
Workflow to publish multiple packages Workflow with implementation of custom package version
name: Publish to WinGet
on:
  release:
    types: [released]
jobs:
  publish:
    runs-on: windows-latest
    steps:
      - name: Publish X to WinGet
        uses: vedantmgoyal2009/winget-releaser@v2
        with:
          identifier: Package.Identifier<X>
          installers-regex: '\.exe$' # Only .exe files
          token: ${{ secrets.WINGET_TOKEN }}
      - name: Publish Y to WinGet
        uses: vedantmgoyal2009/winget-releaser@v2
        with:
          identifier: Package.Identifier<Y>
          installers-regex: '\.msi$' # Only .msi files
          token: ${{ secrets.WINGET_TOKEN }}
name: Publish to WinGet
on:
  release:
    types: [released]
jobs:
  publish:
    runs-on: windows-latest
    steps:
      - name: Get version
        id: get-version
        run: |
          # Finding the version from release name
          $VERSION="${{ github.event.release.name }}" -replace '^.*/ '
          echo "::set-output name=version::$VERSION"
        shell: pwsh
      - uses: vedantmgoyal2009/winget-releaser@v2
        with:
          identifier: Package.Identifier
          version: ${{ steps.get-version.outputs.version }}
          token: ${{ secrets.WINGET_TOKEN }}

Configuration Options βš’οΈ

Package Identifier (identifier)

  • Required: βœ…

The package identifier of the package to be updated in the Windows Package Manager Community Repository.

identifier: Publisher.Package # Microsoft.Excel

Version (version)

  • Required: ❌ (defaults to tag, excluding v prefix: v1.0.0 -> 1.0.0)

The PackageVersion of the package you want to release.

version: ${{ github.event.release.tag_name }} # For tags without the 'v' prefix

Installers Regex (installers-regex)

  • Required: ❌ (Default value: .(exe|msi|msix|appx)(bundle){0,1}$)

A regular expression to match the installers from the release artifacts which are to be published to Windows Package Manager (WinGet).

installers-regex: '\.exe$'
# Some common regular expressions include:
## '\.msi$'      -> All MSI's
## '\.exe$'      -> All EXE's
## '\.(exe|msi)' -> All EXE's and MSI's
## '\.zip$'      -> All ZIP's

Maximum no. of versions to keep in the winget-pkgs repository (max-versions-to-keep)

  • Required: ❌ (Default value: 0 - unlimited)

The maximum number of versions of the package to keep in the Windows Package Manager Community Repository repository. If after the current release, the number of versions exceeds this limit, the oldest version will be deleted.

max-versions-to-keep: 5 # keep only the latest 5 versions

Release tag (release-tag)

  • Required: ❌ (Default value: ${{ github.event.release.tag_name || github.ref_name }})

The GitHub release tag of the release you want to publish to Windows Package Manager (WinGet).

release-tag: ${{ inputs.version }} # workflow_dispatch input `version`

Token (token)

  • Required: βœ…

The GitHub token with which the action will authenticate with GitHub API and create a pull request on the Windows Package Manager Community Repository repository.

token: ${{ secrets.WINGET_TOKEN }} # Repository secret called 'WINGET_TOKEN'

The token should have the public_repo scope.

Note Do not directly put the token in the action. Instead, create a repository secret containing the token and use that in the workflow. See using encrypted secrets in a workflow for more details.

Use fork under which user (fork-user)

  • Required: ❌ (Default value: ${{ github.repository_owner }} # repository owner)

This is the GitHub username of the user where the fork of Windows Package Manager Community Repository is present. This fork will be used to create the pull request.

fork-user: dotnet-winget-bot # for example purposes only

Contributors ✨

Thanks goes to these wonderful people (emoji key):

Baptiste Augrain
Baptiste Augrain

πŸ’» πŸ€” πŸ›
Christian Brabandt
Christian Brabandt

πŸ›
CodeDoctor
CodeDoctor

πŸ›
Eric Trenkel
Eric Trenkel

πŸ’΅ πŸ›
Fndroid
Fndroid

πŸ’΅
Gerardo Grignoli
Gerardo Grignoli

πŸ“–
Kei Touge
Kei Touge

πŸ›
Maxim
Maxim

πŸ›
Russell Banks
Russell Banks

πŸ€” πŸ“–
Tim Brinkley
Tim Brinkley

πŸ› πŸ’΅
Vedant
Vedant

πŸ’»
sitiom
sitiom

πŸ“– πŸ› πŸ’»

This project follows the all-contributors specification. Contributions of any kind welcome!

About

Publish new releases of your application to the Windows Package Manager easily.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 100.0%