File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -27,6 +27,22 @@ if [ -z "$ASSET_UPLOAD_URL" ]; then
2727 exit 1
2828fi
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+
3046for 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} ) "
You can’t perform that action at this time.
0 commit comments