Skip to content

Cut Release Branch

Cut Release Branch #5

name: Cut Release Branch
on:
workflow_dispatch:
inputs:
version:
description: 'Version for the release (e.g., 0.3.0)'
required: true
type: string
commit_sha:
description: 'Commit SHA to cut from (leave empty for latest main)'
required: false
type: string
permissions:
contents: write
actions: write
jobs:
cut-branch:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.commit_sha || 'main' }}
- name: Validate version format
run: |
if ! echo "${{ inputs.version }}" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+$'; then
echo "Error: Version must be in format X.Y.Z (e.g., 0.3.0)"
exit 1
fi
- name: Create and push release branch
run: |
BRANCH_NAME="release/v${{ inputs.version }}"
git checkout -b "$BRANCH_NAME"
git push origin "$BRANCH_NAME"
echo "Created branch: $BRANCH_NAME"
- name: Trigger Release Please
env:
GH_TOKEN: ${{ github.token }}
run: |
gh workflow run release-please.yml \
--repo ${{ github.repository }} \
-f version=${{ inputs.version }}
echo "Triggered Release Please workflow for version ${{ inputs.version }}"