diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 17cd446..2e10bd3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,6 +34,14 @@ jobs: - name: Build binary run: go build ./cmd/go-chrome-ai + - name: Build CLI release targets + run: | + mkdir -p /tmp/go-chrome-ai-cross + GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o /tmp/go-chrome-ai-cross/go-chrome-ai-linux-amd64 ./cmd/cli + GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -o /tmp/go-chrome-ai-cross/go-chrome-ai-linux-arm64 ./cmd/cli + GOOS=windows GOARCH=amd64 CGO_ENABLED=0 go build -o /tmp/go-chrome-ai-cross/go-chrome-ai-windows-amd64.exe ./cmd/cli + GOOS=windows GOARCH=arm64 CGO_ENABLED=0 go build -o /tmp/go-chrome-ai-cross/go-chrome-ai-windows-arm64.exe ./cmd/cli + - name: Check GoReleaser config uses: goreleaser/goreleaser-action@v6 with: diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 0b97333..cb58e7d 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -7,7 +7,7 @@ before: - go test ./... builds: - - id: go-chrome-ai + - id: go-chrome-ai-macos main: ./cmd/go-chrome-ai binary: go-chrome-ai env: @@ -21,14 +21,38 @@ builds: - -trimpath ldflags: - -s -w + - id: go-chrome-ai-cli + main: ./cmd/cli + binary: go-chrome-ai + env: + - CGO_ENABLED=0 + goos: + - linux + - windows + goarch: + - amd64 + - arm64 + flags: + - -trimpath + ldflags: + - -s -w archives: - id: release ids: - - go-chrome-ai + - go-chrome-ai-macos + - go-chrome-ai-cli formats: - tar.gz + format_overrides: + - goos: windows + formats: + - zip name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}" + files: + - README.md + - LICENSE + - PUBLISHING.md checksum: name_template: checksums.txt diff --git a/PUBLISHING.md b/PUBLISHING.md index 47e09e1..c7b9609 100644 --- a/PUBLISHING.md +++ b/PUBLISHING.md @@ -13,24 +13,30 @@ The repository includes `.github/workflows/ci.yml` to run: Tagging a semantic version triggers `.github/workflows/release.yml`. ```bash -git tag v1.0.4 -git push origin v1.0.4 +git tag v1.0.5 +git push origin v1.0.5 ``` That workflow publishes release archives and `checksums.txt` through GoReleaser. -Published macOS assets follow the same versioned artifact pattern as the other managed repos: +Published assets follow the same versioned artifact pattern as the other managed repos: -- `go-chrome-ai_1.0.4_darwin_arm64.tar.gz` -- `go-chrome-ai_1.0.4_darwin_amd64.tar.gz` +- `go-chrome-ai_1.0.5_darwin_arm64.tar.gz` +- `go-chrome-ai_1.0.5_darwin_amd64.tar.gz` +- `go-chrome-ai_1.0.5_linux_arm64.tar.gz` +- `go-chrome-ai_1.0.5_linux_amd64.tar.gz` +- `go-chrome-ai_1.0.5_windows_arm64.zip` +- `go-chrome-ai_1.0.5_windows_amd64.zip` - `checksums.txt` +The macOS archives package the GUI-capable entrypoint. Linux and Windows archives package the CLI binary for easier cross-platform distribution. + ## Homebrew Cask After the release is live: ```bash -./scripts/render-homebrew-cask.sh --owner itamaker --version v1.0.4 > /path/to/homebrew-tap/Casks/go-chrome-ai.rb +./scripts/render-homebrew-cask.sh --owner itamaker --version v1.0.5 > /path/to/homebrew-tap/Casks/go-chrome-ai.rb ``` Commit the rendered file to `https://github.com/itamaker/homebrew-tap` as `Casks/go-chrome-ai.rb`. diff --git a/README.md b/README.md index e7328a1..bc9cea4 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ brew install --cask itamaker/tap/go-chrome-ai
You can also install with the shell installer or download binaries from GitHub Releases. -Shell installer: +Shell installer for macOS and Linux: ```bash curl -fsSL https://raw.githubusercontent.com/itamaker/go-chrome-ai/main/scripts/install.sh | sh @@ -32,10 +32,15 @@ curl -fsSL https://raw.githubusercontent.com/itamaker/go-chrome-ai/main/scripts/ Current release archives: -- macOS (Apple Silicon/arm64): `go-chrome-ai_1.0.4_darwin_arm64.tar.gz` -- macOS (Intel/x86_64): `go-chrome-ai_1.0.4_darwin_amd64.tar.gz` +- macOS (Apple Silicon/arm64): `go-chrome-ai_1.0.5_darwin_arm64.tar.gz` +- macOS (Intel/x86_64): `go-chrome-ai_1.0.5_darwin_amd64.tar.gz` +- Linux (arm64): `go-chrome-ai_1.0.5_linux_arm64.tar.gz` +- Linux (x86_64): `go-chrome-ai_1.0.5_linux_amd64.tar.gz` +- Windows (arm64): `go-chrome-ai_1.0.5_windows_arm64.zip` +- Windows (x86_64): `go-chrome-ai_1.0.5_windows_amd64.zip` Each archive contains a single executable: `go-chrome-ai`. +The macOS archives include the GUI-capable binary. Linux and Windows releases ship the CLI binary for portable installs.
@@ -43,7 +48,7 @@ The install script also accepts: ```bash # Install a specific release into a custom directory -curl -fsSL https://raw.githubusercontent.com/itamaker/go-chrome-ai/main/scripts/install.sh | VERSION=v1.0.4 INSTALL_DIR=$HOME/bin sh +curl -fsSL https://raw.githubusercontent.com/itamaker/go-chrome-ai/main/scripts/install.sh | VERSION=v1.0.5 INSTALL_DIR=$HOME/bin sh ``` Set `SKIP_PATH_SETUP=1` if you do not want the installer to edit your shell profile. @@ -53,8 +58,8 @@ Set `SKIP_PATH_SETUP=1` if you do not want the installer to edit your shell prof Run: ```bash -go-chrome-ai # CLI mode -go-chrome-ai gui # GUI mode +go-chrome-ai # CLI mode on every release +go-chrome-ai gui # GUI mode on macOS release builds or source builds ``` On some macOS systems, Gatekeeper may block first launch for downloaded binaries. If that happens, run: @@ -99,6 +104,8 @@ Flags: go run ./cmd/go-chrome-ai gui ``` +Prebuilt Linux and Windows releases are CLI-only. Build from source if you want the Fyne GUI on those platforms. + The GUI includes: - auto-detection of installed Chrome channels @@ -127,8 +134,8 @@ Local build output is written to `output/`. GoReleaser packaging output is writt Installed binary usage: ```bash -go-chrome-ai # CLI mode -go-chrome-ai gui # GUI mode +go-chrome-ai # CLI mode on every release +go-chrome-ai gui # GUI mode on macOS release builds or source builds ``` ## What It Does diff --git a/cmd/go-chrome-ai/main.go b/cmd/go-chrome-ai/main.go index 99481e1..617807c 100644 --- a/cmd/go-chrome-ai/main.go +++ b/cmd/go-chrome-ai/main.go @@ -5,6 +5,7 @@ import ( "os" "github.com/itamaker/go-chrome-ai/internal/app" + "github.com/itamaker/go-chrome-ai/internal/guiapp" ) func main() { @@ -12,7 +13,7 @@ func main() { if len(args) > 0 { switch args[0] { case "gui": - app.RunGUI() + guiapp.Run() return case "help", "-h", "--help": printUsage() diff --git a/cmd/gui/main.go b/cmd/gui/main.go index ac979f0..b8673fb 100644 --- a/cmd/gui/main.go +++ b/cmd/gui/main.go @@ -1,7 +1,7 @@ package main -import "github.com/itamaker/go-chrome-ai/internal/app" +import "github.com/itamaker/go-chrome-ai/internal/guiapp" func main() { - app.RunGUI() + guiapp.Run() } diff --git a/docs/README.zh.md b/docs/README.zh.md index 5248314..6be3186 100644 --- a/docs/README.zh.md +++ b/docs/README.zh.md @@ -22,7 +22,7 @@ brew install --cask itamaker/tap/go-chrome-ai
也可以通过安装脚本或 GitHub Releases 获取二进制。 -安装脚本: +适用于 macOS 和 Linux 的安装脚本: ```bash curl -fsSL https://raw.githubusercontent.com/itamaker/go-chrome-ai/main/scripts/install.sh | sh @@ -30,10 +30,15 @@ curl -fsSL https://raw.githubusercontent.com/itamaker/go-chrome-ai/main/scripts/ 当前发布包: -- macOS(Apple Silicon/arm64):`go-chrome-ai_1.0.4_darwin_arm64.tar.gz` -- macOS(Intel/x86_64):`go-chrome-ai_1.0.4_darwin_amd64.tar.gz` +- macOS(Apple Silicon/arm64):`go-chrome-ai_1.0.5_darwin_arm64.tar.gz` +- macOS(Intel/x86_64):`go-chrome-ai_1.0.5_darwin_amd64.tar.gz` +- Linux(arm64):`go-chrome-ai_1.0.5_linux_arm64.tar.gz` +- Linux(x86_64):`go-chrome-ai_1.0.5_linux_amd64.tar.gz` +- Windows(arm64):`go-chrome-ai_1.0.5_windows_arm64.zip` +- Windows(x86_64):`go-chrome-ai_1.0.5_windows_amd64.zip` 每个压缩包都只包含一个可执行文件:`go-chrome-ai`。 +macOS 发布包包含 GUI 可执行能力;Linux 和 Windows 发布包默认提供 CLI,便于直接使用。
@@ -41,7 +46,7 @@ curl -fsSL https://raw.githubusercontent.com/itamaker/go-chrome-ai/main/scripts/ ```bash # 安装指定版本,并放到自定义目录 -curl -fsSL https://raw.githubusercontent.com/itamaker/go-chrome-ai/main/scripts/install.sh | VERSION=v1.0.4 INSTALL_DIR=$HOME/bin sh +curl -fsSL https://raw.githubusercontent.com/itamaker/go-chrome-ai/main/scripts/install.sh | VERSION=v1.0.5 INSTALL_DIR=$HOME/bin sh ``` 如果你不希望安装器修改 shell 配置文件,可设置 `SKIP_PATH_SETUP=1`。 @@ -51,8 +56,8 @@ curl -fsSL https://raw.githubusercontent.com/itamaker/go-chrome-ai/main/scripts/ 运行: ```bash -go-chrome-ai # 命令行模式 -go-chrome-ai gui # 图形界面模式 +go-chrome-ai # 所有发布包都支持命令行模式 +go-chrome-ai gui # macOS 发布包或源码构建支持图形界面模式 ``` 在某些 macOS 系统上,首次运行下载的二进制可能会被 Gatekeeper 拦截。可执行: @@ -97,6 +102,8 @@ go run ./cmd/go-chrome-ai go run ./cmd/go-chrome-ai gui ``` +Linux 和 Windows 的预编译发布包默认只包含 CLI;如果需要 Fyne GUI,请从源码构建。 + GUI 功能: - 自动检测已安装的 Chrome 渠道 @@ -125,8 +132,8 @@ Makefile: 安装后的用法: ```bash -go-chrome-ai # 命令行模式 -go-chrome-ai gui # 图形界面模式 +go-chrome-ai # 所有发布包都支持命令行模式 +go-chrome-ai gui # macOS 发布包或源码构建支持图形界面模式 ``` ## 执行流程 diff --git a/docs/homebrew-cask.md b/docs/homebrew-cask.md index 4c5c119..7131337 100644 --- a/docs/homebrew-cask.md +++ b/docs/homebrew-cask.md @@ -8,10 +8,16 @@ To support `brew install --cask`, publish the cask in your tap repo [`itamaker/h Upload these files to each GitHub Release: -- `go-chrome-ai_1.0.4_darwin_arm64.tar.gz` -- `go-chrome-ai_1.0.4_darwin_amd64.tar.gz` +- `go-chrome-ai_1.0.5_darwin_arm64.tar.gz` +- `go-chrome-ai_1.0.5_darwin_amd64.tar.gz` +- `go-chrome-ai_1.0.5_linux_arm64.tar.gz` +- `go-chrome-ai_1.0.5_linux_amd64.tar.gz` +- `go-chrome-ai_1.0.5_windows_arm64.zip` +- `go-chrome-ai_1.0.5_windows_amd64.zip` - `checksums.txt` +The cask only consumes the two macOS archives, but the release can also ship Linux and Windows CLI packages under the same naming pattern. + You can generate them via: ```bash @@ -25,7 +31,7 @@ Each archive should contain: Then update the cask: ```bash -./scripts/render-homebrew-cask.sh --owner itamaker --version v1.0.4 > /path/to/homebrew-tap/Casks/go-chrome-ai.rb +./scripts/render-homebrew-cask.sh --owner itamaker --version v1.0.5 > /path/to/homebrew-tap/Casks/go-chrome-ai.rb ``` ## User install diff --git a/docs/images/social-preview.png b/docs/images/social-preview.png index 5ff38cf..491d508 100644 Binary files a/docs/images/social-preview.png and b/docs/images/social-preview.png differ diff --git a/internal/app/gui.go b/internal/guiapp/gui.go similarity index 99% rename from internal/app/gui.go rename to internal/guiapp/gui.go index 2dbd969..1e286ec 100644 --- a/internal/app/gui.go +++ b/internal/guiapp/gui.go @@ -1,4 +1,4 @@ -package app +package guiapp import ( "fmt" @@ -14,7 +14,7 @@ import ( "github.com/itamaker/go-chrome-ai/internal/chrome" ) -func RunGUI() { +func Run() { a := app.New() w := a.NewWindow("go-chrome-ai") w.Resize(fyne.NewSize(760, 560)) diff --git a/scripts/install.sh b/scripts/install.sh index ae9a4f0..c722e9c 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -100,8 +100,8 @@ detect_platform() { OS="$(uname -s | tr '[:upper:]' '[:lower:]')" case "$OS" in darwin) OS="darwin" ;; - linux) error "GitHub Releases currently publish macOS binaries only. Build from source on Linux." ;; - mingw*|msys*|cygwin*) error "Windows releases are not published yet. Build from source instead." ;; + linux) OS="linux" ;; + mingw*|msys*|cygwin*) error "Windows release archives are published as .zip files. Download them directly from GitHub Releases." ;; *) error "Unsupported OS: $OS" ;; esac @@ -272,15 +272,21 @@ print_next_steps() { say " ${BOLD}Run the CLI:${NC}" say " ${CYAN}$BINARY_NAME${NC}" say "" - say " ${BOLD}Launch the GUI:${NC}" - say " ${CYAN}$BINARY_NAME gui${NC}" - say "" say " ${BOLD}Preview changes without writing:${NC}" say " ${CYAN}$BINARY_NAME -dry-run${NC}" say "" - say " ${BOLD}If macOS blocks the first launch:${NC}" - say " ${CYAN}xattr -d com.apple.quarantine \"$INSTALL_PATH\"${NC}" - say "" + if [ "$OS" = "darwin" ]; then + say " ${BOLD}Launch the GUI:${NC}" + say " ${CYAN}$BINARY_NAME gui${NC}" + say "" + say " ${BOLD}If macOS blocks the first launch:${NC}" + say " ${CYAN}xattr -d com.apple.quarantine \"$INSTALL_PATH\"${NC}" + say "" + else + say " ${BOLD}GUI mode:${NC}" + say " Build from source on Linux if you want the Fyne desktop app." + say "" + fi say "${GREEN}${BOLD}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}" }