chore(api): maintain api version using poetry
Part-of: <https://dev.funkwhale.audio/funkwhale/funkwhale/-/merge_requests/2332>
This commit is contained in:
parent
9bf0367372
commit
47944b18de
|
@ -0,0 +1 @@
|
|||
Maintain api version using poetry
|
|
@ -55,10 +55,12 @@ Once we're ready to release a new version of the software, we can use the follow
|
|||
nano CHANGELOG # Add these lists to the CHANGELOG
|
||||
```
|
||||
|
||||
7. Update the `__version__` variable to the next release version
|
||||
7. Update the next release version
|
||||
|
||||
```sh
|
||||
nano api/funkwhale_api/__init__.py
|
||||
cd api
|
||||
poetry version "$NEXT_RELEASE"
|
||||
cd ..
|
||||
```
|
||||
|
||||
8. Commit all changes
|
||||
|
|
|
@ -1,13 +1,22 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -eux
|
||||
# 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/
|
||||
|
||||
# given a commit hash, will append this to the version number stored
|
||||
# in api/funkwhale_api/__init__.py
|
||||
set -eu
|
||||
|
||||
COMMIT=$1
|
||||
FILE="api/funkwhale_api/__init__.py"
|
||||
error() {
|
||||
echo >&2 "error: $*"
|
||||
exit 1
|
||||
}
|
||||
|
||||
SUFFIX="\1+git.$COMMIT"
|
||||
EXPR=$(printf 's@__version__ = "(.*)"@__version__ = "%s"@' "$SUFFIX")
|
||||
sed -i -E "$EXPR" "$FILE"
|
||||
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"
|
||||
|
|
Loading…
Reference in New Issue