Skip to content

Commit d03db3f

Browse files
authored
Merge pull request #1 from talerlabs/chore/choco-release
Add automated Chocolatey publishing for document-stitcher CLI
2 parents 0bed602 + c255dae commit d03db3f

3 files changed

Lines changed: 56 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,3 +110,31 @@ jobs:
110110
done
111111
env:
112112
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
113+
114+
chocolatey:
115+
runs-on: windows-latest
116+
needs: create-release
117+
if: contains(github.event.inputs.tag, 'v') && !github.event.inputs.prerelease
118+
steps:
119+
- name: Checkout
120+
uses: actions/checkout@v4
121+
122+
- name: Download release asset
123+
run: |
124+
$release = Invoke-RestMethod -Uri "https://api.github.com/repos/${{ github.repository }}/releases/tags/${{ github.event.inputs.tag }}" -Headers @{Authorization="token ${{ secrets.GITHUB_TOKEN }}"}
125+
$asset = $release.assets | Where-Object { $_.name -eq 'document-stitcher.exe' }
126+
if ($asset) {
127+
Invoke-WebRequest -Uri $asset.browser_download_url -OutFile 'publishing/chocolatey/tools/document-stitcher.exe'
128+
} else {
129+
Write-Error "Asset not found"
130+
}
131+
132+
- name: Update nuspec version
133+
run: |
134+
(Get-Content publishing/chocolatey/document-stitcher.nuspec) -replace '\$version\$', '${{ github.event.inputs.tag }}'.TrimStart('v') | Set-Content publishing/chocolatey/document-stitcher.nuspec
135+
136+
- name: Pack Chocolatey package
137+
run: choco pack publishing/chocolatey/document-stitcher.nuspec --outputdirectory .
138+
139+
- name: Push to Chocolatey
140+
run: choco push document-stitcher.${{ github.event.inputs.tag }}.TrimStart('v').nupkg --source https://push.chocolatey.org/ --api-key ${{ secrets.CHOCOLATEY_API_KEY }}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
3+
<metadata>
4+
<id>document-stitcher</id>
5+
<version>$version$</version>
6+
<title>Document Stitcher</title>
7+
<authors>Taler Labs</authors>
8+
<description>Stitch together Markdown, images, and PDFs into a single printable PDF suitable for submissions, reports, and archives.</description>
9+
<projectUrl>https://github.com/talerlabs/document-stitcher-cli</projectUrl>
10+
<licenseUrl>https://github.com/talerlabs/document-stitcher-cli/blob/main/LICENSE</licenseUrl>
11+
<requireLicenseAcceptance>false</requireLicenseAcceptance>
12+
<tags>markdown pdf cli tool</tags>
13+
<releaseNotes>https://github.com/talerlabs/document-stitcher-cli/releases</releaseNotes>
14+
</metadata>
15+
<files>
16+
<file src="tools\**" target="tools" />
17+
</files>
18+
</package>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
$ErrorActionPreference = 'Stop'
2+
3+
$packageName = 'document-stitcher'
4+
$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"
5+
$exePath = Join-Path $toolsDir 'document-stitcher.exe'
6+
7+
# Since this is a portable app, just ensure the exe is executable
8+
# Chocolatey will automatically add the tools directory to PATH if it's a portable package
9+
10+
Write-Host "Document Stitcher has been installed. You can run it with 'document-stitcher' from the command line."

0 commit comments

Comments
 (0)