mirror of
https://github.com/rangermix/TwitchDropsMiner.git
synced 2026-05-26 23:19:39 +00:00
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>
86 lines
2.6 KiB
YAML
86 lines
2.6 KiB
YAML
name: Create Version Release
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
version:
|
|
description: 'Release version (SemVer format, e.g., 1.2.3 or 2.0.0-rc.1)'
|
|
required: true
|
|
type: string
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
env:
|
|
CURRENT_BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
|
|
|
|
jobs:
|
|
create-release-branch:
|
|
name: Create Release Branch
|
|
runs-on: ubuntu-latest
|
|
environment: prod
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v5
|
|
with:
|
|
token: ${{ secrets.PUBLISHER_TOKEN }}
|
|
|
|
- name: Validate version format
|
|
id: validate
|
|
run: .github/scripts/validate_semver.sh "${{ github.event.inputs.version }}"
|
|
|
|
- name: Check if input version
|
|
run: |
|
|
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: |
|
|
BRANCH_NAME="release/${{ steps.validate.outputs.version }}"
|
|
|
|
if git ls-remote --heads origin "$BRANCH_NAME" | grep -q "$BRANCH_NAME"; then
|
|
echo "Error: Branch '$BRANCH_NAME' already exists"
|
|
exit 1
|
|
fi
|
|
|
|
echo "Branch '$BRANCH_NAME' does not exist, proceeding..."
|
|
|
|
- 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
|
|
|
|
# Commit changes
|
|
git add src/version.py
|
|
git commit -m "chore: bump version to $VERSION"
|
|
git push origin $CURRENT_BRANCH_NAME
|
|
|
|
BRANCH_NAME="release/${{ steps.validate.outputs.version }}"
|
|
|
|
# Create and checkout new branch
|
|
git checkout -b "$BRANCH_NAME"
|
|
|
|
# Push branch (this will trigger the publish workflow)
|
|
git push origin "$BRANCH_NAME"
|
|
|
|
# Create tag
|
|
git tag "v$VERSION"
|
|
git push origin "v$VERSION"
|
|
|
|
echo "✅ Updated version to $VERSION"
|
|
echo "✅ Created branch '$BRANCH_NAME'"
|
|
echo "✅ Created and pushed tag v$VERSION"
|
|
echo "✅ The publish workflow will now build Docker images and create the GitHub release"
|