Skip to content
This repository was archived by the owner on Feb 6, 2026. It is now read-only.

Commit 6331ef2

Browse files
authored
feat: add Chocolatey package for Windows distribution (#74)
* feat: add Chocolatey package for Windows distribution Add Chocolatey package definition to enable Windows users to install via `choco install confluence-cli`. Package features: - Downloads from GitHub Releases (not embedded) - Native ARM64 detection with x64 fallback - Dynamic checksum verification from checksums.txt - Proper shimming (only cfl.exe, not LICENSE/README) Also adds packaging/ directory structure with Homebrew README pointing to GoReleaser config. Fixes #71 * ci: add workflow to test Chocolatey package on Windows * fix: use non-prerelease version in Chocolatey CI test * docs: add Chocolatey installation instructions to README * docs: remove Chocolatey from README until published
1 parent f945b27 commit 6331ef2

7 files changed

Lines changed: 304 additions & 0 deletions

File tree

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: Test Chocolatey Package
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- 'packaging/chocolatey/**'
7+
- '.github/workflows/test-chocolatey.yml'
8+
push:
9+
branches: [main]
10+
paths:
11+
- 'packaging/chocolatey/**'
12+
- '.github/workflows/test-chocolatey.yml'
13+
14+
jobs:
15+
test-chocolatey:
16+
runs-on: windows-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Set up Go
21+
uses: actions/setup-go@v5
22+
with:
23+
go-version: '1.22'
24+
25+
- name: Build binary for testing
26+
run: go build -o packaging/chocolatey/tools/cfl.exe ./cmd/cfl
27+
28+
- name: Prepare test package
29+
shell: pwsh
30+
working-directory: packaging/chocolatey
31+
run: |
32+
# Replace placeholder version with test version (must not be prerelease)
33+
(Get-Content confluence-cli.nuspec) `
34+
-replace '<version>0.0.0</version>', '<version>0.0.1</version>' |
35+
Set-Content confluence-cli.nuspec
36+
37+
# Create a simple install script that uses the local binary
38+
# (the real script downloads from GitHub, but we test structure here)
39+
@'
40+
$ErrorActionPreference = 'Stop'
41+
$toolsDir = Split-Path -Parent $MyInvocation.MyCommand.Definition
42+
43+
# Binary is already in tools/ from CI build
44+
Write-Host "confluence-cli installed from local build for testing"
45+
46+
# Exclude non-executables from shimming
47+
New-Item "$toolsDir\LICENSE.ignore" -Type File -Force | Out-Null
48+
New-Item "$toolsDir\README.md.ignore" -Type File -Force | Out-Null
49+
'@ | Set-Content tools/chocolateyInstall.ps1
50+
51+
- name: Pack Chocolatey package
52+
shell: pwsh
53+
working-directory: packaging/chocolatey
54+
run: choco pack
55+
56+
- name: Install package locally
57+
shell: pwsh
58+
working-directory: packaging/chocolatey
59+
run: choco install confluence-cli -dv -s . --force
60+
61+
- name: Verify installation
62+
shell: pwsh
63+
run: |
64+
Write-Host "Testing cfl --version..."
65+
cfl --version
66+
if ($LASTEXITCODE -ne 0) {
67+
Write-Error "cfl --version failed"
68+
exit 1
69+
}
70+
Write-Host "cfl is working!"
71+
72+
- name: Test uninstall
73+
shell: pwsh
74+
run: |
75+
choco uninstall confluence-cli -y
76+
77+
# Verify cfl is no longer available
78+
$cflPath = Get-Command cfl -ErrorAction SilentlyContinue
79+
if ($cflPath) {
80+
Write-Error "cfl should not be available after uninstall"
81+
exit 1
82+
}
83+
Write-Host "Uninstall successful!"

CLAUDE.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,3 +191,21 @@ Releases are automated via release-please. When PRs merge to main with conventio
191191
**Before merging a PR:** Run `/release-notes` to generate release notes and update the PR description.
192192

193193
**After merging:** release-please creates a Release PR. Merging that PR triggers the full release (GitHub Release + Homebrew tap update).
194+
195+
## Packaging
196+
197+
Distribution packages are in `packaging/`:
198+
199+
```
200+
packaging/
201+
├── chocolatey/ # Windows Chocolatey package
202+
│ ├── confluence-cli.nuspec
203+
│ ├── tools/chocolateyInstall.ps1
204+
│ ├── tools/chocolateyUninstall.ps1
205+
│ └── README.md # Publishing instructions
206+
└── homebrew/
207+
└── README.md # Points to GoReleaser config
208+
```
209+
210+
- **Homebrew**: Managed by GoReleaser, published to [open-cli-collective/homebrew-tap](https://github.com/open-cli-collective/homebrew-tap)
211+
- **Chocolatey**: Manual publish process documented in `packaging/chocolatey/README.md`

packaging/chocolatey/README.md

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# Chocolatey Package for confluence-cli
2+
3+
This directory contains the Chocolatey package definition for distributing confluence-cli on Windows.
4+
5+
## Package Structure
6+
7+
```
8+
packaging/chocolatey/
9+
├── confluence-cli.nuspec # Package manifest
10+
├── tools/
11+
│ ├── chocolateyInstall.ps1 # Downloads and installs from GitHub Releases
12+
│ └── chocolateyUninstall.ps1 # Cleanup script
13+
└── README.md
14+
```
15+
16+
## Local Testing
17+
18+
### Prerequisites
19+
20+
- Windows with [Chocolatey installed](https://chocolatey.org/install)
21+
- PowerShell (Admin)
22+
23+
### Build the Package
24+
25+
```powershell
26+
cd packaging/chocolatey
27+
28+
# Update version in nuspec to match a real release (e.g., 0.10.0)
29+
# Then pack:
30+
choco pack
31+
```
32+
33+
This creates `confluence-cli.<version>.nupkg`.
34+
35+
### Install Locally
36+
37+
```powershell
38+
# Install from local package
39+
choco install confluence-cli -s . --force
40+
41+
# Verify
42+
cfl --version
43+
44+
# Uninstall
45+
choco uninstall confluence-cli
46+
```
47+
48+
## Publishing to Chocolatey Community Repository
49+
50+
### First-Time Setup
51+
52+
1. Create an account at https://community.chocolatey.org
53+
2. Get your API key from https://community.chocolatey.org/account
54+
3. Configure your API key:
55+
```powershell
56+
choco apikey --key <your-api-key> --source https://push.chocolatey.org/
57+
```
58+
59+
### Publishing a New Version
60+
61+
1. Update the `<version>` in `confluence-cli.nuspec` to match the GitHub release
62+
2. Pack the package:
63+
```powershell
64+
choco pack
65+
```
66+
3. Push to Chocolatey:
67+
```powershell
68+
choco push confluence-cli.<version>.nupkg --source https://push.chocolatey.org/
69+
```
70+
71+
### Moderation Process
72+
73+
- New packages go through moderation (typically 1-3 days)
74+
- Automated checks verify the package downloads correctly
75+
- Human moderators review the package
76+
- Status updates are sent via email
77+
78+
## Architecture Support
79+
80+
The install script automatically detects Windows architecture:
81+
82+
| Architecture | Download |
83+
|--------------|----------|
84+
| ARM64 | `cfl_<version>_windows_arm64.zip` |
85+
| x64 | `cfl_<version>_windows_amd64.zip` |
86+
| x86 | Not supported (error) |
87+
88+
## Updating for New Releases
89+
90+
When a new version is released on GitHub:
91+
92+
1. Update `<version>` in `confluence-cli.nuspec`
93+
2. Test locally with `choco pack && choco install confluence-cli -s . --force`
94+
3. Push to Chocolatey with `choco push`
95+
96+
The install script dynamically fetches checksums from `checksums.txt` in the GitHub release, so no checksum updates are needed in the package files.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
3+
<metadata>
4+
<id>confluence-cli</id>
5+
<version>0.0.0</version>
6+
<title>Confluence CLI</title>
7+
<authors>Open CLI Collective</authors>
8+
<owners>rianjs</owners>
9+
<licenseUrl>https://github.com/open-cli-collective/confluence-cli/blob/main/LICENSE</licenseUrl>
10+
<projectUrl>https://github.com/open-cli-collective/confluence-cli</projectUrl>
11+
<projectSourceUrl>https://github.com/open-cli-collective/confluence-cli</projectSourceUrl>
12+
<packageSourceUrl>https://github.com/open-cli-collective/confluence-cli/tree/main/packaging/chocolatey</packageSourceUrl>
13+
<bugTrackerUrl>https://github.com/open-cli-collective/confluence-cli/issues</bugTrackerUrl>
14+
<requireLicenseAcceptance>false</requireLicenseAcceptance>
15+
<description>A command-line interface for Atlassian Confluence Cloud. Provides markdown-first page management with automatic conversion between Markdown and Confluence's storage format.
16+
17+
Features:
18+
- Create, edit, view, and delete Confluence pages
19+
- Bidirectional Markdown to Confluence HTML conversion
20+
- Attachment management (upload, download, list)
21+
- Space listing and search
22+
- Support for Confluence macros (TOC, panels, expand)
23+
24+
Binary: cfl.exe</description>
25+
<summary>Command-line interface for Atlassian Confluence Cloud</summary>
26+
<releaseNotes>https://github.com/open-cli-collective/confluence-cli/releases</releaseNotes>
27+
<tags>confluence atlassian cli markdown wiki documentation</tags>
28+
</metadata>
29+
<files>
30+
<file src="tools\**" target="tools" />
31+
</files>
32+
</package>
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
$ErrorActionPreference = 'Stop'
2+
3+
$version = $env:ChocolateyPackageVersion
4+
$toolsDir = Split-Path -Parent $MyInvocation.MyCommand.Definition
5+
6+
# Architecture detection with ARM64 support
7+
if ($env:PROCESSOR_ARCHITECTURE -eq 'ARM64') {
8+
$arch = 'arm64'
9+
} elseif ([Environment]::Is64BitOperatingSystem) {
10+
$arch = 'amd64'
11+
} else {
12+
throw "32-bit Windows is not supported. confluence-cli requires 64-bit Windows."
13+
}
14+
15+
$baseUrl = "https://github.com/open-cli-collective/confluence-cli/releases/download/v${version}"
16+
$zipFile = "cfl_${version}_windows_${arch}.zip"
17+
$url = "${baseUrl}/${zipFile}"
18+
$checksumsUrl = "${baseUrl}/checksums.txt"
19+
20+
# Fetch checksums and extract the one for our architecture
21+
$checksums = (Invoke-WebRequest -Uri $checksumsUrl -UseBasicParsing).Content
22+
$checksumLine = $checksums -split "`n" | Where-Object { $_ -match $zipFile }
23+
if (-not $checksumLine) {
24+
throw "Could not find checksum for ${zipFile} in checksums.txt"
25+
}
26+
$checksum = ($checksumLine -split '\s+')[0]
27+
28+
Write-Host "Installing confluence-cli ${version} for Windows ${arch}..."
29+
Write-Host "URL: ${url}"
30+
Write-Host "Checksum (SHA256): ${checksum}"
31+
32+
Install-ChocolateyZipPackage -PackageName $env:ChocolateyPackageName `
33+
-Url $url `
34+
-UnzipLocation $toolsDir `
35+
-Checksum $checksum `
36+
-ChecksumType 'sha256'
37+
38+
# Exclude non-executables from shimming
39+
# Chocolatey auto-creates shims for .exe files; .ignore files prevent shimming other files
40+
New-Item "$toolsDir\LICENSE.ignore" -Type File -Force | Out-Null
41+
New-Item "$toolsDir\README.md.ignore" -Type File -Force | Out-Null
42+
43+
Write-Host "confluence-cli installed successfully. Run 'cfl --help' to get started."
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
$ErrorActionPreference = 'Stop'
2+
3+
$toolsDir = Split-Path -Parent $MyInvocation.MyCommand.Definition
4+
5+
Write-Host "Uninstalling confluence-cli..."
6+
7+
# Remove extracted files
8+
Remove-Item "$toolsDir\cfl.exe" -Force -ErrorAction SilentlyContinue
9+
Remove-Item "$toolsDir\LICENSE" -Force -ErrorAction SilentlyContinue
10+
Remove-Item "$toolsDir\README.md" -Force -ErrorAction SilentlyContinue
11+
12+
# Remove .ignore files created during install
13+
Remove-Item "$toolsDir\*.ignore" -Force -ErrorAction SilentlyContinue
14+
15+
Write-Host "confluence-cli has been uninstalled."

packaging/homebrew/README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Homebrew Distribution
2+
3+
Homebrew packaging is managed automatically by [GoReleaser](https://goreleaser.com/) during the release process.
4+
5+
## Configuration
6+
7+
The Homebrew cask configuration lives in [`.goreleaser.yml`](../../.goreleaser.yml) under the `homebrew_casks` section.
8+
9+
## Tap Repository
10+
11+
The generated cask is published to: https://github.com/open-cli-collective/homebrew-tap
12+
13+
## Installation
14+
15+
```bash
16+
brew install open-cli-collective/tap/cfl
17+
```

0 commit comments

Comments
 (0)