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