Skip to content

Commit 4642a08

Browse files
committed
chore: automate brew tap and prep v0.16.1
1 parent d19dc5e commit 4642a08

File tree

8 files changed

+105
-126
lines changed

8 files changed

+105
-126
lines changed

.gitcliff.toml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
[git]
2+
conventional = true
3+
filter_unmerged = true
4+
commit_preprocessors = [
5+
{ pattern = "^Merge.+", replace = "" },
6+
]
7+
8+
[changelog]
9+
body = """
10+
## Release {{ version }}
11+
{% if date %}_{{ date }}_{% endif %}
12+
13+
### Highlights
14+
{% for group, commits in commits | group_by(attribute="type") %}
15+
#### {{ group | default(value="other") | upper }}
16+
{% for commit in commits %}
17+
- {{ commit.message | split(pat="\n") | first }} ({{ commit.id | truncate(length=7) }})
18+
{% if commit.body %} - {{ commit.body | indent(prefix=" ") }}{% endif %}
19+
{% endfor %}
20+
{% endfor %}
21+
22+
### Contributors
23+
{% for author, commits in commits | group_by(attribute="author") %}
24+
- {{ author }} ({{ commits | length }} commit{{ "s" if commits | length > 1 }})
25+
{% endfor %}
26+
"""
27+
28+
group_by = ["type"]
29+
trim = true
30+
footer = """
31+
---
32+
Changelog generated by git-cliff.
33+
"""

.github/workflows/release.yml

Lines changed: 58 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -104,36 +104,71 @@ jobs:
104104
id: tag
105105
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
106106

107+
- name: Generate changelog from git history
108+
uses: orhun/git-cliff-action@v3
109+
with:
110+
config: .gitcliff.toml
111+
args: --tag ${{ steps.tag.outputs.VERSION }} --output release-notes.md
112+
env:
113+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
114+
115+
- name: Generate checksums
116+
run: |
117+
find artifacts -type f \( -name "sshdb-*.tar.gz" -o -name "sshdb-*.zip" \) -print0 \
118+
| sort -z \
119+
| xargs -0 sha256sum > checksums.txt
120+
121+
- name: Generate Homebrew formula and push tap
122+
if: ${{ secrets.HOMEBREW_TAP_TOKEN != '' }}
123+
env:
124+
VERSION: ${{ steps.tag.outputs.VERSION }}
125+
TAP_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }}
126+
run: |
127+
set -euo pipefail
128+
TAR_URL="https://github.com/ruphy/sshdb/archive/refs/tags/v${VERSION}.tar.gz"
129+
SHA256=$(curl -L "$TAR_URL" | shasum -a 256 | awk '{print $1}')
130+
131+
mkdir -p /tmp/tap
132+
git config --global user.name "sshdb-release-bot"
133+
git config --global user.email "[email protected]"
134+
git clone "https://x-access-token:${TAP_TOKEN}@github.com/ruphy/homebrew-sshdb" /tmp/tap
135+
136+
cat > /tmp/tap/Formula/sshdb.rb <<EOF
137+
class Sshdb < Formula
138+
desc "Keyboard-first SSH library and launcher TUI"
139+
homepage "https://github.com/ruphy/sshdb"
140+
url "${TAR_URL}"
141+
sha256 "${SHA256}"
142+
license "GPL-3.0-or-later"
143+
depends_on "rust" => :build
144+
145+
def install
146+
system "cargo", "install", *std_cargo_args
147+
end
148+
149+
test do
150+
system "#{bin}/sshdb", "--help"
151+
end
152+
end
153+
EOF
154+
155+
cd /tmp/tap
156+
git add Formula/sshdb.rb
157+
if git commit -m "sshdb ${VERSION}"; then
158+
git push origin HEAD:main
159+
else
160+
echo "No changes to commit for tap."
161+
fi
162+
107163
- name: Create Release
108164
uses: softprops/action-gh-release@v1
109165
with:
110166
tag_name: ${{ github.ref }}
111167
name: Release ${{ steps.tag.outputs.VERSION }}
112-
body: |
113-
## Release ${{ steps.tag.outputs.VERSION }}
114-
115-
### Binaries
116-
117-
- `sshdb-linux-x86_64.tar.gz` - Linux (x86_64)
118-
- `sshdb-macos-x86_64.tar.gz` - macOS (Intel)
119-
- `sshdb-macos-aarch64.tar.gz` - macOS (Apple Silicon)
120-
- `sshdb-windows-x86_64.zip` - Windows (x86_64)
121-
122-
### Installation
123-
124-
Extract the archive and place the binary in your PATH.
125-
126-
#### Linux/macOS
127-
```bash
128-
tar xzf sshdb-*.tar.gz
129-
sudo mv sshdb /usr/local/bin/
130-
```
131-
132-
#### Windows
133-
Extract the zip file and add the directory to your PATH.
168+
body_path: release-notes.md
134169
files: |
135170
artifacts/*/sshdb-*.tar.gz
136171
artifacts/*/sshdb-*.zip
172+
checksums.txt
137173
draft: false
138174
prerelease: false
139-

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Changelog
2+
3+
Release notes are generated from git history with `git-cliff` during tagged releases.
4+
5+
- To preview locally: `git cliff --tag <next-version> --output /tmp/release-notes.md`
6+
- GitHub releases attach the generated notes plus platform checksums.

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "sshdb"
3-
version = "0.16.0"
3+
version = "0.16.1"
44
edition = "2021"
55
description = "Keyboard-first SSH library and launcher TUI."
66
authors = ["Riccardo Iaconelli <[email protected]>"]

README.md

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,13 @@ Keyboard-first SSH library and launcher TUI. Search, preview, and connect with a
99
#### Install
1010
- From source: `cargo install --path .`
1111
- Build & run: `cargo run`
12+
- Homebrew: `brew tap ruphy/sshdb && brew install sshdb` (tap updates on releases)
1213

13-
##### Homebrew (ship-ready)
14-
Add this formula to your tap (update `url`/`sha256` for your release tarball):
15-
```ruby
16-
class Sshdb < Formula
17-
desc "Keyboard-first SSH library and launcher TUI"
18-
homepage "https://github.com/ruphy/sshdb"
19-
url "https://github.com/ruphy/sshdb/archive/refs/tags/v0.15.0.tar.gz"
20-
sha256 "f0fed6beb31bc95fd75b7ed9e1dd0cd11a5588e3934b27d8b469049c91a27e57"
21-
license "GPL-3.0-or-later"
22-
depends_on "rust" => :build
23-
24-
def install
25-
system "cargo", "install", *std_cargo_args
26-
end
27-
28-
test do
29-
system "#{bin}/sshdb", "--help"
30-
end
31-
end
32-
```
33-
Then: `brew install --build-from-source ./sshdb.rb` (or from your tap).
14+
15+
#### Release process
16+
- Tag `vX.Y.Z` and push; CI builds Linux/macOS (x86_64 + arm64)/Windows artifacts.
17+
- Release notes are generated from git history via `git-cliff` and published with the release.
18+
- A `checksums.txt` is attached to every release; use it to update downstream packages (Homebrew, etc.) without extra commits just to bump SHAs.
3419

3520
#### Keys
3621
- `/` search • `Enter` connect • `c` connect with remote command • `g` quick connect (ssh string)

setup-homebrew-tap.sh

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

sshdb.rb

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

0 commit comments

Comments
 (0)