Skip to content

Commit de4c1ba

Browse files
committed
Bottling.
1 parent 7f83e56 commit de4c1ba

5 files changed

Lines changed: 119 additions & 63 deletions

File tree

.github/workflows/release.yml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ on:
66
type: string
77
description: 'Version'
88
jobs:
9-
build-x86_64-apple-darwin:
10-
name: Build (x86_64-apple-darwin)
9+
build-macos-13-x86_64-apple-darwin:
10+
name: Build (macOS 13, x86_64-apple-darwin)
1111
runs-on: macos-13
1212
timeout-minutes: 5
1313
steps:
@@ -22,14 +22,14 @@ jobs:
2222
- name: Test
2323
run: ./script/test.sh target/x86_64-apple-darwin/release
2424
- name: Rename
25-
run: mv target/x86_64-apple-darwin/release/git-coauthor git-coauthor-x86_64-apple-darwin
25+
run: mv target/x86_64-apple-darwin/release/git-coauthor git-coauthor-macos-13-x86_64-apple-darwin
2626
- name: Upload
2727
uses: actions/upload-artifact@v4
2828
with:
29-
name: git-coauthor-x86_64-apple-darwin
30-
path: git-coauthor-x86_64-apple-darwin
31-
build-aarch64-apple-darwin:
32-
name: Build (aarch64-apple-darwin)
29+
name: git-coauthor-macos-13-x86_64-apple-darwin
30+
path: git-coauthor-macos-13-x86_64-apple-darwin
31+
build-macos-14-aarch64-apple-darwin:
32+
name: Build (macOS 14, aarch64-apple-darwin)
3333
runs-on: macos-14
3434
timeout-minutes: 5
3535
steps:
@@ -44,28 +44,28 @@ jobs:
4444
- name: Test
4545
run: ./script/test.sh target/aarch64-apple-darwin/release
4646
- name: Rename
47-
run: mv target/aarch64-apple-darwin/release/git-coauthor git-coauthor-aarch64-apple-darwin
47+
run: mv target/aarch64-apple-darwin/release/git-coauthor git-coauthor-macos-14-aarch64-apple-darwin
4848
- name: Upload
4949
uses: actions/upload-artifact@v4
5050
with:
51-
name: git-coauthor-aarch64-apple-darwin
52-
path: git-coauthor-aarch64-apple-darwin
51+
name: git-coauthor-macos-14-aarch64-apple-darwin
52+
path: git-coauthor-macos-14-aarch64-apple-darwin
5353
release:
5454
name: Release
5555
needs:
56-
- build-x86_64-apple-darwin
57-
- build-aarch64-apple-darwin
56+
- build-macos-13-x86_64-apple-darwin
57+
- build-macos-14-aarch64-apple-darwin
5858
runs-on: ubuntu-latest
5959
steps:
6060
- uses: actions/checkout@v4
61-
- name: Download (x86_64-apple-darwin)
61+
- name: Download (macOS 13, x86_64-apple-darwin)
6262
uses: actions/download-artifact@v4
6363
with:
64-
name: git-coauthor-x86_64-apple-darwin
65-
- name: Download (aarch64-apple-darwin)
64+
name: git-coauthor-macos-13-x86_64-apple-darwin
65+
- name: Download (macOS 14, aarch64-apple-darwin)
6666
uses: actions/download-artifact@v4
6767
with:
68-
name: git-coauthor-aarch64-apple-darwin
68+
name: git-coauthor-macos-14-aarch64-apple-darwin
6969
- name: Set Version
7070
run: ./script/version.sh ${{ inputs.version }}
7171
- name: Build

.release-notes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
- No changes
1+
- Add Homebrew bottles.

Formula/git-coauthor.rb

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,25 @@ class GitCoauthor < Formula
33
homepage "https://github.com/nicholasdower/git-coauthor"
44
license "MIT"
55
version "5.2.0"
6-
if Hardware::CPU.arm?
7-
url "https://github.com/nicholasdower/git-coauthor/releases/download/v5.2.0/git-coauthor-5.2.0-aarch64-apple-darwin.tar.gz"
8-
sha256 "05606298cdfe26f16cc52b51ab6a7fceade4f363faf77ab68656791d49c181b8"
9-
elsif Hardware::CPU.intel?
10-
url "https://github.com/nicholasdower/git-coauthor/releases/download/v5.2.0/git-coauthor-5.2.0-x86_64-apple-darwin.tar.gz"
11-
sha256 "d9290d9b961ae394118555adf013e80f055199f5855847e0fa40d5d294eb34cd"
6+
7+
url "https://github.com/nicholasdower/git-coauthor/releases/download/v5.2.0/git-coauthor-5.2.0.tar.gz"
8+
sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
9+
10+
bottle do
11+
rebuild 1
12+
root_url "https://github.com/nicholasdower/git-coauthor/releases/download/v5.2.0/"
13+
sha256 cellar: :any, monterey: "ffc0f92960afd03582ead5dc999f87b986465275cd73213d46f8372ce5e71aad"
14+
sha256 cellar: :any, ventura: "ffc0f92960afd03582ead5dc999f87b986465275cd73213d46f8372ce5e71aad"
15+
sha256 cellar: :any, sonoma: "ffc0f92960afd03582ead5dc999f87b986465275cd73213d46f8372ce5e71aad"
16+
sha256 cellar: :any, arm64_sonoma: "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
17+
sha256 cellar: :any, arm64_monterey: "ffc0f92960afd03582ead5dc999f87b986465275cd73213d46f8372ce5e71aad"
18+
sha256 cellar: :any, arm64_ventura: "ffc0f92960afd03582ead5dc999f87b986465275cd73213d46f8372ce5e71aad"
1219
end
1320

21+
depends_on "rust" => :build
22+
1423
def install
15-
bin.install "bin/git-coauthor"
24+
system "cargo", "install", *std_cargo_args
1625
man1.install "man/git-coauthor.1"
1726
end
1827

script/homebrew.sh

Lines changed: 37 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,41 +11,57 @@ fi
1111

1212
version="$1"
1313

14-
x86_64_apple_darwin_file="git-coauthor-$version-x86_64-apple-darwin.tar.gz"
15-
aarch64_apple_darwin_file="git-coauthor-$version-aarch64-apple-darwin.tar.gz"
14+
function generate_sha {
15+
version="$1"
16+
name="$2"
17+
file="git-coauthor-$version.$name.bottle.1.tar.gz"
18+
if [ ! -f "$file" ]; then
19+
echo "error: $file not found" >&2
20+
exit 1
21+
fi
22+
sha=`shasum -a 256 "$file" | cut -d' ' -f1`
23+
echo $sha
24+
}
1625

17-
if [ ! -f "$x86_64_apple_darwin_file" ]; then
18-
echo "error: $x86_64_apple_darwin_file not found" >&2
26+
release_file="git-coauthor-$version.tar.gz"
27+
if [ ! -f "$release_file" ]; then
28+
echo "error: $release_file not found" >&2
1929
exit 1
2030
fi
2131

22-
if [ ! -f "$aarch64_apple_darwin_file" ]; then
23-
echo "error: $aarch64_apple_darwin_file not found" >&2
24-
exit 1
25-
fi
26-
27-
x86_64_apple_darwin_url="https://github.com/nicholasdower/git-coauthor/releases/download/v$version/$x86_64_apple_darwin_file"
28-
x86_64_apple_darwin_sha=`shasum -a 256 "$x86_64_apple_darwin_file" | cut -d' ' -f1`
29-
30-
aarch64_apple_darwin_url="https://github.com/nicholasdower/git-coauthor/releases/download/v$version/$aarch64_apple_darwin_file"
31-
aarch64_apple_darwin_sha=`shasum -a 256 "$aarch64_apple_darwin_file" | cut -d' ' -f1`
32+
release=`shasum -a 256 "$release_file" | cut -d' ' -f1`
33+
monterey=`generate_sha "$version" "monterey"`
34+
ventura=`generate_sha "$version" "ventura"`
35+
sonoma=`generate_sha "$version" "sonoma"`
36+
arm64_sonoma=`generate_sha "$version" "arm64_sonoma"`
37+
arm64_monterey=`generate_sha "$version" "arm64_monterey"`
38+
arm64_ventura=`generate_sha "$version" "arm64_ventura"`
3239

3340
cat << EOF > Formula/git-coauthor.rb
3441
class GitCoauthor < Formula
3542
desc "List or add Git coauthors"
3643
homepage "https://github.com/nicholasdower/git-coauthor"
3744
license "MIT"
3845
version "$version"
39-
if Hardware::CPU.arm?
40-
url "$aarch64_apple_darwin_url"
41-
sha256 "$aarch64_apple_darwin_sha"
42-
elsif Hardware::CPU.intel?
43-
url "$x86_64_apple_darwin_url"
44-
sha256 "$x86_64_apple_darwin_sha"
46+
47+
url "https://github.com/nicholasdower/git-coauthor/releases/download/v$version/$release_file"
48+
sha256 "$release"
49+
50+
bottle do
51+
rebuild 1
52+
root_url "https://github.com/nicholasdower/git-coauthor/releases/download/v$version/"
53+
sha256 cellar: :any, monterey: "$monterey"
54+
sha256 cellar: :any, ventura: "$ventura"
55+
sha256 cellar: :any, sonoma: "$sonoma"
56+
sha256 cellar: :any, arm64_sonoma: "$arm64_sonoma"
57+
sha256 cellar: :any, arm64_monterey: "$arm64_monterey"
58+
sha256 cellar: :any, arm64_ventura: "$arm64_ventura"
4559
end
4660
61+
depends_on "rust" => :build
62+
4763
def install
48-
bin.install "bin/git-coauthor"
64+
system "cargo", "install", *std_cargo_args
4965
man1.install "man/git-coauthor.1"
5066
end
5167

script/release.sh

Lines changed: 49 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -27,22 +27,48 @@ echo "Set version to $version"
2727
echo "Create man page"
2828
./script/manpage.sh "$version" "$(date '+%Y-%m-%d')"
2929

30-
x86_64_apple_darwin_file="git-coauthor-$version-x86_64-apple-darwin.tar.gz"
31-
aarch64_apple_darwin_file="git-coauthor-$version-aarch64-apple-darwin.tar.gz"
32-
33-
echo "Create $x86_64_apple_darwin_file"
34-
rm -rf bin
35-
mkdir -p bin
36-
mv git-coauthor-x86_64-apple-darwin bin/git-coauthor
37-
rm -f "$x86_64_apple_darwin_file"
38-
tar -czf "$x86_64_apple_darwin_file" ./man/ ./bin/
39-
40-
echo "Create $aarch64_apple_darwin_file"
41-
rm -rf bin
42-
mkdir -p bin
43-
mv git-coauthor-aarch64-apple-darwin bin/git-coauthor
44-
rm -f "$aarch64_apple_darwin_file"
45-
tar -czf "$aarch64_apple_darwin_file" ./man/ ./bin/
30+
# Keep this list in sync with homebrew.sh
31+
monterey_file="git-coauthor-$version.monterey.bottle.1.tar.gz"
32+
ventura_file="git-coauthor-$version.ventura.bottle.1.tar.gz"
33+
sonoma_file="git-coauthor-$version.sonoma.bottle.1.tar.gz"
34+
35+
arm64_monterey_file="git-coauthor-$version.arm64_monterey.bottle.1.tar.gz"
36+
arm64_ventura_file="git-coauthor-$version.arm64_ventura.bottle.1.tar.gz"
37+
arm64_sonoma_file="git-coauthor-$version.arm64_sonoma.bottle.1.tar.gz"
38+
39+
release_file="git-coauthor-$version.tar.gz"
40+
41+
echo "Create $ventura_file"
42+
rm -rf git-coauthor
43+
mkdir -p "git-coauthor/$version/bin"
44+
mkdir -p "git-coauthor/$version/share/man/man1"
45+
mv git-coauthor-macos-13-x86_64-apple-darwin "git-coauthor/$version/bin/git-coauthor"
46+
cp man/git-coauthor.1 "git-coauthor/$version/share/man/man1/"
47+
tar -czf "$ventura_file" git-coauthor
48+
49+
echo "Create $arm64_sonoma_file"
50+
rm -rf git-coauthor
51+
mkdir -p "git-coauthor/$version/bin"
52+
mkdir -p "git-coauthor/$version/share/man/man1"
53+
mv git-coauthor-macos-14-aarch64-apple-darwin "git-coauthor/$version/bin/git-coauthor"
54+
mv man/git-coauthor.1 "git-coauthor/$version/share/man/man1/"
55+
tar -czf "$arm64_sonoma_file" git-coauthor
56+
57+
# A bit of cheating
58+
echo "Create $arm64_monterey_file"
59+
cp "$arm64_sonoma_file" "$arm64_monterey_file"
60+
61+
echo "Create $arm64_ventura_file"
62+
cp "$arm64_sonoma_file" "$arm64_ventura_file"
63+
64+
echo "Create $monterey_file"
65+
cp "$ventura_file" "$monterey_file"
66+
67+
echo "Create $sonoma_file"
68+
cp "$ventura_file" "$sonoma_file"
69+
70+
echo "Create $release_file"
71+
tar -czf "$release_file" ./man/ ./src/ Cargo.lock Cargo.toml
4672

4773
echo "Create Homebrew formula"
4874
./script/homebrew.sh "$version"
@@ -84,8 +110,13 @@ git push origin "v$version"
84110

85111
echo "Create release"
86112
gh release create "v$version" \
87-
"$x86_64_apple_darwin_file" \
88-
"$aarch64_apple_darwin_file" \
113+
"$monterey_file" \
114+
"$ventura_file" \
115+
"$sonoma_file" \
116+
"$arm64_monterey_file" \
117+
"$arm64_ventura_file" \
118+
"$arm64_sonoma_file" \
119+
"$release_file" \
89120
-R nicholasdower/git-coauthor \
90121
--notes-file tmp/.release-notes
91122

0 commit comments

Comments
 (0)