@@ -17,7 +17,7 @@ import Data.Bits
1717import qualified Data.ByteString.Lazy as BSL
1818import Data.Default
1919import qualified Data.Map as Map
20−import Data.Maybe (isJust, listToMaybe)
20+import Data.Maybe (listToMaybe)
2121import qualified Data.Set as Set
2222import Data.String.Here.Interpolated (i)
2323import qualified Data.Text as T
@@ -137,6 +137,9 @@ deployPush deployPath getNixBuilders = do
137137 Left err -> do
138138 putLog Warning [i|No valid thunk found at ${srcPath} due to ${err}: Attempting to find commit hash anyway.|]
139139 handleUnpackedWith $ fmap show . listToMaybe . T.lines <$> readGitProcess srcPath ["rev-parse", "HEAD"]
140+ version <- case version' of
141+ Nothing -> failWith [i|Could not determine commit hash of ${srcPath}|]
142+ Just v -> v <$ putLog Notice [i|Deploying commit ${v}|]
140143 builders <- getNixBuilders
141144 let moduleFile = deployPath </> "module.nix"
142145 moduleFileExists <- liftIO $ doesFileExist moduleFile
@@ -153,7 +156,7 @@ deployPush deployPath getNixBuilders = do
153156 [ strArg "hostName" host
154157 , strArg "adminEmail" adminEmail
155158 , strArg "routeHost" routeHost
156− , strArg "version" $ maybe "Deployment was done with a dirty source tree" id version'
159+ , strArg "version" version
157160 , boolArg "enableHttps" enableHttps
158161 ] <> [rawArg "module" ("import " <> toNixPath moduleFile) | moduleFileExists ])
159162 & nixCmdConfig_builders .~ builders
@@ -183,14 +186,13 @@ deployPush deployPath getNixBuilders = do
183186 , "/nix/var/nix/profiles/system/bin/switch-to-configuration switch"
184187 ]
185188 ]
186− when (isJust version') $ do
187− isClean <- checkGitCleanStatus deployPath True
188− when (not isClean) $ do
189− withSpinner "Committing changes to Git" $ do
190− callProcessAndLogOutput (Debug, Error) $ proc "git"
191− ["-C", deployPath, "add", "."]
192− callProcessAndLogOutput (Debug, Error) $ proc "git"
193− ["-C", deployPath, "commit", "-m", "New deployment"]
189+ isClean <- checkGitCleanStatus deployPath True
190+ when (not isClean) $ do
191+ withSpinner "Committing changes to Git" $ do
192+ callProcessAndLogOutput (Debug, Error) $ proc "git"
193+ ["-C", deployPath, "add", "."]
194+ callProcessAndLogOutput (Debug, Error) $ proc "git"
195+ ["-C", deployPath, "commit", "-m", "New deployment"]
194196 putLog Notice $ "Deployed => " <> T.pack route
195197 where
196198 callProcess' envMap cmd args = do