Coder Social home page Coder Social logo

michidk / winget-updater Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 1.0 61 KB

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

License: MIT License

ci deployment-automation deployment-tools github-action github-actions komac release-automation winget

winget-updater's Introduction

Logo WinGet Updater (GitHub Action)

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:

  • This action will update your package to the latest release available on GitHub automatically. It does not need to react to an on: release event in GitHub actions.
  • It is a composite action, which consists of other GitHub actions, which makes it very simple (no big Typescript project).

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

  • 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).

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:
        package-id: 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-latest

    strategy:
      matrix:
        include:
          - id: "michidk.vscli"
            repo: "michidk/vscli"
            url: "https://github.com/michidk/vscli/releases/download/v{VERSION}/vscli-x86_64-pc-windows-msvc.zip"
          - id: "Casey.Just"
            repo: "casey/just"
            url: "https://github.com/casey/just/releases/download/{VERSION}/just-{VERSION}-x86_64-pc-windows-msvc.zip"
    steps:
    - name: Update Packages
      uses: michidk/winget-updater@v1
      with:
        package-id: ${{ 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-latest

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

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

โš’๏ธ Configuration Options

  • komac-version: Specifies which version of Komac to use.
    • Required: โŒ
    • Default: 2.0.4
  • komac-token: The GitHub token to use for authentication. The token should have the public_repo scope.
    • Required: โœ…
    • โš  WARNING: Do not directly put the token in the action. Instead, create a repository secret containing the token and use that in the workflow. Refer to using encrypted secrets in a workflow for more information.
  • identifier: The package identifier of the package to be updated in the WinGet Community Repository.
    • Required: โœ…
    • Example: michidk.vscli
  • repo: The GitHub repository to check for the latest release.
    • Required: โœ…
    • Example: michidk/vscli
  • url: The URL(s) to the latest release. Can also be a comma-separated list. Use the placeholder {VERSION} to specify where the version should be inserted. The placeholder contains the version without v, e.g. 1.2.3.
    • Required: โœ…
    • Example: https://github.com/michidk/vscli/releases/download/v{VERSION}/vscli-x86_64-pc-windows-msvc.zip
  • custom-fork-owner: The owner of the winget-pkgs repo fork to use. If not specified, the owner of the repository where the action is used will be used.
    • Required: โŒ
    • Example: michidk

๐Ÿš€ Integrating with Komac logo

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.

winget-updater's People

Contributors

michidk avatar renovate[bot] avatar vedantmgoyal9 avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

b0t-at

winget-updater's Issues

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

This repository currently has no open or pending branches.

Detected dependencies

github-actions
.github/workflows/pr-stale.yml
  • actions/stale v9
  • ubuntu 22.04
.github/workflows/pr-title.yml
  • aslafy-z/conventional-pr-title-action v3
  • ubuntu 22.04
.github/workflows/versioning.yml
action.yml
  • actions/github-script v7
  • actions/github-script v7
  • michidk/run-komac v2

  • Check this box to trigger a request for Renovate to run again on this repository

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.