on master help sign in
ob deploy push: Commit deploy dir changes after push
commit529d63bae34612e1f0606875cd563a24f48d123d authorLuigy Leon <luigy@outlook.com> dateFri 11 May 2018, 12:52 (8 years ago) parentfdb487e
2 files changed+7−6
lib/command/src/Obelisk/Command.hs+1−5 lib/command/src/Obelisk/Command/Deploy.hs+6−1
lib/command/src/Obelisk/Command.hs+1−5
@@ -24,7 +24,6 @@ import Obelisk.Command.Project
2424import Obelisk.Command.Repl
2525import Obelisk.Command.Run
2626import Obelisk.Command.Thunk
27−import Obelisk.Command.Utils
2827
2928data Args = Args
3029 { _args_noHandOffPassed :: Bool
@@ -204,10 +203,7 @@ ob = \case
204203 sshKeyPath = _deployInitOpts_sshKey deployOpts
205204 hostname = _deployInitOpts_hostname deployOpts
206205 deployInit thunkPtr (root </> "config") deployDir sshKeyPath hostname
207− DeployCommand_Push -> do
208− checkGitCleanStatus "." >>= \case
209− True -> deployPush "."
210− False -> failWith "ob push: Commit any changes to the deployment configuration before proceeding"
206+ DeployCommand_Push -> deployPush "."
211207 ObCommand_Run -> inNixShell' $ static run
212208 -- inNixShell ($(mkClosure 'ghcidAction) ())
213209 ObCommand_Thunk tc -> case tc of
lib/command/src/Obelisk/Command/Deploy.hs+6−1
@@ -55,7 +55,8 @@ deployPush deployPath = do
5555 , _nixBuildConfig_args = pure $ Arg "hostName" host
5656 }
5757 return $ listToMaybe $ lines $ buildOutput
58− build `finally` packThunk srcPath "origin" -- get upstream
58+ result <- build `finally` packThunk srcPath "origin" -- get upstream
59+ return result
5960 _ -> return Nothing
6061 forM_ result $ \res -> do
6162 callProcess "nix-copy-closure" ["-v", "--to", "root@" <> host, "--gzip", res]
@@ -67,3 +68,7 @@ deployPush deployPath = do
6768 , "/nix/var/nix/profiles/system/bin/switch-to-configuration switch"
6869 ]
6970 ]
71+ isClean <- checkGitCleanStatus deployPath
72+ when (not isClean) $ do
73+ callProcess "git" ["-C", deployPath, "add", "--update"]
74+ callProcess "git" ["-C", deployPath, "commit", "-m", "New deployment"]