1
0
Fork 0

git-server features

This commit is contained in:
Malte Brandy 2020-04-11 17:08:09 +02:00
parent ac51ef5f30
commit c796abb799
No known key found for this signature in database
GPG key ID: 226A2D41EF5378C9

View file

@ -13,7 +13,6 @@ let
bins = [ pkgs.git pkgs.nix ];
imports = [
"System.Environment (lookupEnv)"
"Control.Monad (ap)"
"System.Directory (withCurrentDirectory)"
];
@ -26,17 +25,18 @@ let
main = do
mirror <- lookupEnv "GL_OPTION_MIRROR"
for_ mirror $ \mirror -> do
whenJust mirror $ \mirror -> do
echo ([i|Forwarding push to #{mirror}|] :: String)
git "push" "--all" "-f" mirror
deploy <- lookupEnv "GL_OPTION_WEB_DEPLOY"
for_ deploy $ \deploy -> do
whenJust deploy $ \deploy -> do
(maybe [] ("-A":) -> target) <- lookupEnv "GL_OPTION_WEB_DEPLOY_NIX_TARGET"
(decodeUtf8 -> path) <- pwd |> captureTrim
echo ([i|Deploying build to /var/www/#{deploy}|] :: String)
bracket (checkout path) (rm "-rf") $ \dir -> withCurrentDirectory dir $ nix "build" "-o" ([i|/var/www/#{deploy}|] :: String)
bracket (checkout path) (rm "-rf") $ \dir -> withCurrentDirectory dir $ nix "build" "-o" ([i|/var/www/#{deploy}|] :: String) target
echo "Done"
test <- lookupEnv "GL_OPTION_TEST"
for_ test $ \_ -> do
whenJust test $ \_ -> do
echo "Triggering (an async) system update."
exe "sudo" ${haskellList update-command};
'';