Code Monkey home page Code Monkey logo

winget-releaser's Introduction

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!

winget-releaser's People

Contributors

dependabot[bot] avatar vedantmgoyal9 avatar allcontributors[bot] avatar russellbanks avatar github-actions[bot] avatar sitiom avatar daiyam avatar gerardog avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.