ci: create 2.x release branch as well

This commit is contained in:
Daniel Roe 2023-09-04 09:16:51 +01:00
parent 421cab1adf
commit cdf9b5547e
2 changed files with 5 additions and 2 deletions

View File

@ -4,6 +4,7 @@ on:
push: push:
branches: branches:
- main - main
- 2.x
permissions: permissions:
pull-requests: write pull-requests: write

View File

@ -4,6 +4,8 @@ import { inc } from 'semver'
import { generateMarkDown, loadChangelogConfig } from 'changelogen' import { generateMarkDown, loadChangelogConfig } from 'changelogen'
import { determineBumpType, getLatestCommits, loadWorkspace } from './_utils' import { determineBumpType, getLatestCommits, loadWorkspace } from './_utils'
const releaseBranch = process.env.BRANCH || 'main'
async function main () { async function main () {
const workspace = await loadWorkspace(process.cwd()) const workspace = await loadWorkspace(process.cwd())
const config = await loadChangelogConfig(process.cwd(), { const config = await loadChangelogConfig(process.cwd(), {
@ -39,7 +41,7 @@ async function main () {
const releaseNotes = [ const releaseNotes = [
currentPR?.body.replace(/## 👉 Changelog[\s\S]*$/, '') || `> ${newVersion} is the next ${bumpType} release.\n>\n> **Timetable**: to be announced.`, currentPR?.body.replace(/## 👉 Changelog[\s\S]*$/, '') || `> ${newVersion} is the next ${bumpType} release.\n>\n> **Timetable**: to be announced.`,
'## 👉 Changelog', '## 👉 Changelog',
changelog.replace(/^## v.*?\n/, '').replace('...main', `...v${newVersion}`) changelog.replace(/^## v.*?\n/, '').replace(`...${releaseBranch}`, `...v${newVersion}`)
].join('\n') ].join('\n')
// Create a PR with release notes if none exists // Create a PR with release notes if none exists
@ -52,7 +54,7 @@ async function main () {
body: { body: {
title: `v${newVersion}`, title: `v${newVersion}`,
head: `v${newVersion}`, head: `v${newVersion}`,
base: 'main', base: releaseBranch,
body: releaseNotes, body: releaseNotes,
draft: true draft: true
} }