Home

Awesome

<h1> <img src="https://rawcdn.githack.com/michidk/winget-updater/7ef56d9c40feb29e1592c0bf6c65eb1af3e77d4e/.github/images/github-actions-logo.png" width="32" height="32" alt="Logo" /> WinGet Updater (GitHub Action) </h1>

GitHub release (latest by date) GitHub

A GitHub action which automatically updates WinGet packages, based on Komac.

This project is heavily inspired by vedantmgoyal2009/winget-releaser. The main differences are:

Getting Started 🚀

  1. At least 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 aren't supported by the action. Review this issue for information.

  3. 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 (see this issue for why this is important). You can do this using one of the following methods: https://github.com/vedantmgoyal2009/winget-releaser

  1. Add the action to your workflow file (e.g. .github/workflows/<name>.yml).

[!IMPORTANT] 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.

[!NOTE] In case you're pinning the action to a commit hash, you'll need to update the hash frequently to get the latest features & bug fixes. Therefore, it is highly recommended to setup dependabot auto-updates for your repository. Check out keeping your actions up to date with Dependabot for guidance on how to do this. (Yes, it also supports updating actions pinned to a commit hash!)

📖 Example Usage

Minimal example:

name: Update WinGet Packages

on: workflow_dispatch

jobs:
  update:
    name: Update Package
    runs-on: ubuntu-latest
    steps:
    - name: Update Packages
      uses: michidk/winget-updater@v1
      with:
        komac-token: ${{ secrets.KOMAC_TOKEN }}
        identifier: "michidk.vscli"
        repo: "michidk.vscli"
        URL: "https://github.com/michidk/vscli/releases/download/v{VERSION}/vscli-x86_64-pc-windows-msvc.zip"

Use a matrix to update multiple packages at once. Can also be combined with Run Komac to automatically clean up branches after a PR has been merged:

name: Update WinGet Packages

on:
  workflow_dispatch:
  schedule:
    - cron:  '0 3 * * *' # Scheduled to run daily at 03:00

jobs:
  update:
    name: Update package ${{ matrix.id }}
    runs-on: ubuntu-22.04

    strategy:
      matrix:
        include:
          - id: "Casey.Just"
            repo: "casey/just"
            url: "https://github.com/casey/just/releases/download/{VERSION}/just-{VERSION}-x86_64-pc-windows-msvc.zip"
          - id: "michidk.vscli"
            repo: "michidk/vscli"
            url: "https://github.com/michidk/vscli/releases/download/v{VERSION}/vscli-x86_64-pc-windows-msvc.zip"

    steps:
    - name: Update Packages
      uses: michidk/winget-updater@latest
      with:
        komac-token: ${{ secrets.KOMAC_TOKEN }}
        identifier: ${{ matrix.id }}
        repo: ${{ matrix.repo }}
        url: ${{ matrix.url }}

  cleanup:
    name: Cleanup branches
    needs: update # Not necessarily needed as PRs don't get closed that quick but still nice to have it in order
    runs-on: ubuntu-22.04

    steps:
    - name: Run Komac
      uses: michidk/run-komac@latest
      with:
        args: 'cleanup --only-merged --token=${{ secrets.KOMAC_TOKEN }}'

For a real-world example, have a look at my WinGet package updater repository: michidk/winget

⚒️ Configuration Options

<h2> 🚀 Integrating with <a href="https://github.com/russellbanks/Komac"> <img src="https://rawcdn.githack.com/michidk/winget-updater/7ef56d9c40feb29e1592c0bf6c65eb1af3e77d4e/.github/images/komac-logo.svg" height="24px" style="vertical-align:bottom" alt="Komac logo" /> </a></h2>

This GitHub action leverages Komac to generate and submit manifests to the Windows Package Manager Community Repository. Kudos to Russell Banks for developing Komac which powers this action. Also huge thanks to vedantmgoyal2009 for creating an awesome GitHub action, which this one is heavily inspired from.