feat: add Homebrew formula and Scoop manifest with automated release workflow - #1
feat: add Homebrew formula and Scoop manifest with automated release workflow#1NanamiMio wants to merge 2 commits into
Conversation
Add Homebrew and Scoop packaging, make native host manifests use package-manager-stable paths, and publish all supported binaries through a single manually dispatched release workflow. Co-authored-by: Codex <codex@openai.com>
LeiShi1313
left a comment
There was a problem hiding this comment.
Requesting changes for five blocking issues: Linux binary compatibility, the bootstrap release mismatch, non-retryable publishing, workflow token scope, and the release-trigger regression. Verification completed: Rust tests and actionlint passed; all seeded hashes match v0.1.0; the Homebrew formula installed but its runtime test failed with GLIBC_2.39 not found; GitHub reports no CI checks.
|
|
||
| - name: Build | ||
| run: cargo build --release --target ${{ matrix.target }} | ||
| run: cargo build --release --target "${{ matrix.target }}" |
There was a problem hiding this comment.
Critical: The Linux artifact built by this job is not portable to Ubuntu 22.04. I installed the checked-in formula in Homebrew's official Ubuntu 22.04 container; brew test failed because the v0.1.0 executable requires GLIBC_2.39, while that environment provides 2.35. Building the GNU targets on ubuntu-latest (currently Ubuntu 24.04) preserves that compatibility floor. Please build Linux artifacts against an explicit supported baseline or use musl/static targets, then add a smoke test that runs the extracted binary and brew test on the oldest supported Linux environment.
There was a problem hiding this comment.
Fixed in 48e3783. Both GNU Linux targets now build on explicit ubuntu-22.04 runners instead of ubuntu-latest. The compatibility job also runs the extracted x86_64 package on Ubuntu 22.04, installs the rendered formula through a temporary Homebrew tap, and runs brew test. The complete real release run passed here: https://github.com/NanamiMio/ptd-cli-release-test/actions/runs/32728854010
| class PtdCli < Formula | ||
| desc "CLI for PT-Depiler browser extension via Native Messaging" | ||
| homepage "https://github.com/pt-plugins/ptd-cli" | ||
| version "0.1.0" |
There was a problem hiding this comment.
Both new package manifests bootstrap from v0.1.0, but that tag points at the PR base (98fab8b) and predates the PTD_NATIVE_HOST_PATH handling added by this PR. The first Homebrew/Scoop-installed binary therefore ignores the stable path supplied by the package manager and records its canonicalized, version-specific installation path; after an upgrade and cleanup, the browser manifest can point at a removed ptd-host. Please stage this rollout so the stable-path code is released first and the package definitions/docs target that release, or provide a package-level stable launcher that does not depend on the new binary behavior. Verify install -> register -> upgrade -> cleanup and confirm the recorded host still exists.
There was a problem hiding this comment.
Fixed in 48e3783 by staging the rollout. The public v0.1.0 formula and Scoop manifest were removed; only non-public templates are checked in, and public manifests are generated after a new release has uploaded and verified all assets. The formula records opt_libexec/ptd-host, while Scoop expands $dir after link_current, so it records the stable apps/ptd-cli/current/ptd-host.exe junction. PTD_NATIVE_HOST_PATH is preserved rather than canonicalized, so upgrade cleanup does not turn it into a removed version directory. The standalone RC release successfully generated and installed the staged Homebrew formula: https://github.com/NanamiMio/ptd-cli-release-test/releases/tag/v0.1.4-rc.1
| git config user.email "github-actions[bot]@users.noreply.github.com" | ||
| git add Cargo.toml Cargo.lock Formula/ptd-cli.rb bucket/ptd-cli.json | ||
| git commit -m "chore(release): prepare ${TAG} [skip ci]" | ||
| git push origin HEAD:${{ github.event.repository.default_branch }} |
There was a problem hiding this comment.
This sequence is not atomic or safely retryable. Once this push succeeds, a later tag or release failure leaves public manifests pointing to assets that do not exist. If the tag push succeeds but gh release create fails or uploads only some assets, the next run is rejected by the existing-tag check and requires manual repair. Please make each external write idempotent and avoid publishing manifest URLs until all release assets have been verified. Verification should inject a failure after each branch/tag/release mutation and show that rerunning reaches a complete release without manual cleanup.
There was a problem hiding this comment.
Fixed in 48e3783. The workflow no longer creates or rejects an existing tag: it starts from the existing GitHub Release, uploads every asset with --clobber, verifies every expected asset name, and only then renders and pushes the public manifests. A failure before the manifest commit leaves no public package URL; a failure after any asset upload is recoverable by rerunning. I ran the complete release once and then reran the same workflow without deleting the tag, release, assets, or manifests; both attempts completed successfully: https://github.com/NanamiMio/ptd-cli-release-test/actions/runs/32728854010
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| ref: ${{ needs.prepare.outputs.source_sha }} |
There was a problem hiding this comment.
Security: contents: write is currently workflow-wide, and checkout v4 persists the token by default. This means every matrix build runs Cargo dependencies and build scripts with push-capable Git credentials even though only publish needs to mutate the repository. Please default the workflow to contents: read, add persist-credentials: false to the prepare/build checkouts, and grant contents: write only to the publish job. Verify that an authenticated push from a build job is rejected while publishing still succeeds.
There was a problem hiding this comment.
Fixed in 48e3783. Workflow-level permissions now default to contents: read; prepare, build, and compatibility checkouts use persist-credentials: false; only the publish job receives contents: write. The standalone end-to-end release run confirms that the restricted build jobs complete and the job-scoped publisher can still upload assets and push the manifest commit: https://github.com/NanamiMio/ptd-cli-release-test/actions/runs/32728854010
| on: | ||
| release: | ||
| types: [created] | ||
| workflow_dispatch: |
There was a problem hiding this comment.
This removes the existing release.created entry point and adds neither a release nor tag trigger, so creating a GitHub release through the previous workflow no longer builds or uploads anything. It also conflicts with the PR description's claim that updates happen on release/tag pushes. Please retain a compatible trigger, or obtain explicit maintainer consent for the breaking release-process migration and update the PR/release documentation accordingly. Verify the selected release event actually starts the workflow.
There was a problem hiding this comment.
Fixed in 48e3783. The compatible release.created trigger is restored, while manual dispatch remains build/test-only. I verified the event independently in the standalone release-test repository with a minimal workflow on its temporary default branch; the log records action=created and completed successfully: https://github.com/NanamiMio/ptd-cli-release-test/actions/runs/32801398025
Co-authored-by: Codex <codex@openai.com>
|
Addressed all five blocking review items in
Verification:
|
Summary
This PR adds native package manager support for Homebrew (macOS / Linux) and Scoop (Windows), along with automated manifest updates in the GitHub Actions release workflow.
1. Homebrew Formula (
Formula/ptd-cli.rb)aarch64-apple-darwin(Apple Silicon),x86_64-apple-darwin(Intel)aarch64-unknown-linux-gnu(ARM64),x86_64-unknown-linux-gnu(x86_64)rust/llvmnot required), instant installation in < 1s.ptdandptd-host.SHA256SMap structure.2. Scoop Manifest (
bucket/ptd-cli.json)x86_64-pc-windows-msvc.autoupdateandcheckverconfiguration.3. Automated Release Workflow (
.github/workflows/release.yml)Formula/ptd-cli.rbandbucket/ptd-cli.jsonwith the new version and SHA256 hashes.[skip ci].4. Documentation
README.mdandREADME.en.mdwith installation commands:概述(中文)
本 PR 为
ptd-cli增加了 Homebrew (macOS/Linux) 和 Scoop (Windows) 包管理器支持,并集成了 Release CI 自动更新机制:Formula/ptd-cli.rb):支持 macOS 及 Linux 的 ARM64 与 x86_64 预编译二进制分发,0 构建依赖,秒级安装。bucket/ptd-cli.json):支持 Windows 64位预编译 Zip 安装与自动更新检测。.github/workflows/release.yml):发版时自动计算各平台 SHA256,原地更新 Formula 与 Scoop Manifest,并在单次原子 Commit 内推回主分支。README中的安装指南。