funquail/scripts/set-api-build-metadata.sh

22 lines
500 B
Bash
Raw Normal View History

2022-11-24 21:14:59 +01:00
#!/usr/bin/env bash
# Given a commit hash, this script will update the version in api/pyproject.toml
# The version must follow the pep440 specification https://peps.python.org/pep-0440/
2022-11-24 21:14:59 +01:00
set -eu
error() {
echo >&2 "error: $*"
exit 1
}
2022-11-24 21:14:59 +01:00
command -v poetry > /dev/null || error "poetry command not found!"
COMMIT_SHA="$1"
CURRENT_VERSION="$(poetry version --short)"
CURRENT_VERSION="${CURRENT_VERSION%%.dev*}"
VERSION_SUFFIX="dev+$COMMIT_SHA"
poetry version "$CURRENT_VERSION.$VERSION_SUFFIX"