From 1796da8ef9012b52e04112355528312a164d906c Mon Sep 17 00:00:00 2001 From: Jon Fox Date: Wed, 1 Oct 2025 12:22:11 -0700 Subject: [PATCH 1/4] Add release automation and installation tooling --- .github/workflows/release.yml | 46 ++++++++++++++++++++ .goreleaser.yaml | 62 +++++++++++++++++++++++++++ README.md | 35 ++++++++++++++- install/install-redirect.html | 14 ++++++ install/install.sh | 80 +++++++++++++++++++++++++++++++++++ 5 files changed, 236 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/release.yml create mode 100644 .goreleaser.yaml create mode 100644 install/install-redirect.html create mode 100755 install/install.sh diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..045ccca --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,46 @@ +name: Release + +on: + push: + tags: + - 'v*' + +permissions: + contents: write + packages: write + +jobs: + release: + 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-file: go.mod + + - name: Set up Go module cache + uses: actions/cache@v4 + with: + path: | + ~/.cache/go-build + ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + + - name: Install GoReleaser + uses: goreleaser/goreleaser-action@v6 + with: + version: latest + distribution: goreleaser + install-only: true + + - name: Run GoReleaser + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: goreleaser release --clean diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 0000000..b608c87 --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,62 @@ +project_name: devx +before: + hooks: + - go test ./... + +builds: + - id: devx + main: ./main.go + binary: devx + env: + - CGO_ENABLED=0 + goos: + - darwin + - linux + goarch: + - amd64 + - arm64 + ldflags: + - -s -w + - -X github.com/jfox85/devx/version.Version={{.Version}} + - -X github.com/jfox85/devx/version.GitCommit={{.ShortCommit}} + - -X github.com/jfox85/devx/version.BuildDate={{.Date}} + +archives: + - format: tar.gz + name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}" + files: + - LICENSE + - README.md + strip_parent_binary_folder: true + wrap_in_directory: false + +checksums: + name_template: "checksums.txt" + +snapshot: + name_template: "{{ .Tag }}-SNAPSHOT" + +changelog: + use: git + +brews: + - name: devx + homepage: https://github.com/jfox85/devx + description: "A macOS development environment manager" + license: "MIT" + commit_author: + name: toneclone-bot + email: opensource@toneclone.dev + tap: + owner: toneclone + name: toneclone + test: | + system "#{bin}/devx", "--version" + install: | + bin.install "devx" + dependencies: + - name: go + type: optional + +announce: + skip: true diff --git a/README.md b/README.md index 67b2913..796396c 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,39 @@ A macOS CLI tool for managing local development environments with Git worktrees, ## Installation +### Homebrew (macOS & Linux) + +```bash +brew tap toneclone/toneclone +brew install devx +``` + +### go install (requires Go 1.22+) + +```bash +go install github.com/jfox85/devx@latest +``` + +### Universal install script + +```bash +curl -fsSL https://raw.githubusercontent.com/jfox85/devx/main/install/install.sh | bash +``` + +Set `DEVX_INSTALL_DIR` or `DEVX_VERSION` to customize the installation: + +```bash +curl -fsSL https://raw.githubusercontent.com/jfox85/devx/main/install/install.sh \ + | DEVX_INSTALL_DIR=$HOME/.local/bin DEVX_VERSION=v1.2.3 bash +``` + +### Direct binary download + +Download the appropriate archive from the [releases page](https://github.com/jfox85/devx/releases), extract it, and move the +`devx` binary into your `PATH`. + +### Build from source + ```bash git clone https://github.com/jfox85/devx cd devx @@ -41,7 +74,7 @@ make build mv devx /usr/local/bin/ ``` -**Alternative installation methods:** +**Alternative build targets:** ```bash # Development build (no version info) make dev diff --git a/install/install-redirect.html b/install/install-redirect.html new file mode 100644 index 0000000..5252854 --- /dev/null +++ b/install/install-redirect.html @@ -0,0 +1,14 @@ + + + + + + Install devx + + +

+ Redirecting to the latest install script. If you are not automatically redirected, + click here. +

+ + diff --git a/install/install.sh b/install/install.sh new file mode 100755 index 0000000..604d52a --- /dev/null +++ b/install/install.sh @@ -0,0 +1,80 @@ +#!/usr/bin/env bash +set -euo pipefail + +REPO="jfox85/devx" +INSTALL_DIR="${DEVX_INSTALL_DIR:-/usr/local/bin}" +VERSION="${DEVX_VERSION:-latest}" + +usage() { + cat </dev/null 2>&1 || { echo "curl is required to install devx" >&2; exit 1; } +command -v tar >/dev/null 2>&1 || { echo "tar is required to install devx" >&2; exit 1; } + +if [[ "${1:-}" == "-h" || "${1:-}" == "--help" ]]; then + usage + exit 0 +fi + +os="$(uname -s | tr '[:upper:]' '[:lower:]')" +arch="$(uname -m)" + +case "$os" in + linux|darwin) + ;; + *) + echo "Unsupported operating system: $os" >&2 + exit 1 + ;; +esac + +case "$arch" in + x86_64|amd64) + arch="amd64" + ;; + arm64|aarch64) + arch="arm64" + ;; + *) + echo "Unsupported architecture: $arch" >&2 + exit 1 + ;; +esac + +if [[ "$VERSION" == "latest" ]]; then + VERSION="$(curl -fsSL "https://api.github.com/repos/${REPO}/releases/latest" | \ + grep -m1 '"tag_name"' | sed -E 's/.*"([^"]+)".*/\1/')" + if [[ -z "$VERSION" ]]; then + echo "Unable to determine latest release version" >&2 + exit 1 + fi +else + if [[ "$VERSION" != v* ]]; then + VERSION="v${VERSION}" + fi +fi + +asset="devx_${VERSION}_${os}_${arch}.tar.gz" +url="https://github.com/${REPO}/releases/download/${VERSION}/${asset}" + +workdir="$(mktemp -d)" +trap 'rm -rf "$workdir"' EXIT + +echo "Downloading ${asset}..." +curl -fsSL "${url}" -o "${workdir}/${asset}" + +echo "Extracting devx..." +tar -xzf "${workdir}/${asset}" -C "${workdir}" + +mkdir -p "${INSTALL_DIR}" +install -m 0755 "${workdir}/devx" "${INSTALL_DIR}/devx" + +echo "devx installed to ${INSTALL_DIR}/devx" +"${INSTALL_DIR}/devx" --version || true From 95d71e78009b0e3e9be313ff9d0aa98d74ed3a1a Mon Sep 17 00:00:00 2001 From: Jon Fox Date: Wed, 1 Oct 2025 13:45:36 -0700 Subject: [PATCH 2/4] Fix installer asset lookup and tap metadata --- .goreleaser.yaml | 8 ++++---- install/install.sh | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.goreleaser.yaml b/.goreleaser.yaml index b608c87..7daccab 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -45,11 +45,11 @@ brews: description: "A macOS development environment manager" license: "MIT" commit_author: - name: toneclone-bot - email: opensource@toneclone.dev + name: devx-bot + email: devx@jonefox.com tap: - owner: toneclone - name: toneclone + owner: jfox85 + name: homebrew-devx test: | system "#{bin}/devx", "--version" install: | diff --git a/install/install.sh b/install/install.sh index 604d52a..18dfa8f 100755 --- a/install/install.sh +++ b/install/install.sh @@ -61,7 +61,8 @@ else fi fi -asset="devx_${VERSION}_${os}_${arch}.tar.gz" +asset_version="${VERSION#v}" +asset="devx_${asset_version}_${os}_${arch}.tar.gz" url="https://github.com/${REPO}/releases/download/${VERSION}/${asset}" workdir="$(mktemp -d)" From 76653d9c8487ad4604c6b3f4710c87f9c9f83435 Mon Sep 17 00:00:00 2001 From: Jon Fox Date: Wed, 1 Oct 2025 13:45:40 -0700 Subject: [PATCH 3/4] Update Homebrew tap instructions --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 796396c..0ec4a11 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ A macOS CLI tool for managing local development environments with Git worktrees, ### Homebrew (macOS & Linux) ```bash -brew tap toneclone/toneclone +brew tap jfox85/homebrew-devx brew install devx ``` From 345e94b48ee68d1c9a7e906a29c8760b4c34d32c Mon Sep 17 00:00:00 2001 From: Jon Fox Date: Wed, 1 Oct 2025 14:22:03 -0700 Subject: [PATCH 4/4] Fix GoReleaser v2 compatibility and complete release setup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Update .goreleaser.yaml to v2 format (version: 2) - Change deprecated 'tap' to 'repository' field - Remove deprecated fields: snapshot.name_template, archives.format, checksums, strip_parent_binary_folder - Add HOMEBREW_TAP_GITHUB_TOKEN support for cross-repo Homebrew tap updates - Remove unnecessary Go dependency from Homebrew formula - Add MIT license content to LICENSE file 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .github/workflows/release.yml | 1 + .goreleaser.yaml | 17 ++++------------- LICENSE | 21 +++++++++++++++++++++ 3 files changed, 26 insertions(+), 13 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 045ccca..2f78e7f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -43,4 +43,5 @@ jobs: - name: Run GoReleaser env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }} run: goreleaser release --clean diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 7daccab..7936d49 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -1,3 +1,4 @@ +version: 2 project_name: devx before: hooks: @@ -22,20 +23,12 @@ builds: - -X github.com/jfox85/devx/version.BuildDate={{.Date}} archives: - - format: tar.gz - name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}" + - name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}" files: - LICENSE - README.md - strip_parent_binary_folder: true wrap_in_directory: false -checksums: - name_template: "checksums.txt" - -snapshot: - name_template: "{{ .Tag }}-SNAPSHOT" - changelog: use: git @@ -47,16 +40,14 @@ brews: commit_author: name: devx-bot email: devx@jonefox.com - tap: + repository: owner: jfox85 name: homebrew-devx + token: "{{ .Env.HOMEBREW_TAP_GITHUB_TOKEN }}" test: | system "#{bin}/devx", "--version" install: | bin.install "devx" - dependencies: - - name: go - type: optional announce: skip: true diff --git a/LICENSE b/LICENSE index e69de29..f638c93 100644 --- a/LICENSE +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2025 jfox85 + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE.