Skip to content

Commit

Permalink
feat: support install through homebrew
Browse files Browse the repository at this point in the history
justlorain committed Jan 31, 2025
1 parent 4f090c6 commit c24940e
Showing 2 changed files with 88 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/homebrew-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: goreleaser

on:
push:
tags:
- '*'

permissions:
contents: write

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
-
name: Set up Go
uses: actions/setup-go@v5
-
name: Get current date
run: echo "CURRENT_DATE=$(date +%Y%m%d)" >> $GITHUB_ENV
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: '~> v2'
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }}
IMAGE_NAME: ${{ github.repository }}
52 changes: 52 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
version: 2

project_name: nwa

before:
hooks:
- go mod tidy

builds:
- env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin

archives:
- formats: [ 'tar.gz' ]
name_template: >-
{{ .ProjectName }}_
{{- title .Os }}_
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
{{- if .Arm }}v{{ .Arm }}{{ end }}
format_overrides:
- goos: windows
formats: [ 'zip' ]

checksum:
name_template: "checksums.txt"

release:
name_template: "{{ .Version }} ({{ .Env.CURRENT_DATE }})"

brews:
- description: "NWA - A More Powerful License Header Management Tool"
homepage: https://github.com/B1NARY-GR0UP/nwa
repository:
owner: B1NARY-GR0UP
name: homebrew-nwa
branch: main
token: "{{ .Env.HOMEBREW_TAP_GITHUB_TOKEN }}"
directory: Formula
commit_author:
name: goreleaserbot
email: [email protected]
license: Apache-2.0
install: |
bin.install "nwa"
test: |
system "#{bin}/nwa --version"

0 comments on commit c24940e

Please sign in to comment.