Skip to content

Commit

Permalink
Squash
Browse files Browse the repository at this point in the history
  • Loading branch information
dpwatrous committed Jun 2, 2023
1 parent a6da20a commit 7726ab9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
21 changes: 8 additions & 13 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 @@ -14,23 +20,12 @@ package_version=$(echo "$ver-$DIST_TAG.$BUILD_BUILDNUMBER" | sed 's/_//g')
echo "Publishing package $package_name@$package_version"
echo "=================================="
echo "Working dir: $PWD"

echo "Here we go"
git status
git symbolic-ref -h
git symbolic-ref HEAD
git symbolic-ref -q HEAD
git symbolic-ref -q --short HEAD
echo "Done"

branch=$(git symbolic-ref -q --short HEAD)

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 [ "$branch" = "main" ]; then
if [ "$branch" = "refs/heads/main" ]; then
npm version --no-git-tag-version $package_version
npm publish --tag $DIST_TAG
else
Expand Down
2 changes: 1 addition & 1 deletion .vsts/linux/publish-npm-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ parameters:
steps:
- script: |
set -e
$(Build.SourcesDirectory)/.vsts/common/publish-packages.sh ${{parameters.packageName}}
$(Build.SourcesDirectory)/.vsts/common/publish-packages.sh $(Build.SourceBranch) ${{parameters.packageName}}
displayName: "Publish package: ${{parameters.packageName}}"
workingDirectory: ${{parameters.packagePath}}

0 comments on commit 7726ab9

Please sign in to comment.