Skip to content

Commit 0972bf0

Browse files
committed
ci: update release workflow and add Homebrew support
- Change the trigger for the release workflow from `release` events to `push` events with tags matching `v*`. - Add a new `homebrew` job to update the Homebrew formula using the `dawidd6/action-homebrew-bump-formula` action. - Add variables in `.goreleaser.yaml` for Homebrew configuration, including `homepage`, `description`, and commit author details. - Include a `brews` section in `.goreleaser.yaml` to configure the Homebrew tap repository and install completions for bash, zsh, and fish. Signed-off-by: codiing-hui <wecoding@yeah.net>
1 parent 86fc047 commit 0972bf0

File tree

2 files changed

+48
-2
lines changed

2 files changed

+48
-2
lines changed

.github/workflows/release.yml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,32 @@
33
name: Release
44

55
on:
6-
release:
7-
types: [ created ]
6+
push:
7+
tags: [ "v*" ]
88

99
permissions:
1010
contents: write
1111
packages: write
1212

1313
jobs:
14+
homebrew:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Update Homebrew formula
18+
uses: dawidd6/action-homebrew-bump-formula@v3
19+
with:
20+
# GitHub token, required, not the default one
21+
token: ${{secrets.TOKEN}}
22+
# Optional, defaults to homebrew/core
23+
tap: USER/REPO
24+
# Formula name, required
25+
formula: FORMULA
26+
# Optional, will be determined automatically
27+
tag: ${{github.ref}}
28+
# Optional, will be determined automatically
29+
revision: ${{github.sha}}
30+
# Optional, if don't want to check for already open PRs
31+
force: false # true
1432
build-go-binary:
1533
name: Release Go Binary
1634
runs-on: ubuntu-latest

.goreleaser.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,18 @@
88

99
version: 2
1010

11+
variables:
12+
main: ""
13+
aur_project_name: ""
14+
15+
homepage: "https://github.com/coding-hui/ai-terminal"
16+
brew_owner: coding-hui
17+
description: "AI driven development in your terminal"
18+
github_url: "https://github.com/coding-hui/ai-terminal"
19+
maintainer: "Coding Hui <wecoding@yeah.net>"
20+
brew_commit_author_name: "Coding Hui"
21+
brew_commit_author_email: "wecoding@yeah.net"
22+
1123
before:
1224
hooks:
1325
# You may remove this if you don't use go modules.
@@ -101,6 +113,22 @@ changelog:
101113

102114
report_sizes: true
103115

116+
brews:
117+
- repository:
118+
owner: "{{ .Var.brew_owner }}"
119+
name: homebrew-tap
120+
token: "{{ .Env.HOMEBREW_TAP_GITHUB_TOKEN }}"
121+
commit_author:
122+
name: "{{ .Var.brew_commit_author_name }}"
123+
email: "{{ .Var.brew_commit_author_email }}"
124+
homepage: "{{ .Var.homepage }}"
125+
description: "{{ .Var.description }}"
126+
extra_install: |-
127+
bash_completion.install "completions/{{ .ProjectName }}.bash" => "{{ .ProjectName }}"
128+
zsh_completion.install "completions/{{ .ProjectName }}.zsh" => "_{{ .ProjectName }}"
129+
fish_completion.install "completions/{{ .ProjectName }}.fish"
130+
man1.install "manpages/{{ .ProjectName }}.1.gz"
131+
104132
release:
105133
# Repo in which the release will be created.
106134
# Default: extracted from the origin remote URL or empty if its private hosted.

0 commit comments

Comments
 (0)