diff --git a/README.md b/README.md index 7e7f2cd60..b2be8845f 100644 --- a/README.md +++ b/README.md @@ -129,15 +129,24 @@ For testing all components provide `data-testid` attributes as selectors, so the `row-checkbox` | Checkbox for selecting a row `row-name` | Name of the row / file -### Releasing a new version - -- Pull the latest changes from `main` or `stableX`; -- Checkout a new branch with the tag name (e.g `v4.0.1`): `git checkout -b v`; -- 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; -- Commit, push and create PR; -- Add the change log content from the 'Changelog' action on Github to `CHANGELOG.md`; -- Commit and push; -- Get your PR reviewed and merged; -- 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 - -![image](https://user-images.githubusercontent.com/14975046/124442568-2a952500-dd7d-11eb-82a2-402f9170231a.png) +### 📤 Releasing a new version + +- Pull the latest changes from `main` or `stableX` +- Checkout a new branch with the tag name (e.g `v4.0.1`): `git checkout -b v` +- 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 +- Generate the changelog content from the [release](https://github.com/nextcloud-libraries/nextcloud-dialogs/releases) page. + Create a draft release, select the previous tag, click `generate` then paste the content to the `CHANGELOG.md` file + 1. adjust the links to the merged pull requests and authors so that the changelog also works outside of GitHub + by running `npm run prerelease:format-changelog`. + This will apply this regex: `by @([^ ]+) in ((https://github.com/)nextcloud-libraries/nextcloud-dialogs/pull/(\d+))` + Which this as the replacement: `[\#$4]($2) \([$1]($3$1)\)` + 2. use the the version as tag AND title (e.g `v4.0.1`) + 3. add the changelog content as description +- Commit, push and create PR +- Get your PR reviewed and merged +- Create a milestone with the follow-up version at https://github.com/nextcloud-libraries/nextcloud-dialogs/milestones +- Move all open tickets and PRs to the follow-up +- Close the milestone of the version you release +- Publish the previously drafted release on GitHub + ![image](https://user-images.githubusercontent.com/14975046/124442568-2a952500-dd7d-11eb-82a2-402f9170231a.png) diff --git a/build/format-changelog.mjs b/build/format-changelog.mjs new file mode 100644 index 000000000..bd81970ad --- /dev/null +++ b/build/format-changelog.mjs @@ -0,0 +1,24 @@ +/** + * SPDX-FileCopyrightText: Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +import { readFile, writeFile } from 'node:fs/promises' +import { join } from 'node:path' + +console.info('🔎 checking format of CHANGELOG.md') + +const file = join(import.meta.dirname, '..', 'CHANGELOG.md') +const content = await readFile(file, { encoding: 'utf-8' }) + +const formatted = content.replaceAll( + /by @([^ ]+) in ((https:\/\/github.com\/)nextcloud-libraries\/nextcloud-dialogs\/pull\/(\d+))/g, + '[\\#$4]($2) \\([$1]($3$1)\\)', +) + +if (formatted !== content) { + console.info('✏️ fixing format') + await writeFile(file, formatted) + console.info('🎉 done') +} else { + console.info('✅ no formatting needed - done.') +} diff --git a/package.json b/package.json index 2c7551a9b..0a9799fff 100644 --- a/package.json +++ b/package.json @@ -29,6 +29,7 @@ "dev": "vite --mode development build", "dev:watch": "vite --mode development build --watch", "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", + "prerelease:format-changelog": "node build/format-changelog.mjs", "lint": "eslint lib/", "lint:fix": "eslint --fix lib/", "stylelint": "stylelint lib/**/*.vue",