From eacacbf44e389754fb08e48ec3543e76d70515bb Mon Sep 17 00:00:00 2001 From: Robin Krom Date: Thu, 30 Jan 2020 10:51:39 +0100 Subject: [PATCH] fix release script (#4275) * fix release script only upload from the linux machine and escape arguments to `publish`, otherwise they get interpreted by bazel. CHANGELOG_BEGIN CHANGELOG_END * Update release/src/Main.hs Co-Authored-By: Moritz Kiefer * Update release/src/Main.hs Co-Authored-By: Moritz Kiefer * bracket -> bracket_ Co-authored-by: Moritz Kiefer --- release/src/Main.hs | 14 ++++++++------ release/src/Util.hs | 2 ++ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/release/src/Main.hs b/release/src/Main.hs index 9375b2dfc647..dbe0346abcaf 100644 --- a/release/src/Main.hs +++ b/release/src/Main.hs @@ -116,12 +116,14 @@ main = do -- We can't put an .npmrc file in the root of the directory because other bazel npm -- code picks it up and looks for the token which is not yet set before the release -- phase. - $logDebug "Uploading npm packages" - liftIO $ bracket - (writeFile npmrcPath "//registry.npmjs.org/:_authToken=${NPM_TOKEN}") - (\() -> Dir.removeFile npmrcPath) - (\() -> forM_ npmPackages - $ \rule -> liftIO $ callCommand $ "bazel run " <> rule <> ":npm_package.publish --access public") + -- Only upload from the linux machine. + when (osName == "linux") $ do + $logDebug "Uploading npm packages" + liftIO $ bracket_ + (writeFile npmrcPath "//registry.npmjs.org/:_authToken=${NPM_TOKEN}") + (Dir.removeFile npmrcPath) + (forM_ npmPackages + $ \rule -> liftIO $ callCommand $ "bazel run " <> rule <> ":npm_package.publish -- --access public") -- set variables for next steps in Azure pipelines liftIO . putStrLn $ "##vso[task.setvariable variable=has_released;isOutput=true]true" diff --git a/release/src/Util.hs b/release/src/Util.hs index 5ea225f83a20..1db82c66100e 100644 --- a/release/src/Util.hs +++ b/release/src/Util.hs @@ -26,6 +26,8 @@ module Util ( resolvePomData, loggedProcess_, isDeployJar, + + osName ) where