Skip to content

Commit

Permalink
ci: create 2.x release branch as well
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe committed Sep 4, 2023
1 parent 421cab1 commit cdf9b55
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions .github/workflows/changelogensets.yml
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- main
- 2.x

permissions:
pull-requests: write
Expand Down
6 changes: 4 additions & 2 deletions scripts/update-changelog.ts
Expand Up @@ -4,6 +4,8 @@ import { inc } from 'semver'
import { generateMarkDown, loadChangelogConfig } from 'changelogen'
import { determineBumpType, getLatestCommits, loadWorkspace } from './_utils'

const releaseBranch = process.env.BRANCH || 'main'

async function main () {
const workspace = await loadWorkspace(process.cwd())
const config = await loadChangelogConfig(process.cwd(), {
Expand Down Expand Up @@ -39,7 +41,7 @@ async function main () {
const releaseNotes = [
currentPR?.body.replace(/## 👉 Changelog[\s\S]*$/, '') || `> ${newVersion} is the next ${bumpType} release.\n>\n> **Timetable**: to be announced.`,
'## 👉 Changelog',
changelog.replace(/^## v.*?\n/, '').replace('...main', `...v${newVersion}`)
changelog.replace(/^## v.*?\n/, '').replace(`...${releaseBranch}`, `...v${newVersion}`)
].join('\n')

// Create a PR with release notes if none exists
Expand All @@ -52,7 +54,7 @@ async function main () {
body: {
title: `v${newVersion}`,
head: `v${newVersion}`,
base: 'main',
base: releaseBranch,
body: releaseNotes,
draft: true
}
Expand Down

0 comments on commit cdf9b55

Please sign in to comment.