summaryrefslogtreecommitdiff
path: root/src/Config.hs
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2026-07-19 15:06:42 +0200
committerRoman Smrž <roman.smrz@seznam.cz>2026-07-24 21:17:52 +0200
commit73a141316db78b942160b11bdb3c92208f3eddd6 (patch)
tree1f35f0b939c8f467a45c6cbd62be771865ab838b /src/Config.hs
parent0ddc5807cab7cf3b791b1de4cffe2b1165b2480d (diff)
Push declaration within a jobHEADmaster
Diffstat (limited to 'src/Config.hs')
-rw-r--r--src/Config.hs21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/Config.hs b/src/Config.hs
index 40eb1e5..651b05c 100644
--- a/src/Config.hs
+++ b/src/Config.hs
@@ -27,6 +27,7 @@ import System.FilePath.Glob
import System.Process
import Destination
+import Job
import Job.Types
import Repo
@@ -101,6 +102,7 @@ parseJob name node = flip (withMap "Job") node $ \j -> do
jobArtifacts <- parseArtifacts j
jobUses <- maybe (return []) parseUses =<< j .:? "uses"
jobPublish <- maybe (return []) (parsePublish jobName) =<< j .:? "publish"
+ jobPush <- maybe (return []) parsePush =<< j .:? "push"
return Job {..}
parseSingleCheckout :: Node Pos -> Parser [ JobCheckout Declared ]
@@ -164,6 +166,25 @@ parsePublish ownName = withSeq "Publish list" $ mapM $
jpPath <- fmap T.unpack <$> m .:? "path"
return JobPublish {..}
+parsePush :: Node Pos -> Parser [ JobPush Declared ]
+parsePush = withSeq "Push list" $ mapM $
+ withMap "Push specification" $ \m -> do
+ source <- m .: "source"
+ jpushSource <- case T.split (== '.') source of
+ [ repo, sel ]
+ | sel == "commit"
+ -> return $ currentCommitExpr (RepoName repo)
+ _ -> mzero
+ destination <- m .: "destination"
+ jpushDestination <- case T.split (== '.') destination of
+ [ repo, sel ]
+ | [ fn, bname, fn' ] <- T.split (== '"') sel
+ , fn == "branch("
+ , fn' == ")"
+ -> return $ branchExpr (RepoName repo) bname
+ _ -> mzero
+ return JobPush {..}
+
parseRepo :: Text -> Node Pos -> Parser DeclaredRepo
parseRepo name node = choice