Skip to content

Commit a81ca9b

Browse files
authored
Merge pull request #1737 from nextcloud-libraries/chore/consistent-changelog
docs: add formatting script for consistent changelog and update README
2 parents 7963e69 + 9e37910 commit a81ca9b

3 files changed

Lines changed: 46 additions & 12 deletions

File tree

README.md

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -129,15 +129,24 @@ For testing all components provide `data-testid` attributes as selectors, so the
129129
`row-checkbox` | Checkbox for selecting a row
130130
`row-name` | Name of the row / file
131131

132-
### Releasing a new version
133-
134-
- Pull the latest changes from `main` or `stableX`;
135-
- Checkout a new branch with the tag name (e.g `v4.0.1`): `git checkout -b v<version>`;
136-
- Run `npm version patch --no-git-tag-version` (`npm version minor --no-git-tag-version` if minor). This will return a new version name, make sure it matches what you expect;
137-
- Commit, push and create PR;
138-
- Add the change log content from the 'Changelog' action on Github to `CHANGELOG.md`;
139-
- Commit and push;
140-
- Get your PR reviewed and merged;
141-
- Create [a release on github](https://github.com/nextcloud-libraries/nextcloud-dialogs/releases) with the version as tag (e.g `v4.0.1`) and add the changelog content as description
142-
143-
![image](https://user-images.githubusercontent.com/14975046/124442568-2a952500-dd7d-11eb-82a2-402f9170231a.png)
132+
### 📤 Releasing a new version
133+
134+
- Pull the latest changes from `main` or `stableX`
135+
- Checkout a new branch with the tag name (e.g `v4.0.1`): `git checkout -b v<version>`
136+
- Run `npm version patch --no-git-tag-version` (`npm version minor --no-git-tag-version` if minor).
137+
This will return a new version name, make sure it matches what you expect
138+
- Generate the changelog content from the [release](https://github.com/nextcloud-libraries/nextcloud-dialogs/releases) page.
139+
Create a draft release, select the previous tag, click `generate` then paste the content to the `CHANGELOG.md` file
140+
1. adjust the links to the merged pull requests and authors so that the changelog also works outside of GitHub
141+
by running `npm run prerelease:format-changelog`.
142+
This will apply this regex: `by @([^ ]+) in ((https://github.com/)nextcloud-libraries/nextcloud-dialogs/pull/(\d+))`
143+
Which this as the replacement: `[\#$4]($2) \([$1]($3$1)\)`
144+
2. use the the version as tag AND title (e.g `v4.0.1`)
145+
3. add the changelog content as description
146+
- Commit, push and create PR
147+
- Get your PR reviewed and merged
148+
- Create a milestone with the follow-up version at https://github.com/nextcloud-libraries/nextcloud-dialogs/milestones
149+
- Move all open tickets and PRs to the follow-up
150+
- Close the milestone of the version you release
151+
- Publish the previously drafted release on GitHub
152+
![image](https://user-images.githubusercontent.com/14975046/124442568-2a952500-dd7d-11eb-82a2-402f9170231a.png)

build/format-changelog.mjs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/**
2+
* SPDX-FileCopyrightText: Nextcloud GmbH and Nextcloud contributors
3+
* SPDX-License-Identifier: AGPL-3.0-or-later
4+
*/
5+
import { readFile, writeFile } from 'node:fs/promises'
6+
import { join } from 'node:path'
7+
8+
console.info('🔎 checking format of CHANGELOG.md')
9+
10+
const file = join(import.meta.dirname, '..', 'CHANGELOG.md')
11+
const content = await readFile(file, { encoding: 'utf-8' })
12+
13+
const formatted = content.replaceAll(
14+
/by @([^ ]+) in ((https:\/\/github.com\/)nextcloud-libraries\/nextcloud-dialogs\/pull\/(\d+))/g,
15+
'[\\#$4]($2) \\([$1]($3$1)\\)',
16+
)
17+
18+
if (formatted !== content) {
19+
console.info('✏️ fixing format')
20+
await writeFile(file, formatted)
21+
console.info('🎉 done')
22+
} else {
23+
console.info('✅ no formatting needed - done.')
24+
}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"dev": "vite --mode development build",
3030
"dev:watch": "vite --mode development build --watch",
3131
"doc": "typedoc --tsconfig tsconfig-typedoc.json --highlightLanguages vue --plugin typedoc-plugin-missing-exports --out dist/doc dist/index.d.ts dist/filepicker.d.ts && touch dist/doc/.nojekyll",
32+
"prerelease:format-changelog": "node build/format-changelog.mjs",
3233
"lint": "eslint lib/",
3334
"lint:fix": "eslint --fix lib/",
3435
"stylelint": "stylelint lib/**/*.vue",

0 commit comments

Comments
 (0)