Skip to content

Commit 883d78f

Browse files
committed
chore(addons): index.yaml add created digest info
1 parent c716c38 commit 883d78f

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

scripts/push_release.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,22 @@ if [ -z "$ASSET_UPLOAD_URL" ]; then
2727
exit 1
2828
fi
2929

30+
# modify index.yaml, add created\digest field
31+
if [ ! -f toCopy/index.yaml ]; then
32+
echo "index.yaml does not exist"
33+
exit 1
34+
fi
35+
timestamp=$(date "+%Y-%m-%d %H:%M:%S")
36+
for FILE in `ls toCopy/*.tgz`; do
37+
sha=$(sha256sum $FILE | awk '{ print $1 }') # FILE Example: toCopy/minio-2023.tgz
38+
FILE=${FILE%%.tgz*} # remove ".tgz", Example: toCopy/minio-2023
39+
addonVersion=${FILE##*toCopy/} # remove "path, Example: minio-2023
40+
addon=${addonVersion%-*} # remove after "-" , Example: minio
41+
version=${addonVersion##*-} # remove before "-", Example: 2023
42+
a=$addon v=$version t=$timestamp yq -i '(.entries.[env(a)][] | select(.version == env(v)) | .created) = env(t)' toCopy/index.yaml
43+
a=$addon v=$version s=$sha yq -i '(.entries.[env(a)][] | select(.version == env(v)) | .digest) = env(s)' toCopy/index.yaml
44+
done
45+
3046
for FILE in toCopy/*; do
3147
echo "Uploading asset: $FILE to url: $ASSET_UPLOAD_URL?name=${FILE}"
3248
curl -s --data-binary @${FILE} -H "Content-Type: application/octet-stream" -H "Authorization: token ${GITHUB_TOKEN}" -X POST "$ASSET_UPLOAD_URL?name=$(basename ${FILE})"

0 commit comments

Comments
 (0)