From c1e4107ea97444cab573c29a9cecbb98f8027334 Mon Sep 17 00:00:00 2001 From: Yar Kravtsov Date: Sat, 24 May 2025 09:31:37 +0300 Subject: [PATCH] feat: integrate Homebrew tap and enhance release process --- .github/workflows/release.yml | 4 ++- .goreleaser.yml | 33 +++++++++++++++++-------- README.md | 8 ++++-- RELEASE.md | 46 ++++++++++++++++++++++++++++++----- 4 files changed, 72 insertions(+), 19 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a424ea4..58fd889 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -32,4 +32,6 @@ jobs: version: latest args: release --clean env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # If you have a personal access token for cross-repo access, use it instead: + # GITHUB_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }} \ No newline at end of file diff --git a/.goreleaser.yml b/.goreleaser.yml index f521bc2..c84f651 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -98,22 +98,35 @@ release: wget https://github.com/yarlson/lnk/releases/download/{{.Tag}}/lnk_{{.Os}}_{{.Arch}}.tar.gz tar -xzf lnk_{{.Os}}_{{.Arch}}.tar.gz sudo mv lnk /usr/local/bin/ + + # Homebrew + brew tap yarlson/lnk + brew install lnk ``` footer: | --- **Full Changelog**: https://github.com/yarlson/lnk/compare/{{.PreviousTag}}...{{.Tag}} -# Homebrew tap (optional - you can enable this later) -# brews: -# - repository: -# owner: yarlson -# name: homebrew-tap -# homepage: "https://github.com/yarlson/lnk" -# description: "Git-native dotfiles management" -# license: "MIT" -# test: | -# system "#{bin}/lnk --version" +# Homebrew tap +brews: + - repository: + owner: yarlson + name: homebrew-lnk + branch: main + token: "{{ .Env.GITHUB_TOKEN }}" + homepage: "https://github.com/yarlson/lnk" + description: "Git-native dotfiles management that doesn't suck" + license: "MIT" + skip_upload: auto + commit_author: + name: goreleaserbot + email: bot@goreleaser.com + commit_msg_template: "Brew formula update for {{ .ProjectName }} version {{ .Tag }}" + test: | + system "#{bin}/lnk --version" + install: | + bin.install "lnk" # Docker images (optional) # dockers: diff --git a/README.md b/README.md index 9a26d37..39fff91 100644 --- a/README.md +++ b/README.md @@ -13,10 +13,14 @@ lnk push "setup" ## Install ```bash -# Quick +# Quick install (recommended) curl -sSL https://raw.githubusercontent.com/yarlson/lnk/main/install.sh | bash -# Manual +# Homebrew (macOS/Linux) +brew tap yarlson/lnk +brew install lnk + +# Manual download wget https://github.com/yarlson/lnk/releases/latest/download/lnk-$(uname -s | tr '[:upper:]' '[:lower:]')-amd64 chmod +x lnk-* && sudo mv lnk-* /usr/local/bin/lnk diff --git a/RELEASE.md b/RELEASE.md index 313247a..4f974af 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -8,6 +8,7 @@ This document describes how to create releases for the lnk project using GoRelea - Git tags pushed to GitHub trigger releases automatically - GoReleaser is configured in `.goreleaser.yml` - GitHub Actions will handle the release process +- Access to the [homebrew-lnk](https://github.com/yarlson/homebrew-lnk) tap repository ## Creating a Release @@ -39,6 +40,7 @@ git push origin v1.0.0 - GitHub Actions will automatically build and release when the tag is pushed - Check the [Actions tab](https://github.com/yarlson/lnk/actions) for build status - The release will appear in [GitHub Releases](https://github.com/yarlson/lnk/releases) +- The Homebrew formula will be automatically updated in [homebrew-lnk](https://github.com/yarlson/homebrew-lnk) ## What GoReleaser Does @@ -59,6 +61,8 @@ git push origin v1.0.0 - Installation instructions - Download links for all platforms +5. **Updates Homebrew formula** automatically in the [homebrew-lnk](https://github.com/yarlson/homebrew-lnk) tap + ## Manual Release (if needed) If you need to create a release manually: @@ -84,6 +88,29 @@ ls -la dist/ ./dist/lnk_/lnk --version ``` +## Installation Methods + +After a release is published, users can install lnk using multiple methods: + +### 1. Shell Script (Recommended) +```bash +curl -sSL https://raw.githubusercontent.com/yarlson/lnk/main/install.sh | bash +``` + +### 2. Homebrew (macOS/Linux) +```bash +brew tap yarlson/lnk +brew install lnk +``` + +### 3. Manual Download +```bash +# Download from GitHub releases +wget https://github.com/yarlson/lnk/releases/latest/download/lnk_Linux_x86_64.tar.gz +tar -xzf lnk_Linux_x86_64.tar.gz +sudo mv lnk /usr/local/bin/ +``` + ## Version Numbering We use [Semantic Versioning](https://semver.org/): @@ -102,13 +129,13 @@ GoReleaser automatically generates changelogs from git commits using conventiona - `test:` - Test changes (excluded from changelog) - `ci:` - CI changes (excluded from changelog) -## Installation Script +## Homebrew Tap -The `install.sh` script automatically downloads the latest release: +The Homebrew formula is automatically maintained in the [homebrew-lnk](https://github.com/yarlson/homebrew-lnk) repository. When a new release is created: -```bash -curl -sSL https://raw.githubusercontent.com/yarlson/lnk/main/install.sh | bash -``` +1. GoReleaser automatically creates/updates the formula +2. The formula is committed to the tap repository +3. Users can immediately install the new version via `brew install yarlson/lnk/lnk` ## Troubleshooting @@ -128,4 +155,11 @@ curl -sSL https://raw.githubusercontent.com/yarlson/lnk/main/install.sh | bash 1. Ensure commits follow conventional commit format 2. Check that there are commits since the last tag -3. Verify changelog configuration in `.goreleaser.yml` \ No newline at end of file +3. Verify changelog configuration in `.goreleaser.yml` + +### Homebrew formula not updated + +1. Check that the GITHUB_TOKEN has access to the homebrew-lnk repository +2. Verify the repository name and owner in `.goreleaser.yml` +3. Check the release workflow logs for Homebrew-related errors +4. Ensure the homebrew-lnk repository exists and is accessible \ No newline at end of file