Skip to content

Commit ead4940

Browse files
committed
chore: fix prerelease version retrieval
1 parent 4af51dd commit ead4940

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

.github/workflows/release-please.yml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,24 +65,32 @@ jobs:
6565
- name: Install Dependencies
6666
run: npm ci
6767

68-
- name: Calculate RC Version
68+
- name: Calculate prerelease Version
6969
id: semver
7070
run: |
71-
# The version release-please wants to release (e.g., 1.2.0)
72-
TARGET_VERSION=$(echo '${{ needs.release-please.outputs.pr }}' | jq -r '.version')
71+
# Extract the version from the PR title (e.g., "chore(main): release 1.8.0" -> "1.8.0")
72+
PR_TITLE=$(echo '${{ needs.release-please.outputs.pr }}' | jq -r '.title')
73+
TARGET_VERSION=$(echo "$PR_TITLE" | grep -oE '[0-9]+\.[0-9]+\.[0-9]+')
7374
74-
# Get the current @next version from npm.
75-
# The `|| echo """` prevents an error if the tag doesn't exist.
75+
if [ -z "$TARGET_VERSION" ]; then
76+
echo "Could not extract version from PR title: $PR_TITLE" >&2
77+
exit 1
78+
fi
79+
80+
# Get the current @next version from npm
7681
CURRENT_NEXT=$(npm view @vis.gl/react-google-maps dist-tags.next 2>/dev/null || echo "")
7782
78-
# If we are already on this version's RC cycle, increment it; otherwise, start fresh at rc.1
83+
# If current @next is already an RC for this version, increment it; Otherwise, start at rc.1
7984
if [[ "$CURRENT_NEXT" == "$TARGET_VERSION-rc."* ]]; then
8085
NEXT_VERSION=$(npx -y semver $CURRENT_NEXT -i prerelease --preid rc)
8186
else
87+
8288
NEXT_VERSION="${TARGET_VERSION}-rc.1"
8389
fi
8490
8591
echo "version=$NEXT_VERSION" >> $GITHUB_OUTPUT
92+
echo "Target version detected: $TARGET_VERSION"
93+
echo "Next RC version: $NEXT_VERSION"
8694
8795
- name: Build and Publish to @next
8896
run: |

0 commit comments

Comments
 (0)