Debian Codegraph @

.release

raw symbols SCIP
1 #!/bin/bashscip-shell filesystem . . `/bin/bash`.
2
3 declare newversion
4 declare current_version
5 declare sure
6
7
8 current_version="$(grepscip-shell system . . grep. -E version ./sure/version.py | sedscip-shell system . . sed. 's,version *= *.\(\([0-9]*[.]*\)\{3\,4\}\).,\1,g')"
9 echoscip-shell system . . echo. -en "The current version is \033[1;33m$current_version\033[0m, type a new one\n\033[1;32mnew version:\033[0m "
10 read -r newversion
11
12
13 function find_filesscip-shell shell shell-project 0.0.0 find_files(). () {
14 for name in $(findscip-shell system . . find. . -name 'README.rst' -or -name version.py -or -name conf.py | grepscip-shell system . . grep. -v '\(\.venv\|build\)[/]'); do
15 echoscip-shell system . . echo. "${name}"
16 done
17
18 }
19
20 function update_filesscip-shell shell shell-project 0.0.0 update_files(). (){
21 find_filesscip-shell shell shell-project 0.0.0 find_files(). | xargsscip-shell system . . xargs. gsed -i "s,$current_version,$newversion,g"
22 }
23 function revert_filesscip-shell shell shell-project 0.0.0 revert_files(). (){
24 find_filesscip-shell shell shell-project 0.0.0 find_files(). | xargsscip-shell system . . xargs. gsed -i "s,$newversion,$current_version,g"
25 }
26
27 echoscip-shell system . . echo. -en "\033[A\033[A\rI will make a new commit named \033[1;33m'New release $newversion'\033[0m\n"
28 echoscip-shell system . . echo. -en "Are you sure? [\033[1;32myes\033[0m or \033[1;31mno\033[0m]\n"
29 read -r sure
30
31
32 if [scip-shell system . . `[`. "${sure}" == "yes" ]; then
33 echoscip-shell system . . echo. "updating relevant files with new version..."
34 if update_filesscip-shell shell shell-project 0.0.0 update_files().; then
35 echoscip-shell system . . echo. "committing and pushing changes..."
36 echoscip-shell system . . echo. -en "New release: \033[1;32m$newversion\033[0m\n"
37 if gitscip-shell system . . git. add -f $(find_filesscip-shell shell shell-project 0.0.0 find_files().); then
38 if gitscip-shell system . . git. commit $(find_filesscip-shell shell shell-project 0.0.0 find_files().) -m "New release: $newversion"; then
39 if gitscip-shell system . . git. push; then
40 echoscip-shell system . . echo. "creating tag ${newversion}..."
41 if gitscip-shell system . . git. tag "v${newversion}"; then
42 echoscip-shell system . . echo. "pushing tag ${newversion}..."
43 gitscip-shell system . . git. push --tags
44 else
45 echoscip-shell system . . echo. "failed to create tag ${newversion}"
46 echoscip-shell system . . echo. "you might want to revert the last commit and check what happened"
47 exit 1
48 fi
49 else
50 echoscip-shell system . . echo. "failed to push, skipping release and reverting changes"
51 revert_filesscip-shell shell shell-project 0.0.0 revert_files().
52 exit 1
53 fi
54 else
55 echoscip-shell system . . echo. "failed to commit, skipping release and reverting changes"
56 revert_filesscip-shell shell shell-project 0.0.0 revert_files().
57 exit 1
58 fi
59 else
60 echoscip-shell system . . echo. "no files to git add, skipping release"
61 exit 1
62 fi;
63 else
64 echoscip-shell system . . echo. "no files were updated, skipping release"
65 exit 1
66 fi
67 else
68 echoscip-shell system . . echo. "kthankxbye"
69 fi