Files
TwitchDropsMiner/.github/workflows/version-release.yml
github-actions[bot] f972a9507e refactor: streamline release workflows and extract validation to scripts
- Simplify github-release workflow by removing auto-generation and linting steps
- Extract SemVer validation from inline workflow to dedicated script
- Add production environment protection to version-release workflow
- Create reusable validation and update scripts in .github/scripts/
- Update release notes for v1.1.1

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-26 21:34:50 +11:00

74 lines
2.1 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: Configure Git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- 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: |
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"