feat: integrate Homebrew tap and enhance release process

This commit is contained in:
Yar Kravtsov
2025-05-24 09:31:37 +03:00
parent 398d011270
commit c1e4107ea9
4 changed files with 72 additions and 19 deletions

View File

@@ -32,4 +32,6 @@ jobs:
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
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 }}

View File

@@ -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:

View File

@@ -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

View File

@@ -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_<platform>/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`
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