Skip to content

Commit ccce0dd

Browse files
authored
ci: migrate release pipeline to GoReleaser (#46)
Same proven pattern from esq-cli (validated end-to-end on v1.1.3): replace the hand-rolled bash release pipeline with GoReleaser v2. Differences from esq-cli config: - Added -X main.date ldflag (atl-cli uses version, commit, and date) - Formula name: atl - Formula description matches the repo description
1 parent 28e4037 commit ccce0dd

2 files changed

Lines changed: 85 additions & 106 deletions

File tree

‎.github/workflows/release.yml‎

Lines changed: 16 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -27,111 +27,21 @@ jobs:
2727
- name: Run tests
2828
run: go test -v -race ./...
2929

30-
- name: Build binaries
31-
run: |
32-
VERSION=${GITHUB_REF_NAME}
33-
COMMIT=$(git rev-parse --short HEAD)
34-
DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
35-
LDFLAGS="-s -w -X main.version=${VERSION} -X main.commit=${COMMIT} -X main.date=${DATE}"
36-
37-
mkdir -p dist
38-
39-
# Build for each platform
40-
platforms=(
41-
"linux/amd64"
42-
"linux/arm64"
43-
"darwin/amd64"
44-
"darwin/arm64"
45-
"windows/amd64"
46-
"windows/arm64"
47-
)
48-
49-
for platform in "${platforms[@]}"; do
50-
GOOS=${platform%/*}
51-
GOARCH=${platform#*/}
52-
53-
output_name="atl-${GOOS}-${GOARCH}"
54-
if [ "$GOOS" = "windows" ]; then
55-
output_name+=".exe"
56-
fi
57-
58-
echo "Building $output_name..."
59-
GOOS=$GOOS GOARCH=$GOARCH go build -ldflags "${LDFLAGS}" -o "dist/${output_name}" ./cmd/atl
60-
done
61-
62-
# Create archives
63-
cd dist
64-
for file in atl-*; do
65-
if [[ "$file" == *.exe ]]; then
66-
zip "${file%.exe}.zip" "$file"
67-
rm "$file"
68-
else
69-
tar czf "${file}.tar.gz" "$file"
70-
rm "$file"
71-
fi
72-
done
73-
74-
# Generate checksums
75-
sha256sum * > checksums.txt
76-
77-
- name: Generate changelog
78-
id: changelog
79-
run: |
80-
# Get previous tag
81-
PREV_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "")
82-
83-
if [ -n "$PREV_TAG" ]; then
84-
echo "Generating changelog from $PREV_TAG to $GITHUB_REF_NAME"
85-
CHANGELOG=$(git log --pretty=format:"- %s (%h)" "$PREV_TAG".."$GITHUB_REF_NAME" --no-merges)
86-
else
87-
echo "No previous tag found, including all commits"
88-
CHANGELOG=$(git log --pretty=format:"- %s (%h)" --no-merges)
89-
fi
90-
91-
# Escape for GitHub Actions
92-
echo "changelog<<EOF" >> $GITHUB_OUTPUT
93-
echo "$CHANGELOG" >> $GITHUB_OUTPUT
94-
echo "EOF" >> $GITHUB_OUTPUT
95-
96-
- name: Create Release
97-
uses: softprops/action-gh-release@v2
30+
- name: Generate GitHub App token for tap
31+
id: app-token
32+
uses: actions/create-github-app-token@v2
9833
with:
99-
name: ${{ github.ref_name }}
100-
body: |
101-
## What's Changed
102-
103-
${{ steps.changelog.outputs.changelog }}
104-
105-
## Installation
106-
107-
### macOS (Apple Silicon)
108-
```bash
109-
curl -L https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/atl-darwin-arm64.tar.gz | tar xz
110-
chmod +x atl-darwin-arm64
111-
sudo mv atl-darwin-arm64 /usr/local/bin/atl
112-
```
113-
114-
### macOS (Intel)
115-
```bash
116-
curl -L https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/atl-darwin-amd64.tar.gz | tar xz
117-
chmod +x atl-darwin-amd64
118-
sudo mv atl-darwin-amd64 /usr/local/bin/atl
119-
```
34+
app-id: ${{ secrets.HOMEBREW_TAP_APP_ID }}
35+
private-key: ${{ secrets.HOMEBREW_TAP_APP_PRIVATE_KEY }}
36+
owner: enthus-appdev
37+
repositories: homebrew-tap
12038

121-
### Linux (x64)
122-
```bash
123-
curl -L https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/atl-linux-amd64.tar.gz | tar xz
124-
chmod +x atl-linux-amd64
125-
sudo mv atl-linux-amd64 /usr/local/bin/atl
126-
```
127-
128-
### Windows
129-
Download `atl-windows-amd64.zip` (or `atl-windows-arm64.zip` for ARM) and add to your PATH.
130-
131-
## Checksums
132-
133-
See `checksums.txt` for SHA256 checksums of all binaries.
134-
files: |
135-
dist/*
136-
draft: false
137-
prerelease: ${{ contains(github.ref_name, '-') }}
39+
- name: Run GoReleaser
40+
uses: goreleaser/goreleaser-action@v6
41+
with:
42+
distribution: goreleaser
43+
version: "~> v2"
44+
args: release --clean
45+
env:
46+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47+
HOMEBREW_TAP_TOKEN: ${{ steps.app-token.outputs.token }}

‎.goreleaser.yml‎

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
version: 2
2+
3+
project_name: atl
4+
5+
builds:
6+
- main: ./cmd/atl
7+
binary: atl
8+
env:
9+
- CGO_ENABLED=0
10+
goos:
11+
- linux
12+
- darwin
13+
- windows
14+
goarch:
15+
- amd64
16+
- arm64
17+
ldflags:
18+
- -s -w
19+
- -X main.version={{.Version}}
20+
- -X main.commit={{.ShortCommit}}
21+
- -X main.date={{.Date}}
22+
23+
archives:
24+
- formats:
25+
- tar.gz
26+
format_overrides:
27+
- goos: windows
28+
formats:
29+
- zip
30+
31+
checksum:
32+
name_template: checksums.txt
33+
34+
changelog:
35+
sort: asc
36+
37+
release:
38+
github:
39+
owner: enthus-appdev
40+
name: atl-cli
41+
header: |
42+
## Installation
43+
44+
### Homebrew (macOS and Linux)
45+
```bash
46+
brew install enthus-appdev/tap/atl
47+
```
48+
49+
### Binary download
50+
Download the archive for your platform below, extract, and add to your PATH.
51+
52+
brews:
53+
- name: atl
54+
repository:
55+
owner: enthus-appdev
56+
name: homebrew-tap
57+
token: "{{ .Env.HOMEBREW_TAP_TOKEN }}"
58+
directory: Formula
59+
homepage: https://github.com/enthus-appdev/atl-cli
60+
description: "Jira and Confluence CLI - a CLI alternative to the Atlassian MCP"
61+
license: MIT
62+
commit_author:
63+
name: enthus-appdev-tap-bumper[bot]
64+
email: 275364917+enthus-appdev-tap-bumper[bot]@users.noreply.github.com
65+
commit_msg_template: "chore(formula): bump {{ .ProjectName }} to {{ .Tag }}"
66+
test: |
67+
assert_match version.to_s, shell_output("#{bin}/atl --version")
68+
install: |
69+
bin.install "atl"

0 commit comments

Comments
 (0)