Fix beta release branch naming to use release-{version} format

Co-authored-by: louislam <1336778+louislam@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2026-01-13 09:01:23 +00:00
parent fe6cfa998a
commit c081e403fb
3 changed files with 19 additions and 13 deletions

View File

@ -42,9 +42,12 @@ jobs:
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
# Delete local release branch if it exists
git branch -D release || true
git checkout -b release
# Delete remote branch if it exists
git push origin --delete release-${{ inputs.version }} || true
# Delete local branch if it exists
git branch -D release-${{ inputs.version }} || true
# Create new branch from master
git checkout -b release-${{ inputs.version }}
- name: Install dependencies
run: npm clean-install --no-fund

View File

@ -18,6 +18,7 @@ const repoNames = getRepoNames();
const version = process.env.RELEASE_BETA_VERSION;
const dryRun = process.env.DRY_RUN === "true";
const previousVersion = process.env.RELEASE_PREVIOUS_VERSION;
const branchName = `release-${version}`;
if (dryRun) {
console.log("Dry run mode enabled. No images will be pushed.");
@ -25,8 +26,8 @@ if (dryRun) {
console.log("RELEASE_BETA_VERSION:", version);
// Check if the current branch is "release"
checkReleaseBranch();
// Check if the current branch is "release-{version}"
checkReleaseBranch(branchName);
// Check if the version is a valid semver
checkVersionFormat(version);
@ -49,7 +50,7 @@ await checkTagExists(repoNames, version);
execSync("node ./extra/beta/update-version.js");
// Create Pull Request
await createReleasePR(version, previousVersion, dryRun);
await createReleasePR(version, previousVersion, dryRun, branchName);
// Build frontend dist
buildDist();

View File

@ -247,14 +247,15 @@ export function execSync(cmd) {
}
/**
* Check if the current branch is "release"
* Check if the current branch matches the expected release branch pattern
* @param {string} expectedBranch Expected branch name (can be "release" or "release-{version}")
* @returns {void}
*/
export function checkReleaseBranch() {
export function checkReleaseBranch(expectedBranch = "release") {
const res = childProcess.spawnSync("git", ["rev-parse", "--abbrev-ref", "HEAD"]);
const branch = res.stdout.toString().trim();
if (branch !== "release") {
console.error(`Current branch is ${branch}, please switch to "release" branch`);
if (branch !== expectedBranch) {
console.error(`Current branch is ${branch}, please switch to "${expectedBranch}" branch`);
process.exit(1);
}
}
@ -302,9 +303,10 @@ export async function createDistTarGz() {
* @param {string} version Version
* @param {string} previousVersion Previous version tag
* @param {boolean} dryRun Still create the PR, but add "[DRY RUN]" to the title
* @param {string} branchName The branch name to use for the PR head (defaults to "release")
* @returns {Promise<void>}
*/
export async function createReleasePR(version, previousVersion, dryRun) {
export async function createReleasePR(version, previousVersion, dryRun, branchName = "release") {
const changelog = await generateChangelog(previousVersion);
const title = dryRun ? `chore: update to ${version} (dry run)` : `chore: update to ${version}`;
@ -317,7 +319,7 @@ This PR prepares the release for version ${version}.
- [ ] Create a new release on GitHub with the tag \`${version}\`.
- [ ] Ask any LLM to categorize the changelog into sections.
- [ ] Place the changelog in the release note.
- [ ] Download and upload the \`dist.tar.gz\` artifact to the release.
- [ ] Download the \`dist.tar.gz\` artifact from the [workflow run](https://github.com/louislam/uptime-kuma/actions/workflows/beta-release.yml) and upload it to the release.
- [ ] (Beta only) Set prerelease
- [ ] Publish the release note on GitHub.
@ -332,7 +334,7 @@ The \`dist.tar.gz\` archive will be available as an artifact in the workflow run
`;
// Create the PR using gh CLI
const args = ["pr", "create", "--title", title, "--body", body, "--base", "master", "--head", "release", "--draft"];
const args = ["pr", "create", "--title", title, "--body", body, "--base", "master", "--head", branchName, "--draft"];
console.log(`Creating draft PR: ${title}`);