Skip to content

Commit

Permalink
Added early exit if no package versions changed
Browse files Browse the repository at this point in the history
  • Loading branch information
absurdprofit committed Aug 1, 2024
1 parent 84579a7 commit 9276665
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,15 @@ jobs:
fi
TAG_NAME=${{ env.BRANCH_NAME }}
COMMIT_HASH=${{ env.COMMIT_HASH }}
lerna list --json --since ${TAG_NAME} | jq -r '.[] | .location' | while read -r package; do
CHANGED_PACKAGES_JSON=$(npx lerna list --json --since ${TAG_NAME})
CHANGED_PACKAGES_COUNT=$(echo $CHANGED_PACKAGES_JSON | jq '. | length')
if [[ $CHANGED_PACKAGES_COUNT -eq 0 ]]; then
echo "No packages changed. Exiting..."
exit 0
fi
echo $CHANGED_PACKAGES_JSON | jq -r '.[].location' | while read -r package; do
CURRENT_VERSION=$(jq -r '.version' $package/package.json)
NEW_VERSION="${CURRENT_VERSION}-${TAG_NAME}.${COMMIT_HASH}"
jq ".version = \"${NEW_VERSION}\"" $package/package.json > $package/package.json.tmp && mv $package/package.json.tmp $package/package.json
Expand Down

0 comments on commit 9276665

Please sign in to comment.