From f608b2ecdd7d5ca88371bb16063bbc136f425c96 Mon Sep 17 00:00:00 2001 From: zzxwill Date: Tue, 13 Jan 2026 21:04:47 +0800 Subject: [PATCH] feat(release): add automated release workflow with GoReleaser This commit introduces an automated release pipeline triggered by version tags. It adds GoReleaser configuration for building multi-platform binaries, generating checksums, and publishing GitHub releases. The workflow also includes Homebrew formula generation for easier installation on macOS and Linux. This automation ensures consistent and reliable releases while reducing manual deployment effort. --- .github/workflows/release.yml | 35 +++++++++++++++ .goreleaser.yml | 82 +++++++++++++++++++++++++++++++++++ Formula/agentx.rb | 53 ++++++++++++++++++++++ README.md | 14 ++++++ 4 files changed, 184 insertions(+) create mode 100644 .github/workflows/release.yml create mode 100644 .goreleaser.yml create mode 100644 Formula/agentx.rb diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..f08e9a7 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,35 @@ +name: Release + +on: + push: + tags: + - "v*" + +permissions: + contents: write + +jobs: + goreleaser: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: "1.25" + + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v6 + with: + distribution: goreleaser + version: "~> v2" + args: release --clean + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # For pushing to homebrew-tap repo, use a PAT with repo scope + # or use GITHUB_TOKEN if homebrew-tap allows it + HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }} diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 0000000..00870ca --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,82 @@ +# GoReleaser configuration for agentx +# Documentation: https://goreleaser.com + +version: 2 + +project_name: agentx + +before: + hooks: + - go mod tidy + +builds: + - id: agentx + main: . + binary: agentx + env: + - CGO_ENABLED=0 + goos: + - darwin + - linux + - windows + goarch: + - amd64 + - arm64 + ldflags: + - -s -w + - -X github.com/agentsdance/agentx/internal/version.Version={{.Version}} + - -X github.com/agentsdance/agentx/internal/version.GitCommit={{.ShortCommit}} + - -X github.com/agentsdance/agentx/internal/version.BuildDate={{.Date}} + +archives: + - id: default + formats: + - tar.gz + format_overrides: + - goos: windows + formats: + - zip + name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}" + files: + - LICENSE + - README.md + +checksum: + name_template: "checksums.txt" + algorithm: sha256 + +changelog: + sort: asc + filters: + exclude: + - "^docs:" + - "^test:" + - "^ci:" + - "^chore:" + - Merge pull request + - Merge branch + +release: + github: + owner: agentsdance + name: agentx + draft: false + prerelease: auto + name_template: "{{.ProjectName}} v{{.Version}}" + +brews: + - name: agentx + repository: + owner: agentsdance + name: agentx + folder: Formula + homepage: "https://github.com/agentsdance/agentx" + description: "CLI tool for managing MCP servers and skills across AI coding agents" + license: "Apache-2.0" + commit_author: + name: goreleaserbot + email: bot@goreleaser.com + install: | + bin.install "agentx" + test: | + system "#{bin}/agentx", "--version" diff --git a/Formula/agentx.rb b/Formula/agentx.rb new file mode 100644 index 0000000..0a27f0a --- /dev/null +++ b/Formula/agentx.rb @@ -0,0 +1,53 @@ +# typed: false +# frozen_string_literal: true + +# This formula is auto-generated by GoReleaser. +# Manual edits will be overwritten on the next release. +# +# To use this formula before it's published to the tap: +# brew install --build-from-source ./Formula/agentx.rb +# +# After publishing, users can install via: +# brew tap agentsdance/tap +# brew install agentx + +class Agentx < Formula + desc "CLI tool for managing MCP servers and skills across AI coding agents" + homepage "https://github.com/agentsdance/agentx" + license "Apache-2.0" + version "0.0.1" + + on_macos do + on_intel do + url "https://github.com/agentsdance/agentx/releases/download/v#{version}/agentx_#{version}_darwin_amd64.tar.gz" + # sha256 will be auto-populated by GoReleaser + sha256 "PLACEHOLDER_SHA256_DARWIN_AMD64" + end + + on_arm do + url "https://github.com/agentsdance/agentx/releases/download/v#{version}/agentx_#{version}_darwin_arm64.tar.gz" + # sha256 will be auto-populated by GoReleaser + sha256 "PLACEHOLDER_SHA256_DARWIN_ARM64" + end + end + + on_linux do + on_intel do + url "https://github.com/agentsdance/agentx/releases/download/v#{version}/agentx_#{version}_linux_amd64.tar.gz" + sha256 "PLACEHOLDER_SHA256_LINUX_AMD64" + end + + on_arm do + url "https://github.com/agentsdance/agentx/releases/download/v#{version}/agentx_#{version}_linux_arm64.tar.gz" + sha256 "PLACEHOLDER_SHA256_LINUX_ARM64" + end + end + + def install + bin.install "agentx" + end + + test do + system "#{bin}/agentx", "--version" + end +end diff --git a/README.md b/README.md index b949a8c..593bb94 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,20 @@ It provides both a command-line interface and an interactive terminal UI (TUI) f ## Installation +### Homebrew (macOS/Linux) + +```bash +# Add the tap +brew tap agentsdance/agentx + +# Install agentx +brew install agentx +``` + +### Download Binary + +Download the latest release from [GitHub Releases](https://github.com/agentsdance/agentx/releases). + ### Build from Source ```bash