Create script for releases
This commit is contained in:
parent
3c4b89a8da
commit
06fddc43c3
|
@ -1,6 +1,47 @@
|
||||||
|
version=$(cat Cargo.toml | sed -n -e '/version/ {s/.* = *//p;q}' | tr -d '"')
|
||||||
|
|
||||||
|
read -p "You wanted to release $version, right? [Y/n] " -n 1 -r
|
||||||
|
echo
|
||||||
|
case "$REPLY" in
|
||||||
|
n|N ) exit 1;;
|
||||||
|
esac
|
||||||
|
|
||||||
if [ -z "${RELEASE_TOKEN}" ]; then
|
if [ -z "${RELEASE_TOKEN}" ]; then
|
||||||
echo "Please set the RELEASE_TOKEN env var."
|
echo "Please set the RELEASE_TOKEN env var."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
if ! command -v curl 2>&1 >/dev/null; then
|
||||||
|
echo "Please install curl."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if ! command -v jq 2>&1 >/dev/null; then
|
||||||
|
echo "Please install jq."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
docker build -f build.Dockerfile -t lemur-build .
|
docker build -f build.Dockerfile -t lemur-build .
|
||||||
MSYS_NO_PATHCONV=1 docker run -it --rm -e RELEASE_TOKEN="${RELEASE_TOKEN}" -v .:/app -w /app --entrypoint bash lemur-build /app/scripts/do-release.sh
|
MSYS_NO_PATHCONV=1 docker run -it --rm -v .:/app -w /app --entrypoint bash lemur-build /app/scripts/do-bundle.sh
|
||||||
|
|
||||||
|
read -r -d EOF 'body' <<EOF
|
||||||
|
# v${version}
|
||||||
|
EOF
|
||||||
|
|
||||||
|
read -r -d EOF 'payload' <<EOF
|
||||||
|
{
|
||||||
|
"body": $(echo "$body" | jq -Rsa .),
|
||||||
|
"draft": false,
|
||||||
|
"name": "v${version}",
|
||||||
|
"prerelease": false,
|
||||||
|
"tag_name": "v${version}"
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
|
||||||
|
echo "Creating release..."
|
||||||
|
response=$(curl -s --json "$payload" "https://git.virtual-boy.com/api/v1/repos/PVB/lemur/releases?token=$RELEASE_TOKEN")
|
||||||
|
echo "$response"
|
||||||
|
upload_url=$(echo "$response" | jq -r '.upload_url')
|
||||||
|
for file in output/*; do
|
||||||
|
echo "Uploading $(basename "$file")..."
|
||||||
|
upload_res=$(curl -s -F "attachment=@$file" "$upload_url?name=$(basename "$file")&token=$RELEASE_TOKEN")
|
||||||
|
echo "$upload_res"
|
||||||
|
done
|
||||||
|
|
Loading…
Reference in New Issue