Skip to content

Commit 8e35d54

Browse files
wolfgangwalthersteve-chavez
authored andcommitted
nix: adjust release tool to new versioning scheme
Resolves #4166
1 parent 041d4f8 commit 8e35d54

File tree

3 files changed

+21
-28
lines changed

3 files changed

+21
-28
lines changed

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ jobs:
5757
run: |
5858
cabal_version="$(grep -oP '^version:\s*\K.*' postgrest.cabal)"
5959
60-
if [[ "$cabal_version" == *.*.* ]]; then
60+
if [[ "$cabal_version" == *.*.*.* ]]; then
6161
git fetch --tags
6262
6363
if [ -z "$(git tag --list "v$cabal_version")" ]; then

nix/tools/release.nix

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -20,27 +20,24 @@ let
2020
git diff --exit-code HEAD postgrest.cabal > /dev/null
2121
trap "" ERR
2222
23+
# TODO: Support C+D bumps when implementing hackage releases
2324
bump () {
2425
current_version="$(grep -oP '^version:\s*\K.*' postgrest.cabal)"
2526
# shellcheck disable=SC2034
26-
IFS=. read -r major minor patch <<< "$current_version"
27+
IFS=. read -r A B C D <<< "$current_version"
2728
echo "Current version is $current_version"
2829
2930
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))"
3334
;;
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"
4138
;;
4239
devel)
43-
new_version="$major.$((minor+1))"
40+
new_version="$((A+1))"
4441
new_docs_version="devel"
4542
;;
4643
esac
@@ -55,13 +52,9 @@ let
5552
5653
today_date_for_changelog="$(date '+%Y-%m-%d')"
5754
if [[ "$current_branch" == "main" ]]; then
58-
if [[ "$_arg_major" == "on" ]]; then
59-
bump major
60-
else
61-
bump minor
62-
fi
55+
bump A
6356
else
64-
bump patch
57+
bump B
6558
fi
6659
6760
echo "Updating CHANGELOG.md ..."
@@ -75,10 +68,10 @@ let
7568
bump devel
7669
7770
# 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
8073
# - the devel bump is committed
81-
git branch -f "v$major"
74+
git branch "v$A"
8275
8376
echo "Committing (devel bump)..."
8477
git commit -m "bump version to $new_version" > /dev/null
@@ -90,7 +83,7 @@ let
9083
9184
if [[ "$current_branch" == "main" ]]; then
9285
push1="git push $remote $current_branch"
93-
push2="git push $remote v$major --force"
86+
push2="git push $remote v$A"
9487
else
9588
push1="git push $remote $current_branch"
9689
push2=""

src/PostgREST/Version.hs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ import Protolude
1111
version :: [Text]
1212
version = T.splitOn "." VERSION_postgrest
1313

14-
-- | User friendly version number such as '1.1.1'.
15-
-- Pre-release versions are tagged as such, e.g., '1.1 (pre-release)'.
14+
-- | User friendly version number such as '14.0'.
15+
-- Pre-release versions are tagged as such, e.g., '15 (pre-release)'.
1616
prettyVersion :: ByteString
1717
prettyVersion =
18-
VERSION_postgrest <> preRelease
18+
(encodeUtf8 . T.intercalate "." $ take 2 version) <> preRelease
1919
where
2020
preRelease = if isPreRelease then " (pre-release)" else mempty
2121

@@ -29,7 +29,7 @@ docsVersion
2929
| otherwise = "v" <> T.intercalate "." (take 1 version)
3030

3131

32-
-- | Versions with two components (e.g., '1.1') are treated as pre-releases.
32+
-- | Versions with one components (e.g., '15') are treated as pre-releases.
3333
isPreRelease :: Bool
3434
isPreRelease =
35-
length version == 2
35+
length version == 1

0 commit comments

Comments
 (0)