Skip to content

Commit 3648269

Browse files
authored
Merge pull request #20 from DevopsArtFactory/codex/goreleaser-homebrew-release
build: automate releases and homebrew tap updates with goreleaser
2 parents c90e0be + 2435f83 commit 3648269

File tree

3 files changed

+97
-23
lines changed

3 files changed

+97
-23
lines changed

.github/workflows/release.yml

Lines changed: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Release
33
on:
44
push:
55
tags:
6-
- 'v*'
6+
- "v*"
77
workflow_dispatch:
88

99
permissions:
@@ -14,39 +14,34 @@ jobs:
1414
runs-on: ubuntu-latest
1515

1616
steps:
17-
- name: Checkout
17+
- name: Checkout repository
1818
uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
1921

2022
- name: Setup Go
2123
uses: actions/setup-go@v5
2224
with:
2325
go-version-file: go.mod
2426

25-
- name: Build release packages
27+
- name: Run GoReleaser
28+
uses: goreleaser/goreleaser-action@v6
29+
with:
30+
distribution: goreleaser
31+
version: "~> v2"
32+
args: release --clean
2633
env:
27-
VERSION: ${{ github.ref_name }}
28-
COMMIT: ${{ github.sha }}
29-
run: |
30-
set -euo pipefail
31-
SHORT_COMMIT="$(echo "$COMMIT" | cut -c1-7)"
32-
make package VERSION="$VERSION" COMMIT="$SHORT_COMMIT"
34+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35+
HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }}
3336

34-
- name: Upload workflow artifact
37+
- name: Upload workflow artifacts
3538
uses: actions/upload-artifact@v4
3639
with:
3740
name: ende-release-${{ github.ref_name }}
3841
path: |
39-
dist/ende*
40-
dist/packages/*
42+
dist/ende-*
43+
dist/*.tar.gz
44+
dist/*.zip
45+
dist/SHA256SUMS
46+
dist/homebrew/ende.rb
4147
if-no-files-found: error
42-
43-
- name: Create GitHub Release and upload assets
44-
uses: softprops/action-gh-release@v2
45-
with:
46-
tag_name: ${{ github.ref_name }}
47-
generate_release_notes: true
48-
files: |
49-
dist/ende*
50-
dist/packages/*.tar.gz
51-
dist/packages/*.zip
52-
dist/packages/SHA256SUMS

.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: ende
4+
5+
before:
6+
hooks:
7+
- go test ./...
8+
9+
builds:
10+
- id: ende
11+
main: ./cmd/ende
12+
binary: ende
13+
env:
14+
- CGO_ENABLED=0
15+
goos:
16+
- darwin
17+
- linux
18+
- windows
19+
goarch:
20+
- amd64
21+
- arm64
22+
ldflags:
23+
- -s -w -X main.version={{ .Version }} -X main.commit={{ .ShortCommit }} -X main.date={{ .Date }}
24+
25+
archives:
26+
- id: binaries
27+
ids:
28+
- ende
29+
formats:
30+
- binary
31+
name_template: "{{ .ProjectName }}-{{ .Os }}-{{ .Arch }}"
32+
33+
- id: packages
34+
ids:
35+
- ende
36+
name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
37+
formats:
38+
- tar.gz
39+
format_overrides:
40+
- goos: windows
41+
formats:
42+
- zip
43+
44+
checksum:
45+
name_template: "SHA256SUMS"
46+
47+
release:
48+
github:
49+
owner: DevopsArtFactory
50+
name: ende
51+
52+
brews:
53+
- ids:
54+
- packages
55+
name: ende
56+
directory: "."
57+
homepage: "https://github.com/DevopsArtFactory/ende"
58+
description: "Secure CLI for DevOps teams to share secrets using public-key encryption and sender verification."
59+
license: "MIT"
60+
repository:
61+
owner: DevopsArtFactory
62+
name: homebrew-ende
63+
branch: main
64+
token: "{{ .Env.HOMEBREW_TAP_GITHUB_TOKEN }}"
65+
commit_author:
66+
name: github-actions[bot]
67+
email: 41898282+github-actions[bot]@users.noreply.github.com
68+
commit_msg_template: "Update Homebrew formula for {{ .ProjectName }} {{ .Tag }}"
69+
download_strategy: CurlDownloadStrategy

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ brew tap DevopsArtFactory/ende https://github.com/DevopsArtFactory/homebrew-ende
2323
brew install ende
2424
```
2525

26+
The Homebrew tap formula is updated automatically from Git tags through GoReleaser.
27+
2628
Upgrade:
2729
```bash
2830
brew update
@@ -34,6 +36,14 @@ Verify:
3436
ende --version
3537
```
3638

39+
## Release Automation
40+
- Tagged releases use GoReleaser to build macOS, Linux, and Windows binaries.
41+
- GoReleaser publishes release archives and raw binaries to GitHub Releases.
42+
- GoReleaser updates the Homebrew tap repository at [DevopsArtFactory/homebrew-ende](https://github.com/DevopsArtFactory/homebrew-ende).
43+
44+
Required GitHub Actions secret:
45+
- `HOMEBREW_TAP_GITHUB_TOKEN`: token with `contents: write` access to `DevopsArtFactory/homebrew-ende`
46+
3747
## Install from GitHub Release (Linux / Windows)
3848
Replace `vX.Y.Z` with the release tag.
3949

0 commit comments

Comments
 (0)