Skip to content

Commit

Permalink
fix(ci): correct syntax in version determination script
Browse files Browse the repository at this point in the history
- Resolve unexpected token error in version bump logic
- Adjust variable usage for compatibility with bash syntax
- Ensure consistent use of 'v' prefix when checking existing tags

This commit fixes a syntax error in the automated versioning script,
allowing the release workflow to run successfully.
  • Loading branch information
joshuadanpeterson committed Jul 6, 2024
1 parent 0cd9220 commit 08e7f8e
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,20 +77,21 @@ jobs:
git log ${LATEST_TAG}..HEAD --pretty=format:%s > commits.txt
if grep -q '^BREAKING CHANGE:' commits.txt || grep -q '^[a-zA-Z]\+!:' commits.txt; then
echo "BUMP=major" >> $GITHUB_OUTPUT
BUMP="major"
elif grep -q '^feat:' commits.txt; then
echo "BUMP=minor" >> $GITHUB_OUTPUT
BUMP="minor"
else
echo "BUMP=patch" >> $GITHUB_OUTPUT
BUMP="patch"
fi
echo "BUMP=${BUMP}" >> $GITHUB_OUTPUT
LATEST_VERSION=${LATEST_TAG#v}
IFS='.' read -ra VERSION_PARTS <<< "$LATEST_VERSION"
MAJOR=${VERSION_PARTS[0]:-0}
MINOR=${VERSION_PARTS[1]:-0}
PATCH=${VERSION_PARTS[2]:-0}
case ${{ steps.determine_version.outputs.BUMP }} in
case $BUMP in
major)
NEW_VERSION="$((MAJOR + 1)).0.0"
;;
Expand All @@ -104,8 +105,8 @@ jobs:
echo "NEW_VERSION=v${NEW_VERSION}" >> $GITHUB_OUTPUT
# Check if the calculated version already exists
if git rev-parse $NEW_VERSION >/dev/null 2>&1; then
echo "Version $NEW_VERSION already exists. Incrementing patch version."
if git rev-parse v$NEW_VERSION >/dev/null 2>&1; then
echo "Version v$NEW_VERSION already exists. Incrementing patch version."
PATCH=$((PATCH + 1))
NEW_VERSION="${MAJOR}.${MINOR}.${PATCH}"
echo "NEW_VERSION=v${NEW_VERSION}" >> $GITHUB_OUTPUT
Expand Down

0 comments on commit 08e7f8e

Please sign in to comment.