Skip to content

Commit dd0fc4a

Browse files
feat: add SHA256 calculation for plugin download URL
1 parent 16a1943 commit dd0fc4a

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

script/update_plugin.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,22 @@ for file in $sourceDir/*.json; do
6868

6969
echo "::::Updating plugin json [$pluginJsonFile]"
7070

71+
# Calculate SHA256 for the download URL
72+
downloadUrl=$(jq -r '.downloadUrl' $tmpPluginJsonFile)
73+
echo "::::Downloading [$downloadUrl] for SHA256 calculation"
74+
tmpZipFile="tmp.zip"
75+
curl -# -o $tmpZipFile -L $downloadUrl
76+
if [ $? -eq 0 ]; then
77+
sha256=$(sha256sum $tmpZipFile | awk '{print $1}')
78+
echo "::::Calculated SHA256: $sha256"
79+
# Add or update sha256 field
80+
jq --arg sha256 "$sha256" '. + {sha256: $sha256}' $tmpPluginJsonFile > tmp_with_sha.json
81+
mv tmp_with_sha.json $tmpPluginJsonFile
82+
rm $tmpZipFile
83+
else
84+
echo "Failed to download $downloadUrl for SHA256 calculation"
85+
fi
86+
7187
jq . $tmpPluginJsonFile >$pluginJsonFile
7288

7389
# 如果版本不一致,则需要提交

0 commit comments

Comments
 (0)