Skip to content

Commit f10257d

Browse files
committed
add v2 update script
1 parent f2ff8a4 commit f10257d

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

ci/update-v2.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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-arm64-zip-SHA256>" "<darwin-amd64-zip-SHA256>" "<linux-amd64-targz-SHA256>"
6+
7+
set -euo pipefail
8+
cd "$(dirname "$0")"
9+
10+
version="$1"
11+
darwin_arm_sha="$(echo "$2" | tr "[:upper:]" "[:lower:]")"
12+
darwin_intel_sha="$(echo "$3" | tr "[:upper:]" "[:lower:]")"
13+
linux_sha="$(echo "$4" | tr "[:upper:]" "[:lower:]")"
14+
15+
# Replace version
16+
sed -i "s/version \"[0-9.]*\"/version \"$version\"/g" "../Formula/coder.rb"
17+
18+
# Update macOS ARM hash
19+
sed -zi "s/sha256 \"[a-f0-9]*\"/sha256 \"$darwin_arm_sha\"/1" "../Formula/coder.rb"
20+
21+
# Update macOS Intel hash
22+
sed -zi "s/sha256 \"[a-f0-9]*\"/sha256 \"$darwin_intel_sha\"/2" "../Formula/coder.rb"
23+
24+
# Update Linux hash
25+
sed -zi "s/sha256 \"[a-f0-9]*\"/sha256 \"$linux_sha\"/3" "../Formula/coder.rb"

0 commit comments

Comments
 (0)