File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ set -e
4+
5+ package_name=$1
6+ if [ -z $package_name ]; then
7+ echo " Failed to publish package: No package name supplied"
8+ exit 1
9+ fi
10+
11+ ver=$( npm pkg get version | sed ' s/"//g' )
12+ package_version=$( echo " $ver -$DIST_TAG .$BUILD_BUILDNUMBER " | sed ' s/_//g' )
13+
14+ # Publish only from the main branch for now so that we don't have to worry
15+ # about version bumping after releases from different branches.
16+ if [ $( git symbolic-ref -q --short HEAD) = ' main' ]; then
17+ echo " Publishing package $package_name @$package_version "
18+
19+ npm version --no-git-tag-version $package_version
20+ npm publish --tag $DIST_TAG
21+ else
22+ echo " Skipped publishing $package_name @$package_version : Packages are only published from the main branch."
23+ fi
Original file line number Diff line number Diff line change @@ -3,12 +3,6 @@ parameters:
33 packageName : ' '
44
55steps :
6- - bash : |
7- set -e
8- ver=$(npm pkg get version | sed 's/"//g')
9- package_version=$(echo "$ver-$DIST_TAG.$BUILD_BUILDNUMBER" | sed 's/_//g')
10- echo "Publishing package ${{parameters.packageName}}@$package_version"
11- npm version --no-git-tag-version $package_version
12- npm publish --tag $DIST_TAG
13- displayName: "Publish package: ${{parameters.packageName}}"
14- workingDirectory: ${{parameters.packagePath}}
6+ - bash : $(Build.SourcesDirectory)/.vsts/common/publish-packages.sh ${{parameters.packageName}}
7+ displayName : " Publish package: ${{parameters.packageName}}"
8+ workingDirectory : ${{parameters.packagePath}}
You can’t perform that action at this time.
0 commit comments