@@ -101,6 +101,27 @@ jobs:
101101 mv auth gotrue
102102 tar -czvf auth-v$RELEASE_VERSION.supafast-arm64.tar.gz gotrue migrations/
103103
104+ - name : Generate checksums
105+ if : ${{ steps.release.outputs.release_created == 'true' || steps.release.outputs.prs_created == 'true' }}
106+ run : |
107+ set -ex
108+ # Function to generate checksums for a specific hash type
109+ generate_checksums() {
110+ local hash_type=$1
111+ local hash_cmd=$2
112+ echo "### ${hash_type}" >> checksums.txt
113+ for file in auth-v$RELEASE_VERSION*.tar.gz; do
114+ echo "\`$file\`:\n\`\`\`" >> checksums.txt
115+ $hash_cmd "$file" | awk '{print $1}' >> checksums.txt
116+ echo "\`\`\`\n" >> checksums.txt
117+ done
118+ }
119+
120+ # Generate the checksum file to be appended to the release notes later
121+ echo "## Checksums" > checksums.txt
122+ generate_checksums "SHA1" "sha1sum"
123+ generate_checksums "SHA256" "sha256sum"
124+
104125 - name : Upload release artifacts
105126 if : ${{ steps.release.outputs.release_created == 'true' || steps.release.outputs.prs_created == 'true' }}
106127 run : |
@@ -109,12 +130,13 @@ jobs:
109130 if [ "$RELEASE_CANDIDATE" == "true" ]
110131 then
111132 PR_NUMBER='${{ steps.release.outputs.pr && fromJSON(steps.release.outputs.pr).number }}'
133+ CHECKSUM_CONTENT=$(cat checksums.txt)
112134
113135 GH_TOKEN='${{ github.token }}' gh release \
114136 create $RELEASE_NAME \
115137 --title "v$RELEASE_VERSION" \
116138 --prerelease \
117- -n "This is a release candidate. See release-please PR #$PR_NUMBER for context."
139+ -n "This is a release candidate. See release-please PR #$PR_NUMBER for context.\n\n$CHECKSUM_CONTENT "
118140
119141 GH_TOKEN='${{ github.token }}' gh pr comment "$PR_NUMBER" \
120142 -b "Release candidate [v$RELEASE_VERSION](https://github.com/supabase/gotrue/releases/tag/$RELEASE_NAME) published."
@@ -139,6 +161,12 @@ jobs:
139161 fi
140162 fi
141163
164+ # Append checksums to existing release notes
165+ EXISTING_NOTES=$(GH_TOKEN='${{ github.token }}' gh release view $RELEASE_NAME --json body -q .body)
166+ CHECKSUM_CONTENT=$(cat checksums.txt)
167+ FULL_NOTES="${EXISTING_NOTES}\n\n${CHECKSUM_CONTENT}"
168+ GH_TOKEN='${{ github.token }}' gh release edit $RELEASE_NAME -n "$FULL_NOTES"
169+
142170 GH_TOKEN='${{ github.token }}' gh release upload $RELEASE_NAME ./auth-v$RELEASE_VERSION-x86.tar.gz ./auth-v$RELEASE_VERSION-arm64.tar.gz ./auth-v$RELEASE_VERSION.supafast-arm64.tar.gz
143171
144172 publish :
0 commit comments