diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..2f78e7f --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,47 @@ +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 }} + HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }} + run: goreleaser release --clean diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 0000000..7936d49 --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,53 @@ +version: 2 +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: + - name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}" + files: + - LICENSE + - README.md + wrap_in_directory: false + +changelog: + use: git + +brews: + - name: devx + homepage: https://github.com/jfox85/devx + description: "A macOS development environment manager" + license: "MIT" + commit_author: + name: devx-bot + email: devx@jonefox.com + repository: + owner: jfox85 + name: homebrew-devx + token: "{{ .Env.HOMEBREW_TAP_GITHUB_TOKEN }}" + test: | + system "#{bin}/devx", "--version" + install: | + bin.install "devx" + +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. diff --git a/README.md b/README.md index 67b2913..0ec4a11 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 jfox85/homebrew-devx +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 @@ + + +
+ + ++ 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..18dfa8f --- /dev/null +++ b/install/install.sh @@ -0,0 +1,81 @@ +#!/usr/bin/env bash +set -euo pipefail + +REPO="jfox85/devx" +INSTALL_DIR="${DEVX_INSTALL_DIR:-/usr/local/bin}" +VERSION="${DEVX_VERSION:-latest}" + +usage() { + cat <