@@ -38,31 +38,35 @@ PROCESSED_VERSIONS=""
3838
3939# Use process substitution to avoid subshell issues
4040while IFS= read -r release; do
41- VERSION=$( echo " $release " | jq -r ' .assets[] | select(.name | contains("canton-open-source") and endswith(".tar.gz")) | .name' | sed ' s/canton-open-source-\(.*\)\.tar\.gz/\1/' )
41+ DAML_TAG=$( echo " $release " | jq -r ' .tag_name' )
42+ CANTON_VERSION=$( echo " $release " | jq -r ' .assets[] | select(.name | contains("canton-open-source") and endswith(".tar.gz")) | .name' | sed ' s/canton-open-source-\(.*\)\.tar\.gz/\1/' )
4243 RELEASE_URL=$( echo " $release " | jq -r ' .html_url' )
4344 DOWNLOAD_URL=$( echo " $release " | jq -r ' .assets[] | select(.name | contains("canton-open-source") and endswith(".tar.gz")) | .browser_download_url' )
4445
45- printf " \n=== Processing Canton version: %s ===\n" " $VERSION "
46+ # Create a unique tag based on both DAML tag and Canton version
47+ TAG_NAME=" canton-${DAML_TAG} -${CANTON_VERSION} "
4648
47- # Check if this version already exists as a tag or was already processed
48- if echo " $EXISTING_TAGS " | grep -q " ^$VERSION $" ; then
49- echo " Tag canton-$VERSION already exists, skipping..."
49+ printf " \n=== Processing DAML %s (Canton %s) ===\n" " $DAML_TAG " " $CANTON_VERSION "
50+
51+ # Check if this specific combination already exists as a tag
52+ if echo " $EXISTING_TAGS " | grep -q " ^${DAML_TAG} -${CANTON_VERSION} $" ; then
53+ echo " Tag $TAG_NAME already exists, skipping..."
5054 continue
5155 fi
5256
53- # Check if we already processed this version in this run
54- if echo " $PROCESSED_VERSIONS " | grep -q " $VERSION " ; then
55- echo " Version $VERSION already processed in this run, skipping..."
57+ # Check if we already processed this combination in this run
58+ if echo " $PROCESSED_VERSIONS " | grep -q " ${DAML_TAG} - ${CANTON_VERSION} " ; then
59+ echo " Version ${DAML_TAG} - ${CANTON_VERSION} already processed in this run, skipping..."
5660 continue
5761 fi
5862
59- PROCESSED_VERSIONS=" $PROCESSED_VERSIONS $VERSION "
63+ PROCESSED_VERSIONS=" $PROCESSED_VERSIONS ${DAML_TAG} - ${CANTON_VERSION} "
6064
61- echo " New version found: $VERSION "
65+ echo " New release found: DAML $DAML_TAG with Canton $CANTON_VERSION "
6266
6367 # Download and calculate SHA256
6468 echo " Downloading $DOWNLOAD_URL to calculate SHA256..."
65- TEMP_FILE=" canton-release-$VERSION .tar.gz"
69+ TEMP_FILE=" canton-release-${DAML_TAG} - ${CANTON_VERSION} .tar.gz"
6670 if command -v wget > /dev/null 2>&1 ; then
6771 wget -q " $DOWNLOAD_URL " -O " $TEMP_FILE "
6872 else
@@ -88,18 +92,18 @@ while IFS= read -r release; do
8892 # macOS
8993 sed -i ' ' " s|url \" https://github\.com/digital-asset/daml/releases/download/[^\" ]*\" |url \" $DOWNLOAD_URL \" |" Formula/canton.rb
9094 sed -i ' ' " s|sha256 \" [a-f0-9]\{64\}\" |sha256 \" $SHA256 \" |" Formula/canton.rb
91- sed -i ' ' " s|version \" [^\" ]*\" |version \" $VERSION \" |" Formula/canton.rb
95+ sed -i ' ' " s|version \" [^\" ]*\" |version \" $CANTON_VERSION \" |" Formula/canton.rb
9296 else
9397 # Linux
9498 sed -i " s|url \" https://github\.com/digital-asset/daml/releases/download/[^\" ]*\" |url \" $DOWNLOAD_URL \" |" Formula/canton.rb
9599 sed -i " s|sha256 \" [a-f0-9]\{64\}\" |sha256 \" $SHA256 \" |" Formula/canton.rb
96- sed -i " s|version \" [^\" ]*\" |version \" $VERSION \" |" Formula/canton.rb
100+ sed -i " s|version \" [^\" ]*\" |version \" $CANTON_VERSION \" |" Formula/canton.rb
97101 fi
98102 fi
99103
100104 # Only commit and create release if running in CI (GITHUB_TOKEN is set)
101105 if [ -n " $GITHUB_TOKEN " ]; then
102- echo " Running in CI, creating release for $VERSION ..."
106+ echo " Running in CI, creating release for $TAG_NAME ..."
103107
104108 # Configure git (only once)
105109 if [ $PROCESSED_COUNT -eq 0 ]; then
@@ -108,13 +112,13 @@ while IFS= read -r release; do
108112 fi
109113
110114 # Create GitHub release and tag for this version
111- if ! git tag " canton- $VERSION " ; then
112- echo " Failed to create tag for $VERSION "
115+ if ! git tag " $TAG_NAME " ; then
116+ echo " Failed to create tag for $TAG_NAME "
113117 continue
114118 fi
115119
116- if ! git push origin " canton- $VERSION " ; then
117- echo " Failed to push tag for $VERSION "
120+ if ! git push origin " $TAG_NAME " ; then
121+ echo " Failed to push tag for $TAG_NAME "
118122 continue
119123 fi
120124
@@ -124,13 +128,14 @@ while IFS= read -r release; do
124128 LATEST_FLAG=" --latest"
125129 fi
126130
127- if ! gh release create " canton- $VERSION " \
128- --title " Canton $VERSION " \
129- --notes " Homebrew formula for Canton version $VERSION .
131+ if ! gh release create " $TAG_NAME " \
132+ --title " Canton $CANTON_VERSION (DAML $DAML_TAG ) " \
133+ --notes " Homebrew formula for Canton version $CANTON_VERSION from DAML release $DAML_TAG .
130134
131135This release tracks the Canton release from Digital Asset:
136+ - DAML Release: $DAML_TAG
132137- Original Release: $RELEASE_URL
133- - Canton Version: $VERSION
138+ - Canton Version: $CANTON_VERSION
134139- SHA256: $SHA256
135140
136141Install with:
@@ -150,9 +155,9 @@ brew install 0xsend/homebrew-canton/canton
150155 continue
151156 fi
152157
153- echo " Successfully created release for Canton $VERSION "
158+ echo " Successfully created release for $TAG_NAME "
154159 else
155- echo " Running locally, found version $VERSION "
160+ echo " Running locally, found DAML $DAML_TAG with Canton $CANTON_VERSION "
156161 echo " - URL: $DOWNLOAD_URL "
157162 echo " - SHA256: $SHA256 "
158163 fi
0 commit comments