From 1e63cff0c671c7b156deec288714c632f39023fa Mon Sep 17 00:00:00 2001 From: technothatch <112667606+technothatch@users.noreply.github.com> Date: Tue, 3 Nov 2026 19:13:32 -0500 Subject: [PATCH] release: gh-installable asset names ({os}-{arch}), all platforms, README install fix --- .github/workflows/ci.yml | 19 ++++++++++++++----- README.md | 25 ++++++++++++++++++++++--- internal/app/app.go | 7 ++++--- 3 files changed, 40 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 782b35d..ba1576b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,14 +35,23 @@ jobs: - uses: actions/setup-go@v5 with: go-version: "1.27" + # gh extension install matches release assets by the `{os}-{arch}` suffix, + # e.g. gh-prpush_0.1.0_linux-amd64 or gh-prpush_0.1.0_windows-amd64.exe. + # Binaries are static (CGO_ENABLED=0), so they run on any glibc version. - name: Cross-compile extension binaries run: | + set -euo pipefail mkdir -p dist - version="${GITHUB_REF_NAME}" - CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-s -w" -o "dist/gh-prpush_${version}_linux_amd64" . - CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags "-s -w" -o "dist/gh-prpush_${version}_darwin_amd64" . - CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -ldflags "-s -w" -o "dist/gh-prpush_${version}_darwin_arm64" . - CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags "-s -w" -o "dist/gh-prpush_${version}_windows_amd64.exe" . + version="${GITHUB_REF_NAME#v}" + for target in linux/amd64 linux/arm64 linux/386 darwin/amd64 darwin/arm64 windows/amd64 windows/arm64; do + os="${target%/*}" + arch="${target#*/}" + ext="" + [ "$os" = "windows" ] && ext=".exe" + CGO_ENABLED=0 GOOS="$os" GOARCH="$arch" go build -trimpath -buildvcs=false -ldflags "-s -w" \ + -o "dist/gh-prpush_${version}_${os}-${arch}${ext}" . + done + ls -l dist - uses: softprops/action-gh-release@v2 with: files: dist/* diff --git a/README.md b/README.md index d0283db..d9f89a5 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ (150+ upvotes, still open). Until it ships in `gh` proper, this extension fills the gap: ``` -$ gh pr push +$ gh prpush pushed HEAD to fork (fix-thing) ``` @@ -26,15 +26,34 @@ That's it. No state, no config file — it asks `gh` and `git` and gets out of t gh extension install technothatch/gh-prpush ``` -Requires the [GitHub CLI](https://cli.github.com/) (`gh`) on your PATH. +Requires the [GitHub CLI](https://cli.github.com/) (`gh`) on your PATH. Prebuilt +static binaries are attached to every release for Linux (amd64/arm64/386), +macOS (amd64/arm64) and Windows (amd64/arm64); `gh` picks the right one +automatically. + +If you prefer to build from source: + +```bash +git clone https://github.com/technothatch/gh-prpush.git +cd gh-prpush +go build -o gh-prpush . # Windows: go build -o gh-prpush.exe . +gh extension install . +``` ## Usage +> **Naming note:** this is a `gh` *extension*, so the command is +> **`gh prpush`** — not `gh pr push`. That's a `gh` limitation: extensions live +> in the `gh ` namespace, and the built-in `pr` command can't be extended +> with new subcommands. If/when the feature lands in `gh` itself +> ([cli/cli#2189](https://github.com/cli/cli/issues/2189)), it will be +> `gh pr push`. + ``` cd your-repo gh pr checkout 123 # or whatever workflow you use # ... commit your changes ... -gh pr push +gh prpush ``` Flags: diff --git a/internal/app/app.go b/internal/app/app.go index 55e0cf5..3992ba9 100644 --- a/internal/app/app.go +++ b/internal/app/app.go @@ -78,15 +78,16 @@ func Run(args []string, stdout, stderr io.Writer, r ...run.Runner) error { case "--force-with-lease": force = true case "-h", "--help": - fmt.Fprint(stdout, `gh pr push - push the head branch of the current pull request + fmt.Fprint(stdout, `gh prpush - push the head branch of the current pull request Usage: - gh pr push [--force-with-lease] + gh prpush [--force-with-lease] Pushes the checked-out branch of the PR you are on to the correct remote (your fork when the PR is cross-repository, origin otherwise). -Implements https://github.com/cli/cli/issues/2189 as an extension. +Note: this is a gh extension, so it runs as 'gh prpush'. The upstream +feature request is https://github.com/cli/cli/issues/2189. `) return nil default: