Skip to content

Commit

Permalink
Merge 648aeac into 1ec04b8
Browse files Browse the repository at this point in the history
  • Loading branch information
dpwatrous authored Jun 2, 2023
2 parents 1ec04b8 + 648aeac commit 8ad001d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
18 changes: 14 additions & 4 deletions .vsts/common/publish-packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@

set -e

package_name=$1
branch=$1
if [ -z $1 ]; then
echo "Failed to publish package: No branch name supplied"
exit 1
fi

package_name=$2
if [ -z $package_name ]; then
echo "Failed to publish package: No package name supplied"
exit 1
Expand All @@ -11,11 +17,15 @@ fi
ver=$(npm pkg get version | sed 's/"//g')
package_version=$(echo "$ver-$DIST_TAG.$BUILD_BUILDNUMBER" | sed 's/_//g')

echo "Publishing package $package_name@$package_version"
echo "=================================="
echo "Working dir: $PWD"
echo "Branch: $branch"
echo "=================================="

# Publish only from the main branch for now so that we don't have to worry
# about version bumping after releases from different branches.
if [ $(git symbolic-ref -q --short HEAD) = 'main' ]; then
echo "Publishing package $package_name@$package_version"

if [ "$branch" = "refs/heads/main" ]; then
npm version --no-git-tag-version $package_version
npm publish --tag $DIST_TAG
else
Expand Down
4 changes: 3 additions & 1 deletion .vsts/linux/publish-npm-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ parameters:
packageName: ''

steps:
- bash: $(Build.SourcesDirectory)/.vsts/common/publish-packages.sh ${{parameters.packageName}}
- script: |
set -e
$(Build.SourcesDirectory)/.vsts/common/publish-packages.sh $(Build.SourceBranch) ${{parameters.packageName}}
displayName: "Publish package: ${{parameters.packageName}}"
workingDirectory: ${{parameters.packagePath}}

0 comments on commit 8ad001d

Please sign in to comment.