fix: Treat pre-release and docs versions correctly for new release workflow

Since we changed our release workflow, we have adjusted:
- the docs to use postgrest.org/en/v12/ -style URLs, i.e. only using the
major component.
- the pre-release / devel versions to contain only two instead of four
version parts, i.e. currently 12.3.
This commit is contained in:
Wolfgang Walther
2024-06-18 08:28:57 +02:00
committed by Wolfgang Walther
parent fae24c04b1
commit d311fb17c4
+5 -5
View File
@@ -15,7 +15,7 @@ import Protolude
-- | User friendly version number such as '1.1.1'.
-- Pre-release versions are tagged as such, e.g., '1.1.1.1 (pre-release)'.
-- Pre-release versions are tagged as such, e.g., '1.1 (pre-release)'.
-- If a git hash is available, it's added to the version, e.g., '1.1.1 (abcdef0)'.
prettyVersion :: ByteString
prettyVersion =
@@ -31,14 +31,14 @@ prettyVersion =
-- | Version number used in docs.
-- Pre-release versions link to the latest docs
-- Uses only the two first components of the version. Example: 'v1.1'
-- Uses only the first component of the version. Example: 'v1'
docsVersion :: Text
docsVersion
| isPreRelease = "latest"
| otherwise = "v" <> (T.intercalate "." . map show . take 2 $ versionBranch version)
| otherwise = "v" <> (T.intercalate "." . map show . take 1 $ versionBranch version)
-- | Versions with four components (e.g., '1.1.1.1') are treated as pre-releases.
-- | Versions with two components (e.g., '1.1') are treated as pre-releases.
isPreRelease :: Bool
isPreRelease =
length (versionBranch version) == 4
length (versionBranch version) == 2