diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9e342c5..c6e7054 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -110,3 +110,31 @@ jobs: done env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + chocolatey: + runs-on: windows-latest + needs: create-release + if: contains(github.event.inputs.tag, 'v') && !github.event.inputs.prerelease + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Download release asset + run: | + $release = Invoke-RestMethod -Uri "https://api.github.com/repos/${{ github.repository }}/releases/tags/${{ github.event.inputs.tag }}" -Headers @{Authorization="token ${{ secrets.GITHUB_TOKEN }}"} + $asset = $release.assets | Where-Object { $_.name -eq 'document-stitcher.exe' } + if ($asset) { + Invoke-WebRequest -Uri $asset.browser_download_url -OutFile 'publishing/chocolatey/tools/document-stitcher.exe' + } else { + Write-Error "Asset not found" + } + + - name: Update nuspec version + run: | + (Get-Content publishing/chocolatey/document-stitcher.nuspec) -replace '\$version\$', '${{ github.event.inputs.tag }}'.TrimStart('v') | Set-Content publishing/chocolatey/document-stitcher.nuspec + + - name: Pack Chocolatey package + run: choco pack publishing/chocolatey/document-stitcher.nuspec --outputdirectory . + + - name: Push to Chocolatey + run: choco push document-stitcher.${{ github.event.inputs.tag }}.TrimStart('v').nupkg --source https://push.chocolatey.org/ --api-key ${{ secrets.CHOCOLATEY_API_KEY }} diff --git a/publishing/chocolatey/document-stitcher.nuspec b/publishing/chocolatey/document-stitcher.nuspec new file mode 100644 index 0000000..e08db32 --- /dev/null +++ b/publishing/chocolatey/document-stitcher.nuspec @@ -0,0 +1,18 @@ + + + + document-stitcher + $version$ + Document Stitcher + Taler Labs + Stitch together Markdown, images, and PDFs into a single printable PDF suitable for submissions, reports, and archives. + https://github.com/talerlabs/document-stitcher-cli + https://github.com/talerlabs/document-stitcher-cli/blob/main/LICENSE + false + markdown pdf cli tool + https://github.com/talerlabs/document-stitcher-cli/releases + + + + + \ No newline at end of file diff --git a/publishing/chocolatey/tools/chocolateyinstall.ps1 b/publishing/chocolatey/tools/chocolateyinstall.ps1 new file mode 100644 index 0000000..215480c --- /dev/null +++ b/publishing/chocolatey/tools/chocolateyinstall.ps1 @@ -0,0 +1,10 @@ +$ErrorActionPreference = 'Stop' + +$packageName = 'document-stitcher' +$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)" +$exePath = Join-Path $toolsDir 'document-stitcher.exe' + +# Since this is a portable app, just ensure the exe is executable +# Chocolatey will automatically add the tools directory to PATH if it's a portable package + +Write-Host "Document Stitcher has been installed. You can run it with 'document-stitcher' from the command line." \ No newline at end of file