diff options
| author | Roman Smrž <roman.smrz@seznam.cz> | 2025-11-09 22:42:35 +0100 |
|---|---|---|
| committer | Roman Smrž <roman.smrz@seznam.cz> | 2025-11-12 21:20:53 +0100 |
| commit | e96ecb1ce8f81b3a256f6982c5da1aa7cbeb4e59 (patch) | |
| tree | 781d602220c142e9966736061ee82fbfa7ca1598 /src/Config.hs | |
| parent | 652d3e82208da8a0b1bd052c7284b5904e59d20a (diff) | |
Changelog: Job section to publish artifacts to specified destination
Diffstat (limited to 'src/Config.hs')
| -rw-r--r-- | src/Config.hs | 13 |
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 |