@@ -40,7 +40,8 @@ data BuildFlags = BuildFlags
40 , bfEnableExecDyn :: !Bool
40 , bfEnableExecDyn :: !Bool
41 , bfVerbose :: !Bool
41 , bfVerbose :: !Bool
42 , bfSkipCheck :: !Bool
42 , bfSkipCheck :: !Bool
43− , bfUploadV2 :: !Bool
43+ , bfUploadV1 :: !Bool
44+ , bfServer :: !StackageServer
44 } deriving (Show)
45 } deriving (Show)
46data BuildType = Nightly | LTS BumpType
47data BuildType = Nightly | LTS BumpType
@@ -253,7 +254,11 @@ completeBuild buildType buildFlags = withManager tlsManagerSettings $ \man -> do
255 when (bfDoUpload buildFlags) $
256 when (bfDoUpload buildFlags) $
256− finallyUpload (bfUploadV2 buildFlags) settings man
257+ finallyUpload
258+ (not $ bfUploadV1 buildFlags)
259+ (bfServer buildFlags)
258justUploadNightly
263justUploadNightly
259 :: Text -- ^ nightly date
264 :: Text -- ^ nightly date
@@ -261,7 +266,7 @@ justUploadNightly
261justUploadNightly day = do
266justUploadNightly day = do
262 plan <- decodeFileEither (fpToString $ nightlyPlanFile day)
267 plan <- decodeFileEither (fpToString $ nightlyPlanFile day)
263 >>= either throwM return
268 >>= either throwM return
264− withManager tlsManagerSettings $ finallyUpload False $ nightlySettings day plan
269+ withManager tlsManagerSettings $ finallyUpload False def $ nightlySettings day plan
266getStackageAuthToken :: IO Text
271getStackageAuthToken :: IO Text
267getStackageAuthToken = do
272getStackageAuthToken = do
@@ -273,8 +278,9 @@ getStackageAuthToken = do
273-- | The final part of the complete build process: uploading a bundle,
278-- | The final part of the complete build process: uploading a bundle,
274-- docs and a distro to hackage.
279-- docs and a distro to hackage.
275finallyUpload :: Bool -- ^ use v2 upload
280finallyUpload :: Bool -- ^ use v2 upload
276 -> Settings -> Manager -> IO ()
282 -> Settings -> Manager -> IO ()
277−finallyUpload useV2 settings@Settings{..} man = do
283+finallyUpload useV2 server settings@Settings{..} man = do
278 putStrLn "Uploading bundle to Stackage Server"
284 putStrLn "Uploading bundle to Stackage Server"
280 token <- getStackageAuthToken
286 token <- getStackageAuthToken
@@ -282,7 +288,7 @@ finallyUpload useV2 settings@Settings{..} man = do
284 res <- flip uploadBundleV2 man UploadBundleV2
290 res <- flip uploadBundleV2 man UploadBundleV2
285− { ub2Server = def
291+ { ub2Server = server
286 , ub2AuthToken = token
292 , ub2AuthToken = token
287 , ub2Bundle = bundleDest
293 , ub2Bundle = bundleDest