Skip to content

Commit ad90cda

Browse files
committed
chore(brew): keep all formula versions
1 parent d265d59 commit ad90cda

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

tools/publish-brew-formula.sh

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,15 @@ cd homebrew-tools
1010
git config user.email "${GIT_EMAIL}"
1111
git config user.name "Dinko Osrecki"
1212

13-
cat <<EOF > google-cloud-sql.rb
14-
class GoogleCloudSql < Formula
15-
desc "Connect to private Google Cloud SQL instance through Cloud SQL Auth Proxy running in GKE cluster."
13+
generate_formula() {
14+
local class_name="$1"
15+
cat <<EOF
16+
class ${class_name} < Formula
17+
desc "Connect to private Google Cloud SQL/AlloyDB instance through Cloud SQL/AlloyDB Auth Proxy running in GKE cluster."
1618
homepage "https://github.com/edosrecki/google-cloud-sql-cli"
1719
url "$url"
1820
sha256 "$checksum"
21+
version "$version"
1922
def install
2023
bin.install "google-cloud-sql"
2124
end
@@ -24,8 +27,15 @@ class GoogleCloudSql < Formula
2427
end
2528
end
2629
EOF
30+
}
2731

28-
git add google-cloud-sql.rb
32+
# Create latest version formula
33+
generate_formula "GoogleCloudSql" > google-cloud-sql.rb
34+
# Create versioned formula
35+
versioned_formula="google-cloud-sql@${version}.rb"
36+
generate_formula "GoogleCloudSqlAT${version//./}" > "$versioned_formula"
37+
38+
git add google-cloud-sql.rb "$versioned_formula"
2939
git commit -m "chore: release google-cloud-sql v$version"
3040
git push
3141

0 commit comments

Comments
 (0)