mirror of
https://github.com/tiennm99/litellm.git
synced 2026-07-13 01:04:54 +00:00
45d41f4104
Each patch release currently spawns an ad-hoc patch/v1.84.N branch that exists only to base the next patch's cherry-picks on, leaving stale per-patch branches behind and making "what is queued for the next 1.84.x" hard to answer. Switch to one long-lived line branch per minor, stable/X.Y.x, created automatically the first time we tag X.Y.0 on that minor, and tagged on for each subsequent patch. The gate is ^v?(\d+)\.(\d+)\.0$, so rc / dev / nightly / .post / patch tags all skip cleanly; the line branch is created exactly once per minor. Existing release/<tag> behavior is untouched (additive step), and RC patches keep their current patch/v1.87.0rcN flow until that gets its own follow-up.
91 lines
3.0 KiB
YAML
91 lines
3.0 KiB
YAML
name: Create Release Branch
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
tag:
|
|
description: "Release tag (e.g. 1.84.0, 1.84.0rc1, 1.84.0.dev42, 1.84.0.post1; legacy v1.83.10-stable still accepted) — branch will be named release/<tag>"
|
|
required: true
|
|
type: string
|
|
commit_hash:
|
|
description: "Full 40-char commit SHA the branch should point to"
|
|
required: true
|
|
type: string
|
|
workflow_call:
|
|
inputs:
|
|
tag:
|
|
description: "Release tag (e.g. 1.84.0, 1.84.0rc1, 1.84.0.dev42, 1.84.0.post1; legacy v1.83.10-stable still accepted)"
|
|
required: true
|
|
type: string
|
|
commit_hash:
|
|
description: "Full 40-char commit SHA the branch should point to"
|
|
required: true
|
|
type: string
|
|
|
|
permissions: {}
|
|
|
|
jobs:
|
|
create-branch:
|
|
name: Create Release Branch
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
steps:
|
|
- name: Validate inputs
|
|
env:
|
|
TAG: ${{ inputs.tag }}
|
|
COMMIT_HASH: ${{ inputs.commit_hash }}
|
|
run: |
|
|
if ! echo "${COMMIT_HASH}" | grep -qE '^[0-9a-f]{40}$'; then
|
|
echo "::error::commit_hash must be a full 40-character commit SHA"
|
|
exit 1
|
|
fi
|
|
if ! echo "${TAG}" | grep -qE '^v?[0-9]+\.[0-9]+\.[0-9]+'; then
|
|
echo "::error::tag must start with X.Y.Z (optional leading v), e.g. 1.84.0, 1.84.0rc1, 1.84.0.dev42, or v1.83.10-stable"
|
|
exit 1
|
|
fi
|
|
|
|
- name: Create release branch
|
|
env:
|
|
TAG: ${{ inputs.tag }}
|
|
COMMIT_HASH: ${{ inputs.commit_hash }}
|
|
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
|
|
with:
|
|
script: |
|
|
const tag = process.env.TAG;
|
|
const commitHash = process.env.COMMIT_HASH;
|
|
const branchName = `release/${tag}`;
|
|
|
|
await github.rest.git.createRef({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
ref: `refs/heads/${branchName}`,
|
|
sha: commitHash,
|
|
});
|
|
core.info(`Created branch ${branchName} at ${commitHash}`);
|
|
|
|
- name: Create stable line branch
|
|
env:
|
|
TAG: ${{ inputs.tag }}
|
|
COMMIT_HASH: ${{ inputs.commit_hash }}
|
|
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
|
|
with:
|
|
script: |
|
|
const tag = process.env.TAG;
|
|
const commitHash = process.env.COMMIT_HASH;
|
|
|
|
const match = tag.match(/^v?(\d+)\.(\d+)\.0$/);
|
|
if (!match) {
|
|
core.info(`Tag ${tag} is not the X.Y.0 stable opener; skipping stable line branch`);
|
|
return;
|
|
}
|
|
const lineBranch = `stable/${match[1]}.${match[2]}.x`;
|
|
|
|
await github.rest.git.createRef({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
ref: `refs/heads/${lineBranch}`,
|
|
sha: commitHash,
|
|
});
|
|
core.info(`Created branch ${lineBranch} at ${commitHash}`);
|