Skip to content

A basic shell script to monitor 3rd party repo and create winget manifest when new release is up.

License

Notifications You must be signed in to change notification settings

senacra/wingetmus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Wingetmus (Winget Manifest Updater Script)

A basic shell script to monitor 3rd party repo and create winget manifest when new release is up.

Important

This script is the one I use to keep RPTools.MapTool manifests up to date. Some parts of the script are hard coded for this usecase. You will need some (minor) adaptation to use it for other component.

About The Project

I was looking for an easy way to make some winget-pkgs manifest update automated. As I maintain these manifests without beeing the publisher, I do not have access to publisher CI - which is the easiest way to perform this.

So I created a small script to do this step, then created a docker image to perform this action and finaly setup a cron job to run this image.

This script checks if there is a new release of a monitored package for which there is not yet a winget pull request, and uses Komac CLI to create one (example).

Getting Started

Prerequisites

In any cases the following 2 steps should be done before using project :

  1. Generate an access token on your GitHub account to be able to run Komac.
  2. Create a fork from winget-pkgs to handle your pull requests for manifests - Also take care to validate all requirements to be able to contribute to Microsoft repositories.

If you want to use the dockerfile to build an image running the script then you can skip the other depedencies.

If you want to run the script localy then you need to be on Linux or WSL if using Windows (as this is an sh script) and to install the following distribution dependencies :

  • Basic dependencies (Example on Ubuntu)
    apt-get update && apt-get install -y --no-install-recommends --no-install-suggests       git wget curl jq ca-certificates
  • Install Komac (Example on Ubuntu)
    wget https://github.com/russellbanks/Komac/releases/download/v2.10.1/komac_2.10.1-1_amd64.deb
    dpkg -i komac_2.10.1-1_amd64.deb

Setup

  1. Clone the repo
    git clone https://github.com/senacra/wingetmus.git
  2. Adapt the script (at least regex for version parsing and URL for downloading) to match your needs.

Usage (Localy)

The update_manifest.sh script can be called using 4 parameters :

  • githubName/winget-pkgs-fork : The GitHub project where your winget-pkgs fork is located.
  • Publisher.PackageName: The name of the package (as declared in winget manifest) that you want to track and update.
  • token: Your PAT for your GitHub account with the winget-pkgs fork.
  • (opt) mode : a mode string to know if you want to track only for upcomming releases (default) or if you want to also create manifest for all past releases (use full).

For example :

./update_manifest.sh myName/winget-pkgs-fork AwesomePublisher.TopPackage this_should_look_random

Usage (Docker)

For a lot of reasons, it is more convient (at least for me) to "dockerize" a script rather than running it as it is. Once you have updated the script to match your needs, and tested it localy, you can proceed as follow :

  1. Adapt the Dockerfile file to put the good arguments (last CMD line) - The give example is used for RPTools.MapTool package.

  2. Build the docker image

    docker build -t manifest-updater:v1 .
  3. Run the docker container.

    sudo docker run -e GIT_TOKEN=<token> manifest-updater:v1

Usage (Schedule periodic call)

Documentation to be done

Roadmap

  • V1 hardcoded to handle RPTools.MapTool manifests.
  • Make it generic by getting download URLs directly using Github API.
  • Allow a configurable regex for version.
  • Add documentation on the "cron" and other schedulling methods.
  • Maybe update the image to add a light web service to manage list of packages to track.

Contributing

Well this is just a very basic script, and probably most of you will prefer to include winget in publishing CI when possible, or to use existing GitHub action plugins. But in any cases contributions/questions/suggestions are welcome :)

License

Distributed under the AGPLv3.0. See LICENSE.txt for more information.

About

A basic shell script to monitor 3rd party repo and create winget manifest when new release is up.

Topics

Resources

License

Stars

Watchers

Forks