6.3 KiB
6.3 KiB
Package Distribution Guide
This document explains how to distribute kfmtbox through various package managers and platforms.
📦 Package Managers
1. Homebrew (macOS/Linux)
Option A: Personal Tap (Recommended for initial release)
- Create a personal tap repository:
koftwentytwo/homebrew-kfmtbox - Add the formula from
Formula/kfmtbox.rbto your tap - Users can install with:
brew tap koftwentytwo/kfmtbox brew install kfmtbox
Option B: Homebrew Core (For wider distribution)
- Submit a PR to homebrew-core
- Follow the Homebrew formula guidelines
- Requirements:
- At least 20 stars on GitHub
- At least 3 months old
- Stable API
- No dependencies on non-free software
2. Cargo (Rust)
Prerequisites
- Create account on crates.io
- Get API token from account settings
- Add token to GitHub secrets as
CARGO_REGISTRY_TOKEN
Publishing
# Login to crates.io
cargo login
# Publish (done automatically via GitHub Actions)
cargo publish
3. Arch Linux (AUR)
Create a PKGBUILD file:
# Create AUR package
git clone ssh://aur@aur.archlinux.org/kfmtbox.git
cd kfmtbox
# Add PKGBUILD (see below)
git add PKGBUILD .SRCINFO
git commit -m "Initial release"
git push
PKGBUILD template:
pkgname=kfmtbox
pkgver=0.1.0
pkgrel=1
pkgdesc="A Rust-based command-line utility that wraps text in flower box style comments"
arch=('x86_64')
url="https://github.com/koftwentytwo/kfmtbox"
license=('MIT')
depends=('glibc')
makedepends=('cargo' 'git')
source=("$pkgname-$pkgver.tar.gz::https://github.com/koftwentytwo/kfmtbox/archive/v$pkgver.tar.gz")
sha256sums=('SKIP')
build() {
cd "$pkgname-$pkgver"
cargo build --release --locked
}
package() {
cd "$pkgname-$pkgver"
install -Dm755 "target/release/$pkgname" "$pkgdir/usr/bin/$pkgname"
install -Dm644 "README.md" "$pkgdir/usr/share/doc/$pkgname/README.md"
install -Dm644 "LICENSE" "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}
4. Debian/Ubuntu (PPA)
Prerequisites
- Create Launchpad account
- Set up PPA
- Install packaging tools:
sudo apt install devscripts debhelper
Creating Debian Package
# Create package structure
mkdir kfmtbox-0.1.0
cd kfmtbox-0.1.0
# Copy source files
cp -r ../src .
cp ../Cargo.toml ../Cargo.lock .
# Create debian directory
mkdir debian
# Add control file, rules, etc.
# (See Debian packaging documentation)
5. Windows (Chocolatey)
Prerequisites
- Create Chocolatey account
- Install Chocolatey package validator
Package Structure
kfmtbox/
├── kfmtbox.nuspec
├── tools/
│ ├── chocolateyinstall.ps1
│ └── chocolateyuninstall.ps1
└── legal/
└── LICENSE.txt
kfmtbox.nuspec:
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
<metadata>
<id>kfmtbox</id>
<version>0.1.0</version>
<title>kfmtbox</title>
<authors>James Maes</authors>
<description>A Rust-based command-line utility that wraps text in flower box style comments</description>
<licenseUrl>https://github.com/koftwentytwo/kfmtbox/blob/main/LICENSE</licenseUrl>
<projectUrl>https://github.com/koftwentytwo/kfmtbox</projectUrl>
<tags>cli formatting comments text-processing</tags>
</metadata>
<files>
<file src="tools\**" target="tools" />
<file src="legal\**" target="legal" />
</files>
</package>
6. Snap (Ubuntu/Snap Store)
Prerequisites
- Create Snapcraft account
- Install snapcraft:
sudo snap install snapcraft --classic
snapcraft.yaml
name: kfmtbox
version: '0.1.0'
summary: A Rust-based command-line utility that wraps text in flower box style comments
description: |
Transform your plain text into beautiful, decorative comment boxes that automatically
adapt to your programming language's comment syntax.
grade: stable
confinement: strict
parts:
kfmtbox:
plugin: rust
source: .
build-packages:
- gcc
- pkg-config
- libssl-dev
apps:
kfmtbox:
command: kfmtbox
plugs:
- home
🚀 Release Process
1. Automated Releases (GitHub Actions)
The project includes automated release workflows that:
-
Build binaries for multiple platforms:
- Linux (x86_64, musl)
- macOS (x86_64, ARM64)
- Windows (x86_64, MSVC and GNU)
-
Publish to crates.io (when
CARGO_REGISTRY_TOKENis set) -
Create GitHub releases with downloadable binaries
2. Manual Release Steps
- Update version in
Cargo.toml - Create git tag:
git tag v0.1.0 - Push tag:
git push origin v0.1.0 - GitHub Actions will automatically:
- Build and test
- Create release
- Upload binaries
- Publish to crates.io (if configured)
3. Package Manager Updates
After each release, update package managers:
- Homebrew: Update formula with new version and SHA
- AUR: Update PKGBUILD with new version
- Snap: Update snapcraft.yaml version
- Chocolatey: Update nuspec version
📋 Checklist for New Release
- Update version in
Cargo.toml - Update
CHANGELOG.md - Create and push git tag
- Verify GitHub Actions release
- Update Homebrew formula (if using personal tap)
- Update AUR package
- Update other package managers
- Test installation from all package managers
- Update documentation
🔧 Troubleshooting
Common Issues
- Homebrew formula fails: Check SHA256 hash and URL
- Cargo publish fails: Verify API token and package name availability
- AUR package rejected: Check PKGBUILD syntax and dependencies
- Snap build fails: Verify snapcraft.yaml syntax
Getting Help
📊 Distribution Statistics
Track your package downloads and usage:
- Crates.io: crates.io/crates/kfmtbox
- Homebrew:
brew info kfmtbox - GitHub: Release download statistics
- AUR: AUR package page statistics