diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 30806f0..0b97333 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -28,13 +28,13 @@ archives: - go-chrome-ai formats: - tar.gz - name_template: "{{ .ProjectName }}-{{ .Os }}-{{ .Arch }}" + name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}" checksum: - name_template: SHA256SUMS + name_template: checksums.txt snapshot: - version_template: "{{ .Version }}-devel" + version_template: "{{ incpatch .Version }}-devel" changelog: sort: asc diff --git a/PUBLISHING.md b/PUBLISHING.md index 0da4648..47e09e1 100644 --- a/PUBLISHING.md +++ b/PUBLISHING.md @@ -13,24 +13,24 @@ The repository includes `.github/workflows/ci.yml` to run: Tagging a semantic version triggers `.github/workflows/release.yml`. ```bash -git tag v1.0.3 -git push origin v1.0.3 +git tag v1.0.4 +git push origin v1.0.4 ``` -That workflow publishes release archives and `SHA256SUMS` through GoReleaser. +That workflow publishes release archives and `checksums.txt` through GoReleaser. -Published macOS assets keep the current install-compatible names: +Published macOS assets follow the same versioned artifact pattern as the other managed repos: -- `go-chrome-ai-darwin-arm64.tar.gz` -- `go-chrome-ai-darwin-amd64.tar.gz` -- `SHA256SUMS` +- `go-chrome-ai_1.0.4_darwin_arm64.tar.gz` +- `go-chrome-ai_1.0.4_darwin_amd64.tar.gz` +- `checksums.txt` ## Homebrew Cask After the release is live: ```bash -./scripts/render-homebrew-cask.sh --owner itamaker --version v1.0.3 > /path/to/homebrew-tap/Casks/go-chrome-ai.rb +./scripts/render-homebrew-cask.sh --owner itamaker --version v1.0.4 > /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 ea74dd7..e7328a1 100644 --- a/README.md +++ b/README.md @@ -7,37 +7,33 @@ English | [中文](docs/README.zh.md) `go-chrome-ai` is a cross-platform Chrome profile patcher written in Go, with both **CLI** and **GUI** modes. It helps enable Chrome AI-related features, including **Ask Gemini**, without reinstalling Chrome or recreating your profile. +![go-chrome-ai social preview](docs/images/social-preview.png) + ## Support [![Buy Me A Coffee](https://img.shields.io/badge/Buy%20Me%20A%20Coffee-FFDD00?style=for-the-badge&logo=buy-me-a-coffee&logoColor=black)](https://buymeacoffee.com/amaker) -## Screenshot - -![go-chrome-ai GUI](docs/images/go-chrome-ai-gui.png) - ## Quickstart ### Install -Install with your preferred method: - -```bash -# Install the latest macOS release -curl -fsSL https://raw.githubusercontent.com/itamaker/go-chrome-ai/main/scripts/install.sh | sh -``` - ```bash -# Or install via Homebrew (custom tap) brew install --cask itamaker/tap/go-chrome-ai ```
-You can also download binaries from GitHub Releases. +You can also install with the shell installer or download binaries from GitHub Releases. + +Shell installer: + +```bash +curl -fsSL https://raw.githubusercontent.com/itamaker/go-chrome-ai/main/scripts/install.sh | sh +``` Current release archives: -- macOS (Apple Silicon/arm64): `go-chrome-ai-darwin-arm64.tar.gz` -- macOS (Intel/x86_64): `go-chrome-ai-darwin-amd64.tar.gz` +- 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` Each archive contains a single executable: `go-chrome-ai`. @@ -47,7 +43,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.1 INSTALL_DIR=$HOME/bin sh +curl -fsSL https://raw.githubusercontent.com/itamaker/go-chrome-ai/main/scripts/install.sh | VERSION=v1.0.4 INSTALL_DIR=$HOME/bin sh ``` Set `SKIP_PATH_SETUP=1` if you do not want the installer to edit your shell profile. @@ -77,6 +73,10 @@ It enables Chrome AI-related features (such as **Ask Gemini**) by patching local - `variations_country` -> `"us"` - `variations_permanent_consistency_country` -> `["", "us"]` (if field exists and is patchable) +## Screenshot + +![go-chrome-ai GUI](docs/images/go-chrome-ai-gui.png) + ## Requirements - Go `1.26+` diff --git a/docs/README.zh.md b/docs/README.zh.md index 90b7170..5248314 100644 --- a/docs/README.zh.md +++ b/docs/README.zh.md @@ -5,37 +5,33 @@ `go-chrome-ai` 是一个用 Go 编写的跨平台 Chrome 配置修补工具,同时支持 **CLI** 和 **GUI**。 它可以在不重装 Chrome、不重建用户配置的情况下启用相关 AI 功能(包括 **Ask Gemini**)。 +![go-chrome-ai social preview](images/social-preview.png) + ## Support [![Buy Me A Coffee](https://img.shields.io/badge/Buy%20Me%20A%20Coffee-FFDD00?style=for-the-badge&logo=buy-me-a-coffee&logoColor=black)](https://buymeacoffee.com/amaker) -## 截图 - -![go-chrome-ai GUI](images/go-chrome-ai-gui.png) - ## Quickstart ### 安装 -可按你偏好的方式安装: - -```bash -# 安装最新的 macOS release -curl -fsSL https://raw.githubusercontent.com/itamaker/go-chrome-ai/main/scripts/install.sh | sh -``` - ```bash -# 或通过 Homebrew(自定义 tap)安装 brew install --cask itamaker/tap/go-chrome-ai ```
-也可以从 GitHub Releases 直接下载二进制。 +也可以通过安装脚本或 GitHub Releases 获取二进制。 + +安装脚本: + +```bash +curl -fsSL https://raw.githubusercontent.com/itamaker/go-chrome-ai/main/scripts/install.sh | sh +``` 当前发布包: -- macOS(Apple Silicon/arm64):`go-chrome-ai-darwin-arm64.tar.gz` -- macOS(Intel/x86_64):`go-chrome-ai-darwin-amd64.tar.gz` +- 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` 每个压缩包都只包含一个可执行文件:`go-chrome-ai`。 @@ -45,7 +41,7 @@ brew install --cask itamaker/tap/go-chrome-ai ```bash # 安装指定版本,并放到自定义目录 -curl -fsSL https://raw.githubusercontent.com/itamaker/go-chrome-ai/main/scripts/install.sh | VERSION=v1.0.1 INSTALL_DIR=$HOME/bin sh +curl -fsSL https://raw.githubusercontent.com/itamaker/go-chrome-ai/main/scripts/install.sh | VERSION=v1.0.4 INSTALL_DIR=$HOME/bin sh ``` 如果你不希望安装器修改 shell 配置文件,可设置 `SKIP_PATH_SETUP=1`。 @@ -75,6 +71,10 @@ xattr -d com.apple.quarantine $(which go-chrome-ai) - 将 `variations_country` 设为 `"us"` - 将 `variations_permanent_consistency_country` 设为 `["", "us"]`(仅当该字段存在且可修改) +## 截图 + +![go-chrome-ai GUI](images/go-chrome-ai-gui.png) + ## 环境要求 - Go `1.26+` diff --git a/docs/homebrew-cask.md b/docs/homebrew-cask.md index 38d1752..4c5c119 100644 --- a/docs/homebrew-cask.md +++ b/docs/homebrew-cask.md @@ -8,8 +8,9 @@ To support `brew install --cask`, publish the cask in your tap repo [`itamaker/h Upload these files to each GitHub Release: -- `go-chrome-ai-darwin-arm64.tar.gz` -- `go-chrome-ai-darwin-amd64.tar.gz` +- `go-chrome-ai_1.0.4_darwin_arm64.tar.gz` +- `go-chrome-ai_1.0.4_darwin_amd64.tar.gz` +- `checksums.txt` You can generate them via: @@ -24,7 +25,7 @@ Each archive should contain: Then update the cask: ```bash -./scripts/render-homebrew-cask.sh --owner itamaker --version v1.0.3 > /path/to/homebrew-tap/Casks/go-chrome-ai.rb +./scripts/render-homebrew-cask.sh --owner itamaker --version v1.0.4 > /path/to/homebrew-tap/Casks/go-chrome-ai.rb ``` ## User install diff --git a/docs/images/logo-mark.png b/docs/images/logo-mark.png new file mode 100644 index 0000000..9ef5ce5 Binary files /dev/null and b/docs/images/logo-mark.png differ diff --git a/docs/images/social-preview.png b/docs/images/social-preview.png new file mode 100644 index 0000000..5ff38cf Binary files /dev/null and b/docs/images/social-preview.png differ diff --git a/scripts/install.sh b/scripts/install.sh index e84e640..ae9a4f0 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -8,6 +8,11 @@ REPO="${REPO:-itamaker/go-chrome-ai}" BINARY_NAME="go-chrome-ai" VERSION="${VERSION:-latest}" SKIP_PATH_SETUP="${SKIP_PATH_SETUP:-0}" +VERSION_TAG="" +VERSION_NUMBER="" +LEGACY_ARCHIVE_NAME="" +LEGACY_DOWNLOAD_URL="" +LEGACY_CHECKSUMS_URL="" if [ "$(id -u)" = "0" ]; then INSTALL_DIR="${INSTALL_DIR:-/usr/local/bin}" @@ -112,15 +117,28 @@ resolve_version() { if [ "$VERSION" = "latest" ]; then latest_json="$(github_api_get "https://api.github.com/repos/$REPO/releases/latest")" || \ error "Failed to query the latest GitHub release" - VERSION="$(printf '%s\n' "$latest_json" | sed -n 's/.*"tag_name"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' | head -n 1)" - [ -n "$VERSION" ] || error "Failed to parse the latest release version" + VERSION_TAG="$(printf '%s\n' "$latest_json" | sed -n 's/.*"tag_name"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' | head -n 1)" + [ -n "$VERSION_TAG" ] || error "Failed to parse the latest release version" + else + case "$VERSION" in + v*) + VERSION_TAG="$VERSION" + ;; + *) + VERSION_TAG="v$VERSION" + ;; + esac fi - ARCHIVE_NAME="${BINARY_NAME}-${OS}-${ARCH}.tar.gz" - DOWNLOAD_URL="https://github.com/$REPO/releases/download/$VERSION/$ARCHIVE_NAME" - CHECKSUMS_URL="https://github.com/$REPO/releases/download/$VERSION/SHA256SUMS" + VERSION_NUMBER="${VERSION_TAG#v}" + ARCHIVE_NAME="${BINARY_NAME}_${VERSION_NUMBER}_${OS}_${ARCH}.tar.gz" + DOWNLOAD_URL="https://github.com/$REPO/releases/download/$VERSION_TAG/$ARCHIVE_NAME" + CHECKSUMS_URL="https://github.com/$REPO/releases/download/$VERSION_TAG/checksums.txt" + LEGACY_ARCHIVE_NAME="${BINARY_NAME}-${OS}-${ARCH}.tar.gz" + LEGACY_DOWNLOAD_URL="https://github.com/$REPO/releases/download/$VERSION_TAG/$LEGACY_ARCHIVE_NAME" + LEGACY_CHECKSUMS_URL="https://github.com/$REPO/releases/download/$VERSION_TAG/SHA256SUMS" - info "Version: ${BOLD}$VERSION${NC}" + info "Version: ${BOLD}$VERSION_TAG${NC}" } create_install_dir() { @@ -149,7 +167,7 @@ verify_checksum() { fi if ! curl -fsSL "$CHECKSUMS_URL" -o "$checksums_path"; then - warn "Skipping checksum verification: failed to download SHA256SUMS" + warn "Skipping checksum verification: failed to download checksums.txt" return 0 fi @@ -174,10 +192,16 @@ install_binary() { trap 'rm -rf "$tmp_dir"' EXIT HUP INT TERM archive_path="$tmp_dir/$ARCHIVE_NAME" - checksums_path="$tmp_dir/SHA256SUMS" + checksums_path="$tmp_dir/checksums.txt" info "Downloading ${BOLD}$ARCHIVE_NAME${NC}" - curl -fsSL "$DOWNLOAD_URL" -o "$archive_path" || error "Download failed: $DOWNLOAD_URL" + if ! curl -fsSL "$DOWNLOAD_URL" -o "$archive_path"; then + warn "Preferred archive name not found, trying legacy release naming" + ARCHIVE_NAME="$LEGACY_ARCHIVE_NAME" + DOWNLOAD_URL="$LEGACY_DOWNLOAD_URL" + CHECKSUMS_URL="$LEGACY_CHECKSUMS_URL" + curl -fsSL "$DOWNLOAD_URL" -o "$archive_path" || error "Download failed: $DOWNLOAD_URL" + fi verify_checksum "$archive_path" "$checksums_path" diff --git a/scripts/render-homebrew-cask.sh b/scripts/render-homebrew-cask.sh index 0d89592..3fec75f 100755 --- a/scripts/render-homebrew-cask.sh +++ b/scripts/render-homebrew-cask.sh @@ -4,14 +4,14 @@ set -euo pipefail PROJECT="go-chrome-ai" DESCRIPTION="Patch Chrome Local State to enable Ask Gemini and other AI features" -CHECKSUMS_FILE="dist/SHA256SUMS" +CHECKSUMS_FILE="dist/checksums.txt" OWNER="" REPO="${PROJECT}" VERSION="" usage() { echo "Render a cask for https://github.com/itamaker/homebrew-tap" >&2 - echo "Usage: $0 --owner --version [--repo ] [--checksums ]" >&2 + echo "Usage: $0 --owner --version [--repo ] [--checksums ]" >&2 } while [[ $# -gt 0 ]]; do @@ -51,7 +51,7 @@ fi checksum_for() { local arch="$1" - local artifact="${PROJECT}-darwin-${arch}.tar.gz" + local artifact="${PROJECT}_${VERSION}_darwin_${arch}.tar.gz" awk -v artifact="${artifact}" '$2 == artifact { print $1 }' "${CHECKSUMS_FILE}" } @@ -73,7 +73,7 @@ cask "${PROJECT}" do sha256 arm: "${darwin_arm64}", intel: "${darwin_amd64}" - url "https://github.com/${OWNER}/${REPO}/releases/download/v#{version}/${PROJECT}-darwin-#{arch}.tar.gz" + url "https://github.com/${OWNER}/${REPO}/releases/download/v#{version}/${PROJECT}_#{version}_darwin_#{arch}.tar.gz" name "${PROJECT}" desc "${DESCRIPTION}" homepage "https://github.com/${OWNER}/${REPO}"