|
20 | 20 | git diff --exit-code HEAD postgrest.cabal > /dev/null |
21 | 21 | trap "" ERR |
22 | 22 |
|
| 23 | + # TODO: Support C+D bumps when implementing hackage releases |
23 | 24 | bump () { |
24 | 25 | current_version="$(grep -oP '^version:\s*\K.*' postgrest.cabal)" |
25 | 26 | # shellcheck disable=SC2034 |
26 | | - IFS=. read -r major minor patch <<< "$current_version" |
| 27 | + IFS=. read -r A B C D <<< "$current_version" |
27 | 28 | echo "Current version is $current_version" |
28 | 29 |
|
29 | 30 | case "$1" in |
30 | | - major) |
31 | | - new_version="$((major+1)).0.0" |
32 | | - new_docs_version="$((major+1)).0" |
| 31 | + A) |
| 32 | + new_version="$((A+1)).0" |
| 33 | + new_docs_version="$((A+1))" |
33 | 34 | ;; |
34 | | - minor) |
35 | | - new_version="$major.$((minor+1)).0" |
36 | | - new_docs_version="$major.$((minor+1))" |
37 | | - ;; |
38 | | - patch) |
39 | | - new_version="$major.$minor.$((patch+1))" |
40 | | - new_docs_version="$major.$minor" |
| 35 | + B) |
| 36 | + new_version="$A.$((B+1))" |
| 37 | + new_docs_version="$A" |
41 | 38 | ;; |
42 | 39 | devel) |
43 | | - new_version="$major.$((minor+1))" |
| 40 | + new_version="$((A+1))" |
44 | 41 | new_docs_version="devel" |
45 | 42 | ;; |
46 | 43 | esac |
|
55 | 52 |
|
56 | 53 | today_date_for_changelog="$(date '+%Y-%m-%d')" |
57 | 54 | if [[ "$current_branch" == "main" ]]; then |
58 | | - if [[ "$_arg_major" == "on" ]]; then |
59 | | - bump major |
60 | | - else |
61 | | - bump minor |
62 | | - fi |
| 55 | + bump A |
63 | 56 | else |
64 | | - bump patch |
| 57 | + bump B |
65 | 58 | fi |
66 | 59 |
|
67 | 60 | echo "Updating CHANGELOG.md ..." |
|
75 | 68 | bump devel |
76 | 69 |
|
77 | 70 | # The order of operations is important here: |
78 | | - # - bump devel is run and $major is upated to the new version |
79 | | - # - the branch is created with the new major, but the commit before the devel bump |
| 71 | + # - bump devel is run and $A is upated to the new version |
| 72 | + # - the branch is created with the new A, but the commit before the devel bump |
80 | 73 | # - the devel bump is committed |
81 | | - git branch -f "v$major" |
| 74 | + git branch "v$A" |
82 | 75 |
|
83 | 76 | echo "Committing (devel bump)..." |
84 | 77 | git commit -m "bump version to $new_version" > /dev/null |
|
90 | 83 |
|
91 | 84 | if [[ "$current_branch" == "main" ]]; then |
92 | 85 | push1="git push $remote $current_branch" |
93 | | - push2="git push $remote v$major --force" |
| 86 | + push2="git push $remote v$A" |
94 | 87 | else |
95 | 88 | push1="git push $remote $current_branch" |
96 | 89 | push2="" |
|
0 commit comments