committed by
Steve Chavez
parent
041d4f8ed2
commit
8e35d543bd
@@ -57,7 +57,7 @@ jobs:
|
||||
run: |
|
||||
cabal_version="$(grep -oP '^version:\s*\K.*' postgrest.cabal)"
|
||||
|
||||
if [[ "$cabal_version" == *.*.* ]]; then
|
||||
if [[ "$cabal_version" == *.*.*.* ]]; then
|
||||
git fetch --tags
|
||||
|
||||
if [ -z "$(git tag --list "v$cabal_version")" ]; then
|
||||
|
||||
+15
-22
@@ -20,27 +20,24 @@ let
|
||||
git diff --exit-code HEAD postgrest.cabal > /dev/null
|
||||
trap "" ERR
|
||||
|
||||
# TODO: Support C+D bumps when implementing hackage releases
|
||||
bump () {
|
||||
current_version="$(grep -oP '^version:\s*\K.*' postgrest.cabal)"
|
||||
# shellcheck disable=SC2034
|
||||
IFS=. read -r major minor patch <<< "$current_version"
|
||||
IFS=. read -r A B C D <<< "$current_version"
|
||||
echo "Current version is $current_version"
|
||||
|
||||
case "$1" in
|
||||
major)
|
||||
new_version="$((major+1)).0.0"
|
||||
new_docs_version="$((major+1)).0"
|
||||
A)
|
||||
new_version="$((A+1)).0"
|
||||
new_docs_version="$((A+1))"
|
||||
;;
|
||||
minor)
|
||||
new_version="$major.$((minor+1)).0"
|
||||
new_docs_version="$major.$((minor+1))"
|
||||
;;
|
||||
patch)
|
||||
new_version="$major.$minor.$((patch+1))"
|
||||
new_docs_version="$major.$minor"
|
||||
B)
|
||||
new_version="$A.$((B+1))"
|
||||
new_docs_version="$A"
|
||||
;;
|
||||
devel)
|
||||
new_version="$major.$((minor+1))"
|
||||
new_version="$((A+1))"
|
||||
new_docs_version="devel"
|
||||
;;
|
||||
esac
|
||||
@@ -55,13 +52,9 @@ let
|
||||
|
||||
today_date_for_changelog="$(date '+%Y-%m-%d')"
|
||||
if [[ "$current_branch" == "main" ]]; then
|
||||
if [[ "$_arg_major" == "on" ]]; then
|
||||
bump major
|
||||
else
|
||||
bump minor
|
||||
fi
|
||||
bump A
|
||||
else
|
||||
bump patch
|
||||
bump B
|
||||
fi
|
||||
|
||||
echo "Updating CHANGELOG.md ..."
|
||||
@@ -75,10 +68,10 @@ let
|
||||
bump devel
|
||||
|
||||
# The order of operations is important here:
|
||||
# - bump devel is run and $major is upated to the new version
|
||||
# - the branch is created with the new major, but the commit before the devel bump
|
||||
# - bump devel is run and $A is upated to the new version
|
||||
# - the branch is created with the new A, but the commit before the devel bump
|
||||
# - the devel bump is committed
|
||||
git branch -f "v$major"
|
||||
git branch "v$A"
|
||||
|
||||
echo "Committing (devel bump)..."
|
||||
git commit -m "bump version to $new_version" > /dev/null
|
||||
@@ -90,7 +83,7 @@ let
|
||||
|
||||
if [[ "$current_branch" == "main" ]]; then
|
||||
push1="git push $remote $current_branch"
|
||||
push2="git push $remote v$major --force"
|
||||
push2="git push $remote v$A"
|
||||
else
|
||||
push1="git push $remote $current_branch"
|
||||
push2=""
|
||||
|
||||
@@ -11,11 +11,11 @@ import Protolude
|
||||
version :: [Text]
|
||||
version = T.splitOn "." VERSION_postgrest
|
||||
|
||||
-- | User friendly version number such as '1.1.1'.
|
||||
-- Pre-release versions are tagged as such, e.g., '1.1 (pre-release)'.
|
||||
-- | User friendly version number such as '14.0'.
|
||||
-- Pre-release versions are tagged as such, e.g., '15 (pre-release)'.
|
||||
prettyVersion :: ByteString
|
||||
prettyVersion =
|
||||
VERSION_postgrest <> preRelease
|
||||
(encodeUtf8 . T.intercalate "." $ take 2 version) <> preRelease
|
||||
where
|
||||
preRelease = if isPreRelease then " (pre-release)" else mempty
|
||||
|
||||
@@ -29,7 +29,7 @@ docsVersion
|
||||
| otherwise = "v" <> T.intercalate "." (take 1 version)
|
||||
|
||||
|
||||
-- | Versions with two components (e.g., '1.1') are treated as pre-releases.
|
||||
-- | Versions with one components (e.g., '15') are treated as pre-releases.
|
||||
isPreRelease :: Bool
|
||||
isPreRelease =
|
||||
length version == 2
|
||||
length version == 1
|
||||
|
||||
Reference in New Issue
Block a user