The most comfortable way to install software on Windows is thorugh Chocolatey ๐ซ And in this guide you will learn how to do that! ๐คฉ At least for simple executables ๐ฃ
I successfully published my Rust app vidmerger in that way! ๐โจ
๐ฃ Initializing
First of all install the cli-tool for Chocolatey:
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
Then run choco new my-app
to generate a folder called my-app
with the following content:
my-app
โโโ ReadMe.md
โโโ _TODO.txt
โโโ my-app.nuspec
โโโ tools
โโโ LICENSE.txt
โโโ VERIFICATION.txt
โโโ chocolateybeforemodify.ps1
โโโ chocolateyinstall.ps1
โโโ chocolateyuninstall.ps1
The minimal setup for publishing would look like:
my-app
โโโ my-app.nuspec
โโโ tools
โโโ LICENSE.txt
โโโ VERIFICATION.txt
The *.ps1
files are basically for defining shell commands which run on beforemodify
, install
and uninstall
. We don't really need them for publishing a simple executable.
Put your *.exe
file from Rust or whatever into the tools
folder ๐ฆ
โ๏ธ Modifying
I think I'll just show you here my three modified files from my Rust app vidmerger, modify them accordingly ๐
๐ด my-app.nuspec
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
<metadata>
<id>vidmerger</id>
<version>0.1.2</version>
<title>vidmerger</title>
<authors>Thomas Gotwig</authors>
<projectUrl>https://github.com/tgotwig/vidmerger</projectUrl>
<tags>video cli</tags>
<summary>A wrapper around ffmpeg which simplifies merging multiple videos ๐</summary>
<description>Vidmerger is a command-line-tool which uses `ffmpeg` to merge multiple video-files with the same file-extension together into one file called `output.FORMAT`. It includes a usage help which you can print out by `vidmerger --help` ๐</description>
</metadata>
<files>
<file src="tools\**" target="tools" />
</files>
</package>
๐ด LICENSE.txt
Copyright 2020 Thomas Gotwig
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
๐ด VERIFICATION.txt
Generated by `CertUtil -hashfile vidmerger.exe SHA256`:
1268967539be0449126438887170c779aaea6fdbf4d835e529c77d4c56a7f75d
Think on updating the hash inside of VERIFICATION.txt
before pushing ๐ง
๐ Pushing
Before you can push something, you'll need to login on your choco-cli first, to do so, go on https://chocolatey.org/account
, do a login there and click on Show API Key
, run that listed commands in your console.
Finally lets push it to Chocolatey! ๐
choco pack
Get-ChildItem *.nupkg | ren -NewName vidmerger.nupkg
choco push vidmerger.nupkg --source https://push.chocolatey.org
Remove-Item vidmerger.nupkg
That's all! ๐๐ซ
Top comments (0)