-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathversion.sh
executable file
·28 lines (24 loc) · 1004 Bytes
/
version.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/bash
if [ $# -ne 1 ]
then
echo "This script needs exactly one argument: the new version number or a bump."
echo "The latter can be: patch, minor, major, prepatch, preminor, premajor, prerelease."
exit 1
fi
poetry version $1
new_ver=$( poetry version | awk '{print $2;}' )
sed -i "s/\(__version__ =\).*/\1 '"${new_ver}"'/" xdyna/__init__.py
sed -i "s/\(assert __version__ ==\).*/\1 '"${new_ver}"'/" tests/test_version.py
git reset
git add pyproject.toml xdyna/__init__.py tests/test_version.py
git commit -m "Updated version number to v"${new_ver}"."
git push
git tag v${new_ver}
git push origin v${new_ver}
curl \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer "$(cat ../github_token) \
https://api.github.com/repos/xsuite/xdyna/releases \
-d '{"tag_name":"v'${new_ver}'","target_commitish":"main","name":"Xdyna release '${new_ver}'","body":"","draft":true,"prerelease":false,"generate_release_notes":true}'
poetry publish --build