diff options
author | Valentin Popov <valentin@popov.link> | 2024-01-08 00:21:28 +0300 |
---|---|---|
committer | Valentin Popov <valentin@popov.link> | 2024-01-08 00:21:28 +0300 |
commit | 1b6a04ca5504955c571d1c97504fb45ea0befee4 (patch) | |
tree | 7579f518b23313e8a9748a88ab6173d5e030b227 /vendor/image/release.sh | |
parent | 5ecd8cf2cba827454317368b68571df0d13d7842 (diff) | |
download | fparkan-1b6a04ca5504955c571d1c97504fb45ea0befee4.tar.xz fparkan-1b6a04ca5504955c571d1c97504fb45ea0befee4.zip |
Initial vendor packages
Signed-off-by: Valentin Popov <valentin@popov.link>
Diffstat (limited to 'vendor/image/release.sh')
-rwxr-xr-x | vendor/image/release.sh | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/vendor/image/release.sh b/vendor/image/release.sh new file mode 100755 index 0000000..ae164d3 --- /dev/null +++ b/vendor/image/release.sh @@ -0,0 +1,24 @@ +#!/bin/bash +# Checks automatic preconditions for a release +determine_new_version() { + grep "version = " Cargo.toml | sed -Ee 's/version = "(.*)"/\1/' | head -1 +} + +check_notexists_version() { + # Does the api information start with: '{"errors":' + [[ $(wget "https://crates.io/api/v1/crates/image/$1" -qO -) == "{\"errors\":"* ]] +} + +check_release_description() { + major=${1%%.*} + minor_patch=${1#$major.} + minor=${minor_patch%%.*} + patch=${minor_patch#$minor.} + # We just need to find a fitting header line + grep -Eq "^### Version ${major}.${minor}$" CHANGES.md +} + +version="$(determine_new_version)" +check_release_description $version || { echo "Version does not have a release description"; exit 1; } +check_notexists_version $version || { echo "Version $version appears already published"; exit 1; } + |