Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.

Commit 7dc29f6

Browse files
committed
chore: update homebrew script to support linuxbrew
1 parent c6f9923 commit 7dc29f6

File tree

1 file changed

+20
-7
lines changed

1 file changed

+20
-7
lines changed

ci/scripts/update_homebrew.sh

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,14 @@
22

33
set -e
44

5-
asset="$1"
6-
sha="$(sha256sum "$asset" | awk '{ print $1 }')"
5+
macos_asset="$1"
6+
linux_asset="$2"
7+
8+
sha() {
9+
sha256sum "$1" | awk '{ print $1 }'
10+
}
711
tag="$(git describe --tags)"
12+
trimmed_tag="${tag#"v"}"
813

914
tmpdir=$(mktemp -d)
1015

@@ -18,12 +23,19 @@ git checkout -b "$branch"
1823

1924
new_formula="$(cat <<EOF
2025
class Coder < Formula
21-
desc "A command-line tool for the Coder remote development platform"
26+
desc "Command-line tool for the Coder remote development platform"
2227
homepage "https://github.com/cdr/coder-cli"
23-
url "https://github.com/cdr/coder-cli/releases/download/$tag/coder-cli-darwin-amd64.zip"
24-
version "$tag"
25-
sha256 "$sha"
28+
version "$trimmed_tag"
2629
bottle :unneeded
30+
31+
if OS.mac?
32+
url "https://github.com/cdr/coder-cli/releases/download/$tag/coder-cli-darwin-amd64.zip"
33+
sha256 "$(sha "$macos_asset")"
34+
else
35+
url "https://github.com/cdr/coder-cli/releases/download/$tag/coder-cli-linux-amd64.tar.gz"
36+
sha256 "$(sha "$linux_asset")"
37+
end
38+
2739
def install
2840
bin.install "coder"
2941
end
@@ -36,8 +48,9 @@ EOF
3648

3749
echo "$new_formula" > coder.rb
3850

51+
git diff
3952
git add coder.rb
40-
git commit -m "chore: update Coder CLI to $tag"
53+
git commit -m "chore: bump Coder CLI to $tag"
4154
git push --set-upstream origin "$branch"
4255

4356
gh pr create --fill

0 commit comments

Comments
 (0)