81 lines
2.2 KiB
Bash
Executable File
81 lines
2.2 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
curdir=$(realpath $(dirname $0))
|
|
version=$1
|
|
echo $version
|
|
if [ -z "$version" ]; then
|
|
echo "must give a version specification."
|
|
exit 1
|
|
fi
|
|
|
|
echo Tagging git release...
|
|
git tag -a -m $version $version
|
|
git push origin ${version}
|
|
echo Tagged git release $(git describe)
|
|
|
|
read -r -d '' release_body <<EOF
|
|
{
|
|
"body": "${version}",
|
|
"draft": true,
|
|
"name": "${version}",
|
|
"prerelease": false,
|
|
"tag_name": "${version}",
|
|
"target_commitish": "${version}"
|
|
}
|
|
EOF
|
|
|
|
releaseId=$(curl -n -X 'POST' \
|
|
'https://git.bloy.org/api/v1/repos/foundryvtt/mb-assets/releases' \
|
|
-H 'accept: application/json' \
|
|
-H 'Content-Type: application/json' \
|
|
-d "${release_body}" \
|
|
| jq '.id')
|
|
|
|
(cd $curdir/dist; rm -f mb-assets.zip; zip -r mb-assets.zip mb-assets)
|
|
|
|
# curl -n -X 'POST' \
|
|
# "https://git.bloy.org/api/v1/repos/foundryvtt/mb-assets/releases/${releaseId}/assets?name=module.json" \
|
|
# -H 'accept: application/json' \
|
|
# -T ./dist/mb-assets/module.json
|
|
|
|
# curl -n -X 'POST' \
|
|
# "https://git.bloy.org/api/v1/repos/foundryvtt/mb-assets/releases/${releaseId}/assets?name=mb-assets.zip" \
|
|
# -H 'accept: application/json' \
|
|
# -T ./dist/mb-assets.zip
|
|
|
|
echo
|
|
echo "Updating module.json"
|
|
curl -n -X 'POST' \
|
|
"https://git.bloy.org/api/v1/repos/foundryvtt/mb-assets/releases/${releaseId}/assets?name=module.json" \
|
|
-H 'accept: application/json' \
|
|
-H 'Content-Type: multipart/form-data' \
|
|
-F 'attachment=@dist/mb-assets/module.json;type=application/json'
|
|
|
|
echo
|
|
echo "Updating mb-assets.zip"
|
|
curl -n -X 'POST' \
|
|
"https://git.bloy.org/api/v1/repos/foundryvtt/mb-assets/releases/${releaseId}/assets?name=mb-assets.zip" \
|
|
-H 'accept: application/json' \
|
|
-H 'Content-Type: multipart/form-data' \
|
|
-F 'attachment=@dist/mb-assets.zip;type=application/x-zip-compressed'
|
|
|
|
|
|
read -r -d '' patch_body <<EOF
|
|
{
|
|
"body": "${version}",
|
|
"draft": false,
|
|
"name": "${version}",
|
|
"prerelease": false,
|
|
"tag_name": "${version}",
|
|
"target_commitish": "${version}"
|
|
}
|
|
EOF
|
|
|
|
echo
|
|
echo "setting to not draft"
|
|
curl -n -X 'PATCH' \
|
|
"https://git.bloy.org/api/v1/repos/foundryvtt/mb-assets/releases/${releaseId}" \
|
|
-H 'accept: application/json' \
|
|
-H 'Content-Type: application/json' \
|
|
-d "${patch_body}" \
|