From 1656a5796cd865b519a7092e0bc885a191c06e47 Mon Sep 17 00:00:00 2001 From: Nikhil Thorat Date: Mon, 1 Apr 2019 13:53:09 -0400 Subject: [PATCH 1/5] Add GPU publishing to the publish-npm script --- .gitignore | 1 + scripts/publish-npm.sh | 3 +++ 2 files changed, 4 insertions(+) diff --git a/.gitignore b/.gitignore index 0fb39bde..0d1853e7 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ demo/train-* .nyc_output/ coverage/ .DS_Store +tensorflow-tfjs-node*.tgz diff --git a/scripts/publish-npm.sh b/scripts/publish-npm.sh index 5737b0e8..b019644b 100755 --- a/scripts/publish-npm.sh +++ b/scripts/publish-npm.sh @@ -41,6 +41,9 @@ fi yarn build-npm ./scripts/make-version # This is for safety in case you forgot to do 2). +# Publish the CPU package npm publish +# Publish the GPU package +ls tensorflow-tfjs-node-gpu* | xargs npm publish ./scripts/tag-version echo 'Yay! Published a new package to npm.' From 8f5e51d17a43d4991532cb97cf204fdb2c84749c Mon Sep 17 00:00:00 2001 From: Nikhil Thorat Date: Mon, 1 Apr 2019 17:00:14 -0400 Subject: [PATCH 2/5] save --- scripts/publish-npm.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/publish-npm.sh b/scripts/publish-npm.sh index b019644b..4c8d98d6 100755 --- a/scripts/publish-npm.sh +++ b/scripts/publish-npm.sh @@ -44,6 +44,6 @@ yarn build-npm # Publish the CPU package npm publish # Publish the GPU package -ls tensorflow-tfjs-node-gpu* | xargs npm publish +ls tensorflow-tfjs-node-gpu*.tgz | xargs npm publish ./scripts/tag-version echo 'Yay! Published a new package to npm.' From 3dda806be57e5dc4875f40e465d5d743f77d921d Mon Sep 17 00:00:00 2001 From: Nikhil Thorat Date: Tue, 2 Apr 2019 12:57:00 -0400 Subject: [PATCH 3/5] save --- scripts/publish-npm.sh | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/scripts/publish-npm.sh b/scripts/publish-npm.sh index 4c8d98d6..2043d8f0 100755 --- a/scripts/publish-npm.sh +++ b/scripts/publish-npm.sh @@ -29,21 +29,30 @@ set -e BRANCH=`git rev-parse --abbrev-ref HEAD` ORIGIN=`git config --get remote.origin.url` -if [ "$BRANCH" != "master" ] && [ "$BRANCH" != "0.3.x" ]; then - echo "Error: Switch to the master or a release branch before publishing." - exit -fi +# if [ "$BRANCH" != "master" ] && [ "$BRANCH" != "0.3.x" ]; then +# echo "Error: Switch to the master or a release branch before publishing." +# exit +# fi if ! [[ "$ORIGIN" =~ tensorflow/tfjs-node ]]; then echo "Error: Switch to the main repo (tensorflow/tfjs-node) before publishing." exit fi -yarn build-npm +#yarn build-npm ./scripts/make-version # This is for safety in case you forgot to do 2). + +GPU_TARBALLS=$(ls tensorflow-tfjs-node-gpu*.tgz) +GPU_TARBALL_COUNT=$(echo $GPU_TARBALLS | wc -w | xargs) +if [ "$GPU_TARBALL_COUNT" != "1" ]; then + echo "Error: found multiple GPU tarballs. Please make sure there is only one." + echo $GPU_TARBALLS + exit +fi + # Publish the CPU package npm publish # Publish the GPU package -ls tensorflow-tfjs-node-gpu*.tgz | xargs npm publish +echo $GPU_TARBALLS | xargs npm publish ./scripts/tag-version echo 'Yay! Published a new package to npm.' From 09967393632b9df167a291341ab1626117f678a4 Mon Sep 17 00:00:00 2001 From: Nikhil Thorat Date: Tue, 2 Apr 2019 12:58:50 -0400 Subject: [PATCH 4/5] save --- scripts/publish-npm.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/publish-npm.sh b/scripts/publish-npm.sh index 2043d8f0..ce43f35f 100755 --- a/scripts/publish-npm.sh +++ b/scripts/publish-npm.sh @@ -45,7 +45,7 @@ fi GPU_TARBALLS=$(ls tensorflow-tfjs-node-gpu*.tgz) GPU_TARBALL_COUNT=$(echo $GPU_TARBALLS | wc -w | xargs) if [ "$GPU_TARBALL_COUNT" != "1" ]; then - echo "Error: found multiple GPU tarballs. Please make sure there is only one." + echo "Error: Please make sure there is exactly one GPU tarball, found:" echo $GPU_TARBALLS exit fi From 67fe4b35b9ff17bba06f93eec7632492dcddc134 Mon Sep 17 00:00:00 2001 From: Nikhil Thorat Date: Tue, 2 Apr 2019 12:59:41 -0400 Subject: [PATCH 5/5] save --- scripts/publish-npm.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/publish-npm.sh b/scripts/publish-npm.sh index ce43f35f..3d1e6e05 100755 --- a/scripts/publish-npm.sh +++ b/scripts/publish-npm.sh @@ -29,17 +29,17 @@ set -e BRANCH=`git rev-parse --abbrev-ref HEAD` ORIGIN=`git config --get remote.origin.url` -# if [ "$BRANCH" != "master" ] && [ "$BRANCH" != "0.3.x" ]; then -# echo "Error: Switch to the master or a release branch before publishing." -# exit -# fi +if [ "$BRANCH" != "master" ] && [ "$BRANCH" != "0.3.x" ]; then + echo "Error: Switch to the master or a release branch before publishing." + exit +fi if ! [[ "$ORIGIN" =~ tensorflow/tfjs-node ]]; then echo "Error: Switch to the main repo (tensorflow/tfjs-node) before publishing." exit fi -#yarn build-npm +yarn build-npm ./scripts/make-version # This is for safety in case you forgot to do 2). GPU_TARBALLS=$(ls tensorflow-tfjs-node-gpu*.tgz)