ci: Created test GHA workflow to rest releasing Managarr to Chocolatey [skip ci]
This commit is contained in:
@@ -0,0 +1,56 @@
|
|||||||
|
name: Test release Managarr to Chocolatey
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
pull-requests: write
|
||||||
|
contents: write
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
publish-chocolatey-package:
|
||||||
|
needs: [publish-github-release]
|
||||||
|
name: Publish Chocolatey Package
|
||||||
|
runs-on: windows-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 1
|
||||||
|
|
||||||
|
- name: Get release artifacts
|
||||||
|
uses: actions/download-artifact@v4.1.7
|
||||||
|
with:
|
||||||
|
name: artifacts
|
||||||
|
path: artifacts
|
||||||
|
|
||||||
|
- name: Set release assets and version
|
||||||
|
shell: pwsh
|
||||||
|
run: |
|
||||||
|
# Read the first column from the SHA256 file
|
||||||
|
$windows_sha = Get-Content ./artifacts/managarr-windows.sha256 | ForEach-Object { $_.Split(' ')[0] }
|
||||||
|
Add-Content -Path $env:GITHUB_ENV -Value "WINDOWS_SHA=$windows_sha"
|
||||||
|
|
||||||
|
# Read the release version from the release-version file
|
||||||
|
$release_version = Get-Content ./artifacts/release-version
|
||||||
|
Add-Content -Path $env:GITHUB_ENV -Value "RELEASE_VERSION=$release_version"
|
||||||
|
|
||||||
|
- name: Validate release environment variables
|
||||||
|
run: |
|
||||||
|
echo "Release SHA windows: ${{ env.WINDOWS_SHA }}"
|
||||||
|
echo "Release version: ${{ env.RELEASE_VERSION }}"
|
||||||
|
|
||||||
|
- name: Package and Publish package to Chocolatey
|
||||||
|
run: |
|
||||||
|
mkdir ./deployment/chocolatey/tools
|
||||||
|
# Run packaging script
|
||||||
|
python "./deployment/chocolatey/packager.py" ${{ env.RELEASE_VERSION }} "./deployment/chocolatey/managarr.nuspec.template" "./deployment/chocolatey/managarr.nuspec" ${{ env.WINDOWS_SHA }}
|
||||||
|
python "./deployment/chocolatey/packager.py" ${{ env.RELEASE_VERSION }} "./deployment/chocolatey/chocolateyinstall.ps1.template" "./deployment/chocolatey/tools/chocolateyinstall.ps1" ${{ env.WINDOWS_SHA }}
|
||||||
|
|
||||||
|
# Publish to Chocolatey
|
||||||
|
cd ./deployment/chocolatey
|
||||||
|
choco pack
|
||||||
|
echo y | choco install managarr -dv -s .
|
||||||
|
$version = managarr --version
|
||||||
|
$version = $version -replace " ", "."
|
||||||
|
choco push $version.nupkg -s https://push.chocolatey.org/ --api-key ${{ secrets.CHOCOLATEY_API_KEY }};
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
$ErrorActionPreference = 'Stop';
|
||||||
|
|
||||||
|
$PackageName = 'kdash'
|
||||||
|
$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"
|
||||||
|
$url64 = 'https://github.com/Dark-Alex-17/managarr/releases/download/v$version/managarr-windows.tar.gz'
|
||||||
|
$checksum64 = '$hash_64'
|
||||||
|
|
||||||
|
$packageArgs = @{
|
||||||
|
packageName = $packageName
|
||||||
|
softwareName = $packageName
|
||||||
|
unzipLocation = $toolsDir
|
||||||
|
fileType = 'exe'
|
||||||
|
url = $url64
|
||||||
|
checksum = $checksum64
|
||||||
|
checksumType = 'sha256'
|
||||||
|
|
||||||
|
}
|
||||||
|
Install-ChocolateyZipPackage @packageArgs
|
||||||
|
$File = Get-ChildItem -File -Path $env:ChocolateyInstall\lib\$packageName\tools\ -Filter *.tar
|
||||||
|
Get-ChocolateyUnzip -fileFullPath $File.FullName -destination $env:ChocolateyInstall\lib\$packageName\tools\
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Read this before creating packages: https://chocolatey.org/docs/create-packages -->
|
||||||
|
<!-- It is especially important to read the above link to understand additional requirements when publishing packages to the community feed aka dot org (https://chocolatey.org/packages). -->
|
||||||
|
|
||||||
|
<!-- Test your packages in a test environment: https://github.com/chocolatey/chocolatey-test-environment -->
|
||||||
|
|
||||||
|
<!--
|
||||||
|
This is a nuspec. It mostly adheres to https://docs.nuget.org/create/Nuspec-Reference. Chocolatey uses a special version of NuGet.Core that allows us to do more than was initially possible. As such there are certain things to be aware of:
|
||||||
|
|
||||||
|
* the package xmlns schema url may cause issues with nuget.exe
|
||||||
|
* Any of the following elements can ONLY be used by choco tools - projectSourceUrl, docsUrl, mailingListUrl, bugTrackerUrl, packageSourceUrl, provides, conflicts, replaces
|
||||||
|
* nuget.exe can still install packages with those elements but they are ignored. Any authoring tools or commands will error on those elements
|
||||||
|
-->
|
||||||
|
|
||||||
|
<!-- You can embed software files directly into packages, as long as you are not bound by distribution rights. -->
|
||||||
|
<!-- * If you are an organization making private packages, you probably have no issues here -->
|
||||||
|
<!-- * If you are releasing to the community feed, you need to consider distribution rights. -->
|
||||||
|
<!-- Do not remove this test for UTF-8: if “Ω” doesn’t appear as greek uppercase omega letter enclosed in quotation marks, you should use an editor that supports UTF-8, not this one. -->
|
||||||
|
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
|
||||||
|
<metadata>
|
||||||
|
<!-- == PACKAGE SPECIFIC SECTION == -->
|
||||||
|
<id>managarr</id>
|
||||||
|
<version>$version</version>
|
||||||
|
|
||||||
|
<!-- == SOFTWARE SPECIFIC SECTION == -->
|
||||||
|
<!-- This section is about the software itself -->
|
||||||
|
<title>Managarr</title>
|
||||||
|
<authors>Alex Clarke</authors>
|
||||||
|
<projectUrl>https://github.com/Dark-Alex-17/managarr</projectUrl>
|
||||||
|
<licenseUrl>https://github.com/Dark-Alex-17/managarr/blob/main/LICENSE</licenseUrl>
|
||||||
|
<requireLicenseAcceptance>true</requireLicenseAcceptance>
|
||||||
|
<projectSourceUrl>https://github.com/Dark-Alex-17/managarr</projectSourceUrl>
|
||||||
|
<docsUrl>https://github.com/Dark-Alex-17/managarr/blob/main/README.md</docsUrl>
|
||||||
|
<bugTrackerUrl>https://github.com/Dark-Alex-17/managarr/issues</bugTrackerUrl>
|
||||||
|
<tags>cli cross-platform terminal servarr tui sonarr radarr rust</tags>
|
||||||
|
<summary>A TUI and CLI for managing *arr servers.</summary>
|
||||||
|
<description>
|
||||||
|
A TUI and CLI for managing *arr servers. Build with love in Rust!
|
||||||
|
|
||||||
|
**Usage**
|
||||||
|
To use, run `managarr` in a terminal.
|
||||||
|
|
||||||
|
For more [documentation and usage](https://github.com/Dark-Alex-17/managarr/blob/main/README.md), see the [official repo](https://github.com/Dark-Alex-17/managarr).
|
||||||
|
|
||||||
|
</description>
|
||||||
|
<releaseNotes>https://github.com/Dark-Alex-17/managarr/releases/tag/v$version/</releaseNotes>
|
||||||
|
</metadata>
|
||||||
|
<files>
|
||||||
|
<!-- this section controls what actually gets packaged into the Chocolatey package -->
|
||||||
|
<file src="tools\**" target="tools" />
|
||||||
|
<!--Building from Linux? You may need this instead: <file src="tools/**" target="tools" />-->
|
||||||
|
</files>
|
||||||
|
</package>
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
import hashlib
|
||||||
|
import sys
|
||||||
|
from string import Template
|
||||||
|
|
||||||
|
args = sys.argv
|
||||||
|
version = args[1].replace("v", "")
|
||||||
|
template_file_path = args[2]
|
||||||
|
generated_file_path = args[3]
|
||||||
|
|
||||||
|
# Deployment files
|
||||||
|
hash_64 = args[4].strip()
|
||||||
|
|
||||||
|
print("Generating formula")
|
||||||
|
print(" VERSION: %s" % version)
|
||||||
|
print(" TEMPLATE PATH: %s" % template_file_path)
|
||||||
|
print(" SAVING AT: %s" % generated_file_path)
|
||||||
|
print(" HASH: %s" % hash_64)
|
||||||
|
|
||||||
|
with open(template_file_path, "r") as template_file:
|
||||||
|
template = Template(template_file.read())
|
||||||
|
substitute = template.safe_substitute(version=version, hash_64=hash_64)
|
||||||
|
print("\n================== Generated package file ==================\n")
|
||||||
|
print(substitute)
|
||||||
|
print("\n============================================================\n")
|
||||||
|
|
||||||
|
with open(generated_file_path, "w") as generated_file:
|
||||||
|
generated_file.write(substitute)
|
||||||
Reference in New Issue
Block a user