diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 00000000..992c2832 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,36 @@ +name: Submit release to the WinGet community repository + +on: + release: + types: [published] + +jobs: + publish-winget: + name: Submit to WinGet repository + + # winget-create is only supported on Windows + runs-on: windows-latest + + # Only submit stable releases + if: ${{ !github.event.release.prerelease }} + + # winget-create will read the following environment variable to access the GitHub token needed for submitting a PR + # See https://aka.ms/winget-create-token + env: + WINGET_CREATE_GITHUB_TOKEN: ${{ secrets.WINGET_CREATE_GITHUB_TOKEN }} + + steps: + - name: Submit package using wingetcreate + run: | + # Get installer info from release event + $assets = '${{ toJSON(github.event.release.assets) }}' | ConvertFrom-Json + $msixPackageUrl = $assets | Where-Object -Property name -like '*.msixbundle' | Select-Object -ExpandProperty browser_download_url + $portablePackageUrl = $assets | Where-Object -Property name -eq 'wingetcreate.exe' | Select-Object -ExpandProperty browser_download_url + $packageVersion = (${{ toJSON(github.event.release.tag_name) }}).Trim('v') + + # Update package using wingetcreate + curl.exe -JLO https://aka.ms/wingetcreate/latest + .\wingetcreate.exe update Microsoft.WingetCreate ` + --version $packageVersion ` + --urls $msixPackageUrl "$portablePackageUrl|x64" "$portablePackageUrl|x86" ` + --submit diff --git a/README.md b/README.md index 19dd4cb6..766d091a 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ -# Welcome to the Windows Package Manager Manifest Creator repository. +# Windows Package Manager Manifest Creator (WinGet-Create) This repository contains the source code for the Windows Package Manager Manifest Creator. The Windows Package Manager Manifest Creator is designed to help generate or update manifest files for the [Community repo](https://github.com/microsoft/winget-pkgs). @@ -13,16 +13,29 @@ Developers will use this tool to submit their applications for use with the [Win For your convenience, **WingetCreate** can be acquired a number of ways. -### Install from the github repo - -The **Windows Package Manager Manifest Creator** is available for download from the [winget-create](https://github.com/microsoft/winget-create/releases) repository. To install the package, simply click the the MSIX file in your browser. Once it has downloaded, click open. - ### Install with Windows Package Manager +Simply run the following command in a command prompt or PowerShell window: + ```powershell winget install wingetcreate ``` +### Install from the GitHub repository + +The **Windows Package Manager Manifest Creator** is available for download from the [winget-create](https://github.com/microsoft/winget-create/releases) repository. To install the package, download the MSIXBundle package from the release assets. Once it has downloaded, you can simply double-click the file to install it. Alternatively, you can use PowerShell to install the package using the following command: + +```powershell +Add-AppxPackage -Path +``` + +There are also a couple shorthand vanity URLs available to get the latest version of the tool. + +- Latest portable package: +- Latest MSIX package: + +### Community maintained options + ### Install with [Scoop](https://scoop.sh/) ```powershell @@ -38,6 +51,7 @@ choco install wingetcreate ## Build status [![Build Status](https://microsoft.visualstudio.com/Apps/_apis/build/status%2FADEX%2Fwinget-create%20Release?repoName=microsoft%2Fwinget-create&branchName=main)](https://microsoft.visualstudio.com/Apps/_build/latest?definitionId=64953&repoName=microsoft%2Fwinget-create&branchName=main) + ## Using Windows Package Manager Manifest Creator **WingetCreate** has the following commands: @@ -52,34 +66,36 @@ choco install wingetcreate | [Show](doc/show.md) | Command for displaying existing manifests | | [Token](doc/token.md) | Command for managing cached GitHub personal access tokens | | [Settings](doc/settings.md) | Command for editing the settings file configurations | -| [Cache](doc/cache.md) | Command for managing downloaded installers stored in cache +| [Cache](doc/cache.md) | Command for managing downloaded installers stored in cache | | [Info](doc/info.md) | Displays information about the client | | [Dsc](doc/dsc.md) | DSC v3 resource commands | | [-?](doc/help.md) | Displays command line help | Click on the individual commands to learn more. -## Using Windows Package Manager Manifest Creator in a CI/CD pipeline +## Using WinGet-Create to publish latest manifest to the WinGet Community repository + +You can use WingetCreate to update an existing WinGet manifest as part of your CI/CD pipeline. Please note that this requires you to have an existing manifest on the community repository before you can utilize the update pipeline. If you don't have a manifest for your package yet, you can use the [New Command](doc/new.md) to create one & submit it to the community repository. -You can use WingetCreate to update your existing app manifest as part of your CI/CD pipeline. For reference, see the final task in this repo's [release Azure pipeline](https://github.com/microsoft/winget-create/blob/main/pipelines/azure-pipelines.release.yml). If you are utilizing GitHub Actions as your CI pipeline, you can refer to the following repositories that have implemented WingetCreate within their release pipelines: +You can view the [GitHub action](.github/workflows/publish.yml) utilized by this repository to publish the latest release of WinGet-Create to the Windows Package Manager Community repository. For reference, you may also see the following GitHub repositories that utilize a similar approach to update their manifests: -- [DevHome](https://github.com/microsoft/devhome/blob/main/.github/workflows/winget-submission.yml) -- [Oh-My-Posh](https://github.com/JanDeDobbeleer/oh-my-posh/blob/main/.github/workflows/winget.yml) -- [PowerToys](https://github.com/microsoft/PowerToys/blob/main/.github/workflows/package-submissions.yml) -- [Terminal](https://github.com/microsoft/terminal/blob/main/.github/workflows/winget.yml) +- [JanDeDobbeleer/Oh-My-Posh](https://github.com/JanDeDobbeleer/oh-my-posh/blob/main/.github/workflows/winget.yml) +- [microsoft/edit](https://github.com/microsoft/edit/blob/main/.github/workflows/winget.yml) +- [microsoft/PowerToys](https://github.com/microsoft/PowerToys/blob/main/.github/workflows/package-submissions.yml) +- [microsoft/Terminal](https://github.com/microsoft/terminal/blob/main/.github/workflows/winget.yml) You can also check out this [episode of Open at Microsoft](https://learn.microsoft.com/en-us/shows/open-at-microsoft/wingetcreate-keeping-winget-packages-up-to-date) where we cover the same topic. -### Using the standalone exe: +### Using the standalone exe -The latest version of the standalone exe can be found at https://aka.ms/wingetcreate/latest, and the latest preview version can be found at https://aka.ms/wingetcreate/preview, both of these require [.NET Runtime 6.0](https://dotnet.microsoft.com/en-us/download/dotnet/6.0) to be installed on the build machine. To install this on your build machine in your pipeline, you can include the following dotnet task: +The latest version of the standalone exe can be found at , and the latest preview version can be found at , both of these require [.NET Runtime 8.0](https://dotnet.microsoft.com/en-us/download/dotnet/8.0) to be installed on the build machine. If your CI runs on GitHub actions, these dependencies would already be installed. For Azure DevOps, you can install the .NET Runtime using the `UseDotNet` task in your pipeline YAML file. ```yaml - task: UseDotNet@2 displayName: 'Install .NET Runtime' inputs: packageType: sdk - version: '6.x' + version: '8.x' installationPath: '$(ProgramFiles)\dotnet' ``` @@ -87,7 +103,7 @@ Or you can utilize a PowerShell task and run the following script. ```PowerShell Invoke-WebRequest https://dot.net/v1/dotnet-install.ps1 -OutFile dotnet-install.ps1 - .\dotnet-install.ps1 -Runtime dotnet -Architecture x64 -Version 6.0.13 -InstallDir $env:ProgramFiles\dotnet + .\dotnet-install.ps1 -Runtime dotnet -Architecture x64 -Version 8.0.14 -InstallDir $env:ProgramFiles\dotnet ``` > [!IMPORTANT] @@ -100,9 +116,9 @@ To execute the standalone exe, add another PowerShell task to download and run t .\wingetcreate.exe update -u $(packageUrls) -v $(manifestVersion) -t $(GITHUB_PAT) ``` -### Using the msixbundle: +### Using the msixbundle -Windows Server 2022 now supports App Execution Aliases, which means the alias `wingetcreate` can be used to run the tool after installing the msixbundle. The latest version of the msixbundle can be found at https://aka.ms/wingetcreate/latest/msixbundle. Similar to the standalone exe steps, download the msixbundle, add the package, and run `wingetcreate` to update your manifest. +Windows Server 2022 now supports App Execution Aliases, which means the alias `wingetcreate` can be used to run the tool after installing the msixbundle. The latest version of the msixbundle can be found at . Similar to the standalone exe steps, download the msixbundle, add the package, and run `wingetcreate` to update your manifest. > [!IMPORTANT] > Winget-Create has a dependency on the [C++ Runtime Desktop framework package](https://docs.microsoft.com/en-us/troubleshoot/developer/visualstudio/cpp/libraries/c-runtime-packages-desktop-bridge). Be sure to also download and install this package prior to installing wingetcreate as shown in the steps below. @@ -112,15 +128,8 @@ Windows Server 2022 now supports App Execution Aliases, which means the alias `w # Download and install C++ Runtime framework package. iwr https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx -OutFile $(vcLibsBundleFile) Add-AppxPackage $(vcLibsBundleFile) - - # Download Winget-Create msixbundle, install, and execute update. - iwr https://aka.ms/wingetcreate/latest/msixbundle -OutFile $(appxBundleFile) - Add-AppxPackage $(appxBundleFile) - wingetcreate update Microsoft.WingetCreate -u $(packageUrl) -v $(manifestVersion) -t $(GITHUB_PAT) --submit ``` -The CLI also supports creating or updating manifests with multiple installer URLs. You can either create new manifests with multiple installer nodes using the [New Command](doc/new.md) or update existing manifests with multiple installer URLs using the [Update Command](doc/update.md). - ## GitHub Personal Access Token (classic) Permissions When [creating your own GitHub Personal Access Token (PAT)](https://docs.github.com/en/github/authenticating-to-github/keeping-your-account-and-data-secure/creating-a-personal-access-token) to be used with WingetCreate, make sure the following permissions are selected. @@ -131,6 +140,11 @@ When [creating your own GitHub Personal Access Token (PAT)](https://docs.github. - (Optional) Select the **delete_repo** scope permission if you want WingetCreate to automatically delete the forked repo that it created if the PR submission fails. +> [!IMPORTANT] +> We currently do not support fine-grained GitHub tokens as we do not have the support for it yet from the GitHub APIs. See for more details. +> +> Since we only support classic personal access tokens, we recommend creating a separate bot account to be used in a CI/CD pipeline. Follow the same steps above to create a PAT for the bot account and use that token in your automated pipelines. + ## Building the client ### Prerequisites @@ -141,22 +155,22 @@ You can install the prerequisites in one of two ways: 1. Clone the repository 2. Configure your system - * Configure your system using the [configuration file](.config/configuration.winget). To run the configuration, use `winget configure .config/configuration.winget` from the project root or you can double-click the file directly from the file explorer. - * Alternatively, if you already are running the minimum OS version, have Visual Studio installed, and have developer mode enabled, you may configure your Visual Studio directly via the .vsconfig file. To do this: - * Open the Visual Studio Installer, select “More” on your product card and then "Import configuration" - * Specify the .vsconfig file at the root of the repo and select “Review Details” + - Configure your system using the [configuration file](.config/configuration.winget). To run the configuration, use `winget configure .config/configuration.winget` from the project root or you can double-click the file directly from the file explorer. + - Alternatively, if you already are running the minimum OS version, have Visual Studio installed, and have developer mode enabled, you may configure your Visual Studio directly via the .vsconfig file. To do this: + - Open the Visual Studio Installer, select “More” on your product card and then "Import configuration" + - Specify the .vsconfig file at the root of the repo and select “Review Details” #### Manual set up -* Windows 10 1709 (16299) or later -* [Developer mode enabled](https://docs.microsoft.com/windows/uwp/get-started/enable-your-device-for-development) (optional) -* [Visual Studio 2022](https://visualstudio.microsoft.com/downloads/) - * Or use winget to install it ;) (although you may need to adjust the workloads via Tools -> Get Tools and Features...) -* [Git Large File Storage (LFS)](https://git-lfs.github.com/) -* The following workloads: - * .NET Desktop Development - * Universal Windows Platform Development -* Windows 11 SDK (10.0.22000.0) (Tools -> Get Tools and Features -> Individual Components) +- Windows 10 1709 (16299) or later +- [Developer mode enabled](https://docs.microsoft.com/windows/uwp/get-started/enable-your-device-for-development) (optional) +- [Visual Studio 2022](https://visualstudio.microsoft.com/downloads/) + - Or use winget to install it ;) (although you may need to adjust the workloads via Tools -> Get Tools and Features...) +- [Git Large File Storage (LFS)](https://git-lfs.github.com/) +- The following workloads: + - .NET Desktop Development + - Universal Windows Platform Development +- Windows 11 SDK (10.0.22000.0) (Tools -> Get Tools and Features -> Individual Components) ### Building @@ -170,23 +184,23 @@ Running unit and E2E tests are a great way to ensure that functionality is prese ### Testing Prerequisites -* Fork the [winget-pkgs-submission-test repository](https://github.com/microsoft/winget-pkgs-submission-test) -* Fill out the test parameters in the `WingetCreateTests/Test.runsettings` file - * `WingetPkgsTestRepoOwner`: The repository owner of the winget-pkgs-submission-test repo. (Repo owner must be forked from main "winget-pkgs-submission-test" repo) - * `WingetPkgsTestRepo`: The winget-pkgs test repository. (winget-pkgs-submission-test) +- Fork the [winget-pkgs-submission-test repository](https://github.com/microsoft/winget-pkgs-submission-test) +- Fill out the test parameters in the `WingetCreateTests/Test.runsettings` file + - `WingetPkgsTestRepoOwner`: The repository owner of the winget-pkgs-submission-test repo. (Repo owner must be forked from main "winget-pkgs-submission-test" repo) + - `WingetPkgsTestRepo`: The winget-pkgs test repository. (winget-pkgs-submission-test) -* Set the solution wide runsettings file for the tests - * Go to `Test` menu > `Configure Run Settings` -> `Select Solution Wide runsettings File` -> Choose your configured runsettings file +- Set the solution wide runsettings file for the tests + - Go to `Test` menu > `Configure Run Settings` -> `Select Solution Wide runsettings File` -> Choose your configured runsettings file -* Set up your github token: - * __[Recommended]__ Run `wingetcreate token -s` to go through the Github authentication flow - * Or create a personal access token with the `repo` permission and set it as an environment variable `WINGET_CREATE_GITHUB_TOKEN`. _(This option is more convenient for CI/CD pipelines.)_ +- Set up your github token: + - **[Recommended]** Run `wingetcreate token -s` to go through the Github authentication flow + - Or create a personal access token with the `repo` permission and set it as an environment variable `WINGET_CREATE_GITHUB_TOKEN`. _(This option is more convenient for CI/CD pipelines.)_ ## Contributing This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us -the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com. More +the rights to use your contribution. For details, visit . More information is available in our [CONTRIBUTING.md](/CONTRIBUTING.md) file. When you submit a pull request, a CLA bot will automatically determine whether you need to provide diff --git a/pipelines/azure-pipelines.release.yml b/pipelines/azure-pipelines.release.yml index db49b3b3..68d94b98 100644 --- a/pipelines/azure-pipelines.release.yml +++ b/pipelines/azure-pipelines.release.yml @@ -221,40 +221,3 @@ extends: timeoutInMinutes: 1440 # task times out in 1 day inputs: instructions: "Please update aka.ms vanity URLs for latest release" - - - job: UpdateManifest - dependsOn: - - Build - - Wait - pool: - type: windows - - variables: - runCodesignValidationInjection: ${{ false }} - skipComponentGovernanceDetection: ${{ true }} - manifestVersion: $[dependencies.Build.outputs['OutputVersionStep.manifestVersion']] - appxBundleFile: $[dependencies.Build.outputs['OutputVersionStep.appxBundleFile']] - vcLibsBundleFile: "Microsoft.VCLibs.x64.14.00.Desktop.appx" - msixPackageUrl: "https://github.com/microsoft/winget-create/releases/download/v$(manifestVersion)/$(appxBundleFile)" - portablePackageUrl: "https://github.com/microsoft/winget-create/releases/download/v$(manifestVersion)/wingetcreate.exe" - ob_outputDirectory: $(Build.ArtifactStagingDirectory) - ob_git_checkout: false - - steps: - - task: PowerShell@2 - displayName: Update package manifest in the OWC - inputs: - targetType: inline - script: | - # These are the steps you would run in your CI/CD pipeline to update your OWC manifest using wingetcreate. - # More information about using wingetcreate in your CI/CD pipeline can be found here: - # https://github.com/microsoft/winget-create#using-windows-package-manager-manifest-creator-in-a-cicd-pipeline - - # Download and install C++ Runtime framework package. - iwr https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx -OutFile $(vcLibsBundleFile) - Add-AppxPackage $(vcLibsBundleFile) - - # Download, install, and execute update. - iwr https://aka.ms/wingetcreate/latest/msixbundle -OutFile $(appxBundleFile) - Add-AppxPackage $(appxBundleFile) - wingetcreate update Microsoft.WingetCreate --urls $(msixPackageUrl) '$(portablePackageUrl)|x64' '$(portablePackageUrl)|x86' -v $(manifestVersion) -t $(GITHUB_PAT) --submit