hkgr 0.2.2 → 0.2.3
raw patch · 3 files changed
+30/−15 lines, 3 files
Files
- CHANGELOG.md +7/−0
- Main.hs +20/−13
- hkgr.cabal +3/−2
CHANGELOG.md view
@@ -1,5 +1,12 @@ # Changelog +## 0.2.3 (2019-09-30)+- push git tag+- hlint is now a warning not an error+- prefix version tags with v+- surround git diff output with quote lines+- catch exception for sdist+ ## 0.2.2 (2019-07-06) - run hlint before git tag - relax force sdist when no existing tarball
Main.hs view
@@ -7,7 +7,7 @@ import Control.Applicative (pure, (<$>)) #endif -import Control.Exception (bracket_)+import Control.Exception (bracket_, onException) import Control.Monad import Data.Maybe #if (defined(MIN_VERSION_base) && MIN_VERSION_base(4,11,0))@@ -43,32 +43,38 @@ tagDistCmd :: Bool -> IO () tagDistCmd force = do mhlint <- findExecutable "hlint"- when (isJust mhlint) $ cmd_ "hlint" ["."]- git_ "diff" []+ when (isJust mhlint) $ void $ cmdBool "hlint" ["."]+ diff <- git "diff" []+ unless (null diff) $ do+ putStrLn "=== start of uncommitted changes ==="+ putStrLn diff+ putStrLn "=== end of uncommitted changes ===" pkgid <- getPackageId checkNotPublished pkgid- let tag = packageVersion pkgid+ let tag = pkgidTag pkgid tagHash <- cmdMaybe "git" ["rev-parse", tag] when (isJust tagHash && not force) $ error' "tag exists: use --force to override" git_ "tag" $ ["--force" | force] ++ [tag] unless force $ putStrLn tag- distOk <- sdist force pkgid- unless distOk $ do+ sdist force pkgid `onException` do putStrLn "Resetting tag" if force then git_ "tag" ["--force", tag, fromJust tagHash] else git_ "tag" ["--delete", tag] +pkgidTag :: PackageIdentifier -> String+pkgidTag pkgid = "v" ++ packageVersion pkgid+ checkNotPublished :: PackageIdentifier -> IO () checkNotPublished pkgid = do let published = "dist" </> showPkgId pkgid <.> ".tar.gz" <.> "published" exists <- doesFileExist published when exists $ error' $ showPkgId pkgid <> " was already published!!" -sdist :: Bool -> PackageIdentifier -> IO Bool+sdist :: Bool -> PackageIdentifier -> IO () sdist force pkgid = do- let ver = packageVersion pkgid+ let tag = pkgidTag pkgid let target = "dist" </> showPkgId pkgid <.> ".tar.gz" haveTarget <- doesFileExist target when haveTarget $@@ -78,13 +84,12 @@ cwd <- getCurrentDirectory withTempDirectory "tmp-sdist" $ do git_ "clone" ["-q", "--no-checkout", "..", "."]- git_ "checkout" ["-q", ver]+ git_ "checkout" ["-q", tag] cabal_ "check" [] cabal_ "configure" [] -- cabal_ "build" []- distOk <- cmdBool "cabal" ["sdist"]- when distOk $ renameFile target (cwd </> target)- return distOk+ cabal_ "sdist" []+ renameFile target (cwd </> target) showVersionCmd :: IO () showVersionCmd = do@@ -101,7 +106,9 @@ cabal_ "upload" $ ["--publish" | publish] ++ [file] when publish $ do createFileLink (takeFileName file) (file <.> "published")- let tag = packageVersion pkgid+ let tag = pkgidTag pkgid+ -- first push ref of tag and then tag, surely you are joking+ git_ "push" ["origin", tag] git_ "push" ["origin", tag] upHaddockCmd :: Bool -> IO ()
hkgr.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.0 name: hkgr-version: 0.2.2+version: 0.2.3 synopsis: Simple Hackage release workflow for package maintainers description: Hkgr (pronouced "Hackager") is a tool to help make new releases of@@ -17,7 +17,8 @@ build-type: Simple extra-doc-files: README.md , CHANGELOG.md-tested-with: GHC == 8.6.5, GHC == 8.4.4, GHC == 8.2.2, GHC == 8.0.2+tested-with: GHC == 8.8.1, GHC == 8.6.5, GHC == 8.4.4, GHC == 8.2.2,+ GHC == 8.0.2 source-repository head type: git