Skip to content

Commit

Permalink
fix: Treat pre-release and docs versions correctly for new release wo…
Browse files Browse the repository at this point in the history
…rkflow

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.
  • Loading branch information
wolfgangwalther committed Jun 19, 2024
1 parent 9657d46 commit 16d0e1c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/PostgREST/Version.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand All @@ -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

0 comments on commit 16d0e1c

Please sign in to comment.