From 1d03204216aed5d564dd2da115d2fe97652b33e9 Mon Sep 17 00:00:00 2001 From: Felipe Pires Morandini Date: Wed, 18 Mar 2026 16:39:24 -0300 Subject: [PATCH] ci: add AUR automation to release workflow Add update-aur job to release.yml that automatically updates the smartlog-bin AUR package on each release. The job downloads release assets, computes SHA256 checksums, updates the PKGBUILD, generates .SRCINFO, and pushes to AUR via SSH. Hardened with pinned host key (ssh-keyscan), printf for SSH key, curl --fail with retries, and set -euo pipefail. Also bumps PKGBUILD version from 0.5.0 to 0.6.0 and updates ROADMAP to reflect AUR submission and automation are complete. --- .github/workflows/release.yml | 98 +++++++++++++++++++++++++++++++++++ ROADMAP.md | 95 +++++++++++++++++---------------- packaging/aur/PKGBUILD | 2 +- 3 files changed, 146 insertions(+), 49 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 35365ef..a30e0c4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -211,6 +211,104 @@ jobs: - name: Publish to crates.io run: cargo publish --token ${{ secrets.CARGO_REGISTRY_TOKEN }} + update-aur: + name: Update AUR package + needs: release + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Configure SSH for AUR + run: | + mkdir -p ~/.ssh + chmod 700 ~/.ssh + printf '%s\n' "${{ secrets.AUR_SSH_KEY }}" > ~/.ssh/aur + chmod 600 ~/.ssh/aur + ssh-keyscan -t ed25519 aur.archlinux.org >> ~/.ssh/known_hosts 2>/dev/null + cat >> ~/.ssh/config << 'EOF' + Host aur.archlinux.org + IdentityFile ~/.ssh/aur + User aur + StrictHostKeyChecking yes + EOF + chmod 600 ~/.ssh/config + + - name: Download release assets and compute SHA256 + shell: bash + run: | + set -euo pipefail + VERSION="${GITHUB_REF_NAME#v}" + TAG="${GITHUB_REF_NAME}" + BASE="https://github.com/felipemorandini/smartlog/releases/download/${TAG}" + + curl -fSL --retry 3 "${BASE}/smartlog-x86_64-unknown-linux-musl.tar.gz" -o x86_64.tar.gz + curl -fSL --retry 3 "${BASE}/smartlog-aarch64-unknown-linux-musl.tar.gz" -o aarch64.tar.gz + curl -fSL --retry 3 "https://raw.githubusercontent.com/felipemorandini/smartlog/${TAG}/LICENSE" -o LICENSE + + SHA_X86_64=$(sha256sum x86_64.tar.gz | cut -d' ' -f1) + SHA_AARCH64=$(sha256sum aarch64.tar.gz | cut -d' ' -f1) + SHA_LICENSE=$(sha256sum LICENSE | cut -d' ' -f1) + + echo "VERSION=${VERSION}" >> "$GITHUB_ENV" + echo "SHA_X86_64=${SHA_X86_64}" >> "$GITHUB_ENV" + echo "SHA_AARCH64=${SHA_AARCH64}" >> "$GITHUB_ENV" + echo "SHA_LICENSE=${SHA_LICENSE}" >> "$GITHUB_ENV" + + - name: Clone AUR repo and update PKGBUILD + run: | + git clone ssh://aur@aur.archlinux.org/smartlog-bin.git aur-repo + cp packaging/aur/PKGBUILD aur-repo/PKGBUILD + + cd aur-repo + + # Update version + sed -i "s/^pkgver=.*/pkgver=${VERSION}/" PKGBUILD + sed -i "s/^pkgrel=.*/pkgrel=1/" PKGBUILD + + # Update checksums + sed -i "s/^sha256sums_x86_64=.*/sha256sums_x86_64=('${SHA_X86_64}' '${SHA_LICENSE}')/" PKGBUILD + sed -i "s/^sha256sums_aarch64=.*/sha256sums_aarch64=('${SHA_AARCH64}' '${SHA_LICENSE}')/" PKGBUILD + + # Remove the SKIP comment if present + sed -i '/^# Update these checksums with: updpkgsums/d' PKGBUILD + + # Generate .SRCINFO (makepkg is not available on Ubuntu) + # .SRCINFO uses tab indentation for fields under pkgbase/pkgname + TAB=$'\t' + URL="https://github.com/felipemorandini/smartlog" + { + echo "pkgbase = smartlog-bin" + echo "${TAB}pkgdesc = A high-performance TUI for log tailing with JSON auto-detection and real-time filtering" + echo "${TAB}pkgver = ${VERSION}" + echo "${TAB}pkgrel = 1" + echo "${TAB}url = ${URL}" + echo "${TAB}arch = x86_64" + echo "${TAB}arch = aarch64" + echo "${TAB}license = MIT" + echo "${TAB}provides = smartlog" + echo "${TAB}conflicts = smartlog" + echo "${TAB}source_x86_64 = ${URL}/releases/download/v${VERSION}/smartlog-x86_64-unknown-linux-musl.tar.gz" + echo "${TAB}source_x86_64 = ${URL}/raw/v${VERSION}/LICENSE" + echo "${TAB}sha256sums_x86_64 = ${SHA_X86_64}" + echo "${TAB}sha256sums_x86_64 = ${SHA_LICENSE}" + echo "${TAB}source_aarch64 = ${URL}/releases/download/v${VERSION}/smartlog-aarch64-unknown-linux-musl.tar.gz" + echo "${TAB}source_aarch64 = ${URL}/raw/v${VERSION}/LICENSE" + echo "${TAB}sha256sums_aarch64 = ${SHA_AARCH64}" + echo "${TAB}sha256sums_aarch64 = ${SHA_LICENSE}" + echo "" + echo "pkgname = smartlog-bin" + } > .SRCINFO + + - name: Push to AUR + run: | + cd aur-repo + git config user.name "Felipe Pires Morandini" + git config user.email "felipepiresmorandini@gmail.com" + git add PKGBUILD .SRCINFO + git diff --cached --quiet && echo "No changes to push" && exit 0 + git commit -m "Update to v${VERSION}" + git push + update-homebrew: name: Update Homebrew formula needs: release diff --git a/ROADMAP.md b/ROADMAP.md index fbc2d3a..7426b98 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -2,51 +2,50 @@ ## Phase 6: Distribution & Polish -### 6.1 Shell Completions -- **Priority:** High -- **Effort:** Small -- Add `clap_complete` dependency -- Add `completions ` subcommand (bash, zsh, fish, elvish, powershell) -- Document in README with setup instructions per shell -- Reference: jwt-term already implements this pattern - -### 6.2 AUR Package (Arch Linux) -- **Priority:** Medium -- **Effort:** Small -- Create a `PKGBUILD` that downloads the pre-built Linux binary from GitHub Releases -- Submit to the AUR as `smartlog` -- Add AUR install instructions to README -- Consider a `-bin` suffix (`smartlog-bin`) if a source-build variant is also desired - -### 6.3 Winget Manifest (Windows) -- **Priority:** Medium -- **Effort:** Small -- Create a manifest pointing to the `smartlog-x86_64-pc-windows-msvc.zip` release asset -- Submit PR to [microsoft/winget-pkgs](https://github.com/microsoft/winget-pkgs) -- Add `winget install smartlog` instructions to README -- Optionally automate manifest updates via [wingetcreate](https://github.com/microsoft/winget-create) in the release workflow - -### 6.4 CHANGELOG.md -- **Priority:** Medium -- **Effort:** Small -- Create a `CHANGELOG.md` following [Keep a Changelog](https://keepachangelog.com) format -- Backfill entries for v0.1.0 through v0.5.0 from git history / release notes -- Update with each new release going forward - -### 6.5 Debian Package (.deb) -- **Priority:** Low -- **Effort:** Medium -- Add `[package.metadata.deb]` section to `Cargo.toml` with description, section, and assets -- Add `cargo-deb` step to the release workflow (build `.deb` for x86_64 and aarch64 Linux targets) -- Attach `.deb` files to GitHub Releases -- Add install instructions to README (`sudo dpkg -i smartlog_*.deb`) - -## Suggested Order - -| Order | Item | Reason | -|-------|------|--------| -| 1 | 6.1 Shell Completions | Direct UX improvement, parity with jwt-term | -| 2 | 6.4 CHANGELOG.md | Low effort, good practice for all subsequent releases | -| 3 | 6.2 AUR Package | Large Rust-savvy audience on Arch | -| 4 | 6.3 Winget Manifest | Covers Windows users who prefer package managers | -| 5 | 6.5 Debian Package | Broader Linux reach, but more CI complexity | +### 6.1 Shell Completions — DONE +- [x] Add `clap_complete` dependency +- [x] Add `completions ` subcommand (bash, zsh, fish, elvish, powershell) +- [x] Document in README with setup instructions per shell + +### 6.2 AUR Package (Arch Linux) — DONE +- [x] Create a `PKGBUILD` that downloads the pre-built Linux binary from GitHub Releases +- [x] Add AUR install instructions to README +- [x] Use `-bin` suffix (`smartlog-bin`) +- [x] Register `smartlog-bin` on the AUR and push initial PKGBUILD +- [x] Automate AUR updates in the release workflow (`update-aur` job in `release.yml`) + +### 6.3 Winget Manifest (Windows) — PARTIALLY DONE +- [x] Create a manifest (v1.6.0 schema) pointing to the GitHub Release `.zip` assets +- [x] Add `winget install` instructions to README +- [ ] Compute real SHA256 hashes for current release assets +- [ ] Submit initial PR to [microsoft/winget-pkgs](https://github.com/microsoft/winget-pkgs) +- [ ] Automate manifest updates via [wingetcreate](https://github.com/microsoft/winget-create) in the release workflow + +### 6.4 CHANGELOG.md — DONE +- [x] Create a `CHANGELOG.md` following [Keep a Changelog](https://keepachangelog.com) format +- [x] Backfill entries for v0.1.0 through v0.6.0 from git history / release notes +- [x] Update with each new release going forward + +### 6.5 Debian Package (.deb) — DONE +- [x] Add `[package.metadata.deb]` section to `Cargo.toml` +- [x] Add `cargo-deb` step to the release workflow (build `.deb` for x86_64 and aarch64 Linux targets) +- [x] Attach `.deb` files to GitHub Releases automatically +- [x] Add install instructions to README + +## Remaining Work + +| Priority | Item | Effort | Description | +|----------|------|--------|-------------| +| Medium | Winget submission | Small | Compute checksums, submit initial PR to winget-pkgs | +| Medium | Winget automation | Medium | Add `wingetcreate` step to release workflow for auto-submission | + +## Completed Distribution Channels + +| Channel | Automated? | Notes | +|---------|-----------|-------| +| GitHub Releases (6 targets) | Yes | Triggered by version tag | +| Homebrew (macOS & Linux) | Yes | Formula auto-updated on release | +| crates.io | Yes | Published on release | +| Debian .deb (x86_64 + ARM64) | Yes | Built and attached to release | +| AUR (Arch Linux) | Yes | `update-aur` job in release.yml, `AUR_SSH_KEY` secret configured | +| Winget (Windows) | No | Template in `packaging/winget/`, manual submission | diff --git a/packaging/aur/PKGBUILD b/packaging/aur/PKGBUILD index 4fe8a77..2a48998 100644 --- a/packaging/aur/PKGBUILD +++ b/packaging/aur/PKGBUILD @@ -2,7 +2,7 @@ # https://github.com/felipemorandini/smartlog pkgname=smartlog-bin -pkgver=0.5.0 +pkgver=0.6.0 pkgrel=1 pkgdesc="A high-performance TUI for log tailing with JSON auto-detection and real-time filtering" arch=('x86_64' 'aarch64')