Debian Codegraph @

script/release

raw symbols SCIP
1 #!/usr/bin/envscip-shell filesystem . . `/usr/bin/env`. bash
2 set -e
3
4 REPO_PATH="$( dirnamescip-shell system . . dirname. "$( cd "$(dirnamescip-shell system . . dirname. "$0")" ; pwdscip-shell system . . pwd. -P )" )"
5
6 if [scip-shell system . . `[`. "$(gitscip-shell system . . git. rev-parse --abbrev-ref HEAD)" != "dev" ]; then
7 echoscip-shell system . . echo. "Refusing to publish a release from a branch other than dev"
8 exit 1
9 fi
10
11 if [scip-shell system . . `[`. -z "$(command -v poetry)" ]; then
12 echoscip-shell system . . echo. "Poetry needs to be installed to run this script: pip3 install poetry"
13 exit 1
14 fi
15
16 function generate_versionscip-shell shell aiowatttime 2024.6.0-2 generate_version(). {
17 latest_tag="$(gitscip-shell system . . git. tag --sort=committerdate | tailscip-shell system . . tail. -1)"
18 month="$(datescip-shell system . . date. +'%Y.%m')"
19
20 if [[ "$latest_tag" =~ "$month".* ]]; then
21 patch="$(echoscip-shell system . . echo. "$latest_tag" | cutscip-shell system . . cut. -d . -f 3)"
22 ((patch=patch+1))
23 echoscip-shell system . . echo. "$month.$patch"
24 else
25 echoscip-shell system . . echo. "$month.0"
26 fi
27 }
28
29 # Temporarily uninstall pre-commit hooks so that we can push to dev and main:
30 pre-commit uninstall
31
32 # Pull the latest dev:
33 gitscip-shell system . . git. pull origin dev
34
35 # Generate the next version (in the format YEAR.MONTH.RELEASE_NUMER):
36 new_version=$(generate_versionscip-shell shell aiowatttime 2024.6.0-2 generate_version().)
37
38 # Update the PyPI package version:
39 sedscip-shell system . . sed. -i "" "s/^version = \".*\"/version = \"$new_version\"/g" "$REPO_PATH/pyproject.toml"
40 gitscip-shell system . . git. add pyproject.toml
41
42 # Commit, tag, and push:
43 gitscip-shell system . . git. commit -m "Bump version to $new_version"
44 gitscip-shell system . . git. tag "$new_version"
45 gitscip-shell system . . git. push && gitscip-shell system . . git. push --tags
46
47 # Merge dev into main:
48 gitscip-shell system . . git. checkout main
49 gitscip-shell system . . git. merge dev
50 gitscip-shell system . . git. push
51 gitscip-shell system . . git. checkout dev
52
53 # Re-initialize pre-commit:
54 pre-commit install