Skip to content

Commit 4407f64

Browse files
authored
chore: automate updating formulae (#30)
1 parent 127c5a2 commit 4407f64

File tree

3 files changed

+38
-10
lines changed

3 files changed

+38
-10
lines changed

ci/update.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/bash
2+
3+
# Updates both the coder-cli and coder-cli-nightly formulae to have the given
4+
# values.
5+
# ./update.sh "<version>" "<darwin-amd64-zip-SHA256>" "<linux-amd64-targz-SHA256>"
6+
7+
set -euo pipefail
8+
cd "$(dirname "$0")"
9+
10+
version="$1"
11+
darwin_sha="$(echo "$2" | tr "[:upper:]" "[:lower:]")"
12+
linux_sha="$(echo "$3" | tr "[:upper:]" "[:lower:]")"
13+
14+
# Get the old version to use in our find/replace.
15+
old_version="$(sed -n "s/.*version \"\(.*\)\".*/\1/p" ../coder-cli.rb)"
16+
if [[ "$old_version" == "" ]]; then
17+
echo "Could not determine the old version of the formula..." >&2
18+
exit 1
19+
fi
20+
21+
# Replace version
22+
sed -i "s/${old_version//./\.}/${version//./\.}/g" ../coder-cli{,-nightly}.rb
23+
24+
# Darwin amd64 SHA256. This only selects the first match
25+
sed -zi "s/sha256 \"[a-f0-9]*\"/sha256 \"$darwin_sha\"/1" ../coder-cli{,-nightly}.rb
26+
27+
# Linux amd64 SHA256. This only selects the second match
28+
sed -zi "s/sha256 \"[a-f0-9]*\"/sha256 \"$linux_sha\"/2" ../coder-cli{,-nightly}.rb

coder-cli-nightly.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
class CoderCliNightly < Formula
22
desc "Command-line tool for the Coder remote development platform, nightly release channel"
33
homepage "https://github.com/cdr/coder-cli"
4-
version "1.27.0"
4+
version "1.28.2"
55

66
if OS.mac?
7-
url "https://github.com/cdr/coder-cli/releases/download/v1.27.0/coder-cli-darwin-amd64.zip"
8-
sha256 "13a17e97de04c4207920b1830e2aea9e8f8f0a4f0a8362c91fc35d5d218246e8"
7+
url "https://github.com/cdr/coder-cli/releases/download/v1.28.2/coder-cli-darwin-amd64.zip"
8+
sha256 "b0fbf3486d63892ffe718f12b6b418c49eecebdd34a9c713b53c1cf81385dd57"
99
else
10-
url "https://github.com/cdr/coder-cli/releases/download/v1.27.0/coder-cli-linux-amd64.tar.gz"
11-
sha256 "1c79598e5dd29f0ba724a77d482389dfa629825905254ab31d7fc349bbd8076b"
10+
url "https://github.com/cdr/coder-cli/releases/download/v1.28.2/coder-cli-linux-amd64.tar.gz"
11+
sha256 "a3472dc7968affcbd9bf03fd14304eff365c0dad5d8ed732bd98744a2de880f6"
1212
end
1313

1414
def install

coder-cli.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
class CoderCli < Formula
22
desc "Command-line tool for the Coder remote development platform"
33
homepage "https://github.com/cdr/coder-cli"
4-
version "1.27.0"
4+
version "1.28.2"
55

66
if OS.mac?
7-
url "https://github.com/cdr/coder-cli/releases/download/v1.27.0/coder-cli-darwin-amd64.zip"
8-
sha256 "13a17e97de04c4207920b1830e2aea9e8f8f0a4f0a8362c91fc35d5d218246e8"
7+
url "https://github.com/cdr/coder-cli/releases/download/v1.28.2/coder-cli-darwin-amd64.zip"
8+
sha256 "b0fbf3486d63892ffe718f12b6b418c49eecebdd34a9c713b53c1cf81385dd57"
99
else
10-
url "https://github.com/cdr/coder-cli/releases/download/v1.27.0/coder-cli-linux-amd64.tar.gz"
11-
sha256 "1c79598e5dd29f0ba724a77d482389dfa629825905254ab31d7fc349bbd8076b"
10+
url "https://github.com/cdr/coder-cli/releases/download/v1.28.2/coder-cli-linux-amd64.tar.gz"
11+
sha256 "a3472dc7968affcbd9bf03fd14304eff365c0dad5d8ed732bd98744a2de880f6"
1212
end
1313

1414
def install

0 commit comments

Comments
 (0)