summaryrefslogtreecommitdiff
path: root/src/Config.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Config.hs')
-rw-r--r--src/Config.hs13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/Config.hs b/src/Config.hs
index 9c0a79d..d643f27 100644
--- a/src/Config.hs
+++ b/src/Config.hs
@@ -97,6 +97,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"
return Job {..}
parseSingleCheckout :: Node Pos -> Parser [ JobCheckout Declared ]
@@ -143,6 +144,18 @@ parseUses = withSeq "Uses list" $ mapM $
[job, art] <- return $ T.split (== '.') text
return (JobName job, ArtifactName art)
+parsePublish :: JobName -> Node Pos -> Parser [ JobPublish Declared ]
+parsePublish ownName = withSeq "Publish list" $ mapM $
+ withMap "Publish specification" $ \m -> do
+ artifact <- m .: "artifact"
+ jpArtifact <- case T.split (== '.') artifact of
+ [ job, art ] -> return ( JobName job, ArtifactName art )
+ [ art ] -> return ( ownName, ArtifactName art )
+ _ -> mzero
+ jpDestination <- DestinationName <$> m .: "to"
+ jpPath <- fmap T.unpack <$> m .:? "path"
+ return JobPublish {..}
+
parseRepo :: Text -> Node Pos -> Parser DeclaredRepo
parseRepo name node = choice