refactor: consolidate version extraction logic and update workflow validation

Extracted version extraction logic from workflows into a centralized script for better reusability and consistency. Updated validation output naming for clarity.

Changes:
- Add extract_version.sh for centralized version extraction
- Remove update_version.sh (functionality integrated into workflows)
- Update validate_semver.sh output: release_type → is_prerelease
- Refactor docker-release.yml to use extract_version.sh
- Refactor github-release.yml to use centralized scripts
- Add version duplication check in version-release.yml

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
github-actions[bot]
2025-10-27 10:56:33 +11:00
parent f972a9507e
commit 08dab4ca6b
6 changed files with 87 additions and 229 deletions

View File

@@ -26,10 +26,18 @@ jobs:
with:
token: ${{ secrets.PUBLISHER_TOKEN }}
- name: Configure Git
- name: Validate version format
id: validate
run: .github/scripts/validate_semver.sh "${{ github.event.inputs.version }}"
- name: Check if input version
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
CURRENT_VERSION=$(grep -oP '(?<=__version__ = ")[^"]+' src/version.py)
INPUT_VERSION="${{ github.event.inputs.version }}"
if [ "$CURRENT_VERSION" = "$INPUT_VERSION" ]; then
echo "Error: Input version '$INPUT_VERSION' is the same as the current version"
exit 1
fi
- name: Check if branch exists
run: |
@@ -45,7 +53,11 @@ jobs:
- name: Create release branch and update version
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
VERSION="${{ steps.validate.outputs.version }}"
# Update version.py
mv -f src/version.py src/last_version.py
echo "__version__ = \"$VERSION\"" > src/version.py