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 88e8d13

Browse files
committed
chore: add automated PR to cdr/homebrew-coder on release
1 parent 7fcfe98 commit 88e8d13

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-0
lines changed

.github/workflows/release.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,3 +97,5 @@ jobs:
9797
asset_path: coder-cli-windows-386/coder-cli-windows-386.zip
9898
asset_name: coder-cli-windows-386.zip
9999
asset_content_type: application/zip
100+
- name: Open PR to cdr/homebrew-coder
101+
run: ./ci/scripts/update_homebrew.sh $(pwd)/coder-cli-darwin-amd64/coder-cli-darwin-amd64.zip

ci/scripts/update_homebrew.sh

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
asset="$1"
6+
sha="$(sha256sum "$asset" | awk '{ print $1 }')"
7+
tag="$(git describe --tags)"
8+
9+
tmpdir=$(mktemp -d)
10+
11+
pushd "$tmpdir"
12+
git clone https://github.com/cdr/homebrew-coder
13+
14+
pushd homebrew-coder
15+
16+
branch="coder-cli-release-$tag"
17+
git checkout -b "$branch"
18+
19+
new_formula="$(cat <<EOF
20+
class Coder < Formula
21+
desc "A command-line tool for the Coder remote development platform"
22+
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"
26+
bottle :unneeded
27+
def install
28+
bin.install "coder"
29+
end
30+
test do
31+
system "#{bin}/coder", "--version"
32+
end
33+
end
34+
EOF
35+
)"
36+
37+
echo "$new_formula" > coder.rb
38+
39+
git add coder.rb
40+
git commit -m "chore: update Coder CLI to $tag"
41+
git push --set-upstream origin "$branch"
42+
43+
gh pr create --fill
44+
45+
rm -rf "$tmpdir"

0 commit comments

Comments
 (0)