mirror of
https://github.com/EstrellaXD/Auto_Bangumi.git
synced 2026-04-24 02:20:38 +08:00
fix(ci): extract version number from PR title
The workflow was using the full PR title (e.g., 'Release 3.2.1') as the version string, causing Docker tags and release creation to fail. Now extracts just the version number (X.Y.Z or X.Y.Z-suffix) from the PR title, handling formats like 'Release 3.2.1', 'v3.2.1', or '3.2.1'.
This commit is contained in:
9
.github/workflows/build.yml
vendored
9
.github/workflows/build.yml
vendored
@@ -98,7 +98,14 @@ jobs:
|
||||
run: |
|
||||
if [ '${{ github.event_name }}' == 'pull_request' ]; then
|
||||
if [ ${{ github.event.pull_request.merged }} == true ]; then
|
||||
echo "version=${{ github.event.pull_request.title }}" >> $GITHUB_OUTPUT
|
||||
# Extract version from PR title (handles "Release X.Y.Z", "vX.Y.Z", or "X.Y.Z")
|
||||
PR_TITLE="${{ github.event.pull_request.title }}"
|
||||
VERSION=$(echo "$PR_TITLE" | grep -oE '[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?' | head -1)
|
||||
if [ -n "$VERSION" ]; then
|
||||
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "version=$PR_TITLE" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
fi
|
||||
elif [[ ${{ github.event_name }} == 'push' && (${{ github.ref }} == *'alpha'* || ${{ github.ref }} == *'beta'*) ]]; then
|
||||
echo "version=${{ github.ref_name }}" >> $GITHUB_OUTPUT
|
||||
|
||||
Reference in New Issue
Block a user