Skip to content

Commit 9c753e1

Browse files
committed
Update goreleaser for v2-alpha
1 parent 70f7726 commit 9c753e1

File tree

6 files changed

+125
-57
lines changed

6 files changed

+125
-57
lines changed

.github/workflows/release.yml

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,33 @@ jobs:
2424
run: make
2525
- name: Test
2626
run: go test
27-
- name: Run GoReleaser
27+
- name: Determine GoReleaser config
28+
id: config
29+
run: |
30+
if [[ "${{ github.ref }}" =~ ^refs/tags/v2\.0\.0-alpha ]]; then
31+
echo "config_file=.goreleaser.v2-alpha.yml" >> $GITHUB_OUTPUT
32+
echo "release_type=alpha" >> $GITHUB_OUTPUT
33+
else
34+
echo "config_file=.goreleaser.yaml" >> $GITHUB_OUTPUT
35+
echo "release_type=stable" >> $GITHUB_OUTPUT
36+
fi
37+
38+
- name: Run GoReleaser (Alpha)
39+
if: steps.config.outputs.release_type == 'alpha'
40+
uses: goreleaser/goreleaser-action@v6
41+
with:
42+
version: "~> v2"
43+
args: release --config=${{ steps.config.outputs.config_file }} --clean
44+
env:
45+
# set github personal access token in order to generate brew formula to external repository
46+
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
47+
48+
- name: Run GoReleaser (Stable)
49+
if: steps.config.outputs.release_type == 'stable'
2850
uses: goreleaser/goreleaser-action@v6
2951
with:
3052
version: "~> v2"
31-
args: release --clean
53+
args: release --config=${{ steps.config.outputs.config_file }} --clean
3254
env:
3355
# set github personal access token in order to generate brew formula to external repository
3456
GITHUB_TOKEN: ${{ secrets.GH_PAT }}

.goreleaser.v2-alpha.yml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# GoReleaser configuration for alpha releases (v2.0.0-alpha.*)
2+
# This generates aurl-alpha formula that installs the binary as "aurl-alpha"
3+
4+
version: 2
5+
6+
before:
7+
hooks:
8+
- go mod tidy
9+
10+
builds:
11+
- env:
12+
- CGO_ENABLED=0
13+
goos:
14+
- linux
15+
- windows
16+
- darwin
17+
18+
archives:
19+
- name_template: >-
20+
{{ .ProjectName }}_
21+
{{- title .Os }}_
22+
{{- if eq .Arch "amd64" }}x86_64
23+
{{- else if eq .Arch "386" }}i386
24+
{{- else }}{{ .Arch }}{{ end }}
25+
{{- if .Arm }}v{{ .Arm }}{{ end }}
26+
format_overrides:
27+
- goos: windows
28+
format: zip
29+
files:
30+
- README.md
31+
- LICENSE*
32+
33+
checksum:
34+
name_template: 'checksums.txt'
35+
36+
changelog:
37+
sort: asc
38+
filters:
39+
exclude:
40+
- '^docs:'
41+
- '^test:'
42+
43+
brews:
44+
- name: aurl-alpha
45+
# Always upload alpha releases
46+
skip_upload: false
47+
48+
# GitHub/GitLab repository to push the formula to
49+
repository:
50+
owner: classmethod
51+
name: homebrew-repos
52+
53+
# Git author used to commit to the repository
54+
commit_author:
55+
name: goreleaserbot
56+
57+
58+
# Commit message template
59+
commit_msg_template: "Brew formula update for {{ .ProjectName }} alpha version {{ .Tag }}"
60+
61+
# Directory inside the repository to put the formula
62+
directory: Formula
63+
64+
# Homepage of the project
65+
homepage: "https://github.com/classmethod/aurl"
66+
67+
# Description of the project
68+
description: "URL Command Line Tool with Authentication Support (v2 alpha build)"
69+
70+
# Install binary with alpha suffix to avoid conflicts
71+
install: |
72+
bin.install "aurl" => "aurl-alpha"
73+
74+
# Test script for brew
75+
test: |
76+
system "#{bin}/aurl-alpha --version"
77+
78+
# Add conflicts_with to prevent installing both stable and alpha
79+
custom_block: |
80+
conflicts_with "aurl", because: "both install similar binaries"
81+
82+
# modelines, feel free to remove those if you don't want/use them:
83+
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
84+
# vim: set ts=2 sw=2 tw=0 fo=cnqoj

.goreleaser.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ changelog:
4949
brews:
5050
- name: aurl
5151
# Skip Homebrew update for pre-releases (beta versions)
52+
# This ensures only stable releases (v1.x.y, v2.0.0) are published
5253
skip_upload: auto
5354

5455
# GitHub/GitLab repository to push the formula to
@@ -71,6 +72,7 @@ brews:
7172
homepage: "https://github.com/classmethod/aurl"
7273

7374
# Description of the project
75+
# This will serve v1.x.y now, and v2.0.0+ when stable
7476
description: "URL Command Line Tool with Authentication Support"
7577

7678
# Custom install script for brew
@@ -80,3 +82,7 @@ brews:
8082
# Test script for brew
8183
test: |
8284
system "#{bin}/aurl --version"
85+
86+
# Add conflicts_with to prevent installing both stable and alpha
87+
custom_block: |
88+
conflicts_with "aurl-alpha", because: "both install 'aurl' binary"

README.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,27 @@ You can install the pre-compiled binary by either following the steps.
2121

2222
### homebrew
2323

24-
For stable releases:
24+
**Stable version (v1.x - recommended for most users):**
2525

2626
```bash
2727
brew tap classmethod/repos
2828
brew install aurl
2929
```
3030

31-
For v2 alpha releases:
31+
**Alpha version (v2.0.0-alpha - for early testers):**
3232

3333
```bash
34-
# macOS: Use Cask (precompiled binary)
35-
brew install --cask https://raw.githubusercontent.com/classmethod/aurl/master/prerelease/casks/aurl-v2-alpha.rb
36-
37-
# Linux: Use Formula (precompiled binary)
38-
brew install https://raw.githubusercontent.com/classmethod/aurl/master/prerelease/Formula/aurl-v2-alpha.rb
34+
brew tap classmethod/repos
35+
brew install aurl-alpha
3936
```
4037

38+
**Notes:**
39+
40+
- `aurl` and `aurl-alpha` cannot be installed simultaneously (they conflict)
41+
- The alpha version installs the binary as `aurl-alpha` to allow side-by-side testing
42+
- When v2 becomes stable, `brew upgrade aurl` will seamlessly migrate you from v1 to v2
43+
- To switch from alpha to stable: `brew uninstall aurl-alpha && brew install aurl`
44+
4145
### scoop
4246

4347
TBD

prerelease/Formula/aurl-v2-alpha.rb

Lines changed: 0 additions & 29 deletions
This file was deleted.

prerelease/casks/aurl-v2-alpha.rb

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)