From 4b757201a79fe6cd2e1c140f7f30bb8b76b53599 Mon Sep 17 00:00:00 2001 From: Ivan Goncharov Date: Wed, 10 Jun 2020 23:09:58 +0300 Subject: [PATCH] CI: use bash to run 'gitpublish.sh' (#2640) --- package.json | 4 ++-- resources/gitpublish.sh | 14 ++++++++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) mode change 100644 => 100755 resources/gitpublish.sh diff --git a/package.json b/package.json index e70052efcf..af217a6d28 100644 --- a/package.json +++ b/package.json @@ -45,8 +45,8 @@ "changelog": "node resources/gen-changelog.js", "preversion": ". ./resources/checkgit.sh && npm ci", "version": "node resources/gen-version.js && npm test && git add src/version.js", - "gitpublish:npm": ". ./resources/gitpublish.sh npm npmDist", - "gitpublish:deno": ". ./resources/gitpublish.sh deno denoDist" + "gitpublish:npm": "bash ./resources/gitpublish.sh npm npmDist", + "gitpublish:deno": "bash ./resources/gitpublish.sh deno denoDist" }, "dependencies": {}, "devDependencies": { diff --git a/resources/gitpublish.sh b/resources/gitpublish.sh old mode 100644 new mode 100755 index e4ec327cae..3da2ee9eaa --- a/resources/gitpublish.sh +++ b/resources/gitpublish.sh @@ -13,8 +13,13 @@ DIST_DIR=$2 # Exit immediately if any subcommand terminated set -e -if [ ! -d $DIST_DIR ]; then - echo "Directory '${DIST_DIR}' does not exist!" +if [ -z "${BRANCH}" ]; then + echo 'Must provide BRANCH as first argument!' + exit 1; +fi; + +if [ -z "${DIST_DIR}" ]; then + echo 'Must provide DIST_DIR as second argument!' exit 1; fi; @@ -23,6 +28,11 @@ if [ -z "${GH_TOKEN}" ]; then exit 1; fi; +if [ ! -d $DIST_DIR ]; then + echo "Directory '${DIST_DIR}' does not exist!" + exit 1; +fi; + # Create empty directory rm -rf $BRANCH git clone -b $BRANCH -- "https://${GH_TOKEN}@github.com/graphql/graphql-js.git" $BRANCH