Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Generate continuous changelog #2307

Open
wants to merge 2 commits into
base: staging
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test_build_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,6 @@ jobs:
with:
tag_name: ${{env.TAG}}
release_name: ${{env.TAG}}
body_path: ./CHANGELOG.md
body_path: ./CHANGELOG_LATEST.md
draft: true
prerelease: false
13 changes: 10 additions & 3 deletions bin/changelog.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,17 @@
const fs = require('fs');
const Changelog = require('generate-changelog');
const path = require('path');
const prependFile = require('prepend-file');
const pkg = require('../package.json');
const simpleGit = require('simple-git')();

const options = {'--list': null};
simpleGit.tags(options, async (error, tags) => {
const outputPath = path.join(__dirname, '../CHANGELOG.md');
/** This contains just the changelog of the last release.
Yserz marked this conversation as resolved.
Show resolved Hide resolved
* It is used for automatic GitHub release tags.
*/
const latestChangelogPath = path.join(__dirname, '../CHANGELOG_LATEST.md');
const changelogPath = path.join(__dirname, '../CHANGELOG.md');

const latestTags = tags.all.reverse();
const previousReleaseTag = latestTags[0];
Expand All @@ -36,8 +41,10 @@ simpleGit.tags(options, async (error, tags) => {
tag: `${previousReleaseTag}...main`,
});
console.info(`Changelog size: ${changelog.length}`);
fs.writeFileSync(outputPath, changelog, 'utf8');
console.info(`Wrote file to: ${outputPath}`);
fs.writeFileSync(latestChangelogPath, changelog, 'utf8');

await prependFile(changelogPath, changelog);
console.info(`Wrote file to: ${changelogPath} and ${latestChangelogPath}`);
} else {
console.error('Unable to find previous release tag');
}
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
"lint-staged": "10.5.3",
"os-browserify": "0.3.0",
"path-browserify": "1.0.1",
"prepend-file": "2.0.0",
"prettier": "2.2.1",
"react-hot-loader": "4.13.0",
"simple-git": "2.29.0",
Expand Down
28 changes: 26 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3270,7 +3270,7 @@ dom-helpers@^5.0.1:
integrity sha512-Ru5o9+V8CpunKnz5LGgWXkmrH/20cGKwcHwS4m73zIvs54CN9epEmT/HLqFJW3kXpakAFkEdzgy1hzlJe3E4OQ==
dependencies:
"@babel/runtime" "^7.8.7"
csstype "^2.6.7"
csstype "^3.0.2"

dom-serializer@0:
version "0.2.2"
Expand Down Expand Up @@ -4526,7 +4526,7 @@ globby@^11.0.1:
merge2 "^1.3.0"
slash "^3.0.0"

graceful-fs@^4.0.0, graceful-fs@^4.1.11, graceful-fs@^4.1.2, graceful-fs@^4.1.4, graceful-fs@^4.1.6, graceful-fs@^4.2.0, graceful-fs@^4.2.4:
graceful-fs@^4.0.0, graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.4, graceful-fs@^4.1.6, graceful-fs@^4.2.0, graceful-fs@^4.2.4:
version "4.2.4"
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.4.tgz#2256bde14d3632958c465ebc96dc467ca07a29fb"
integrity sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==
Expand Down Expand Up @@ -6850,6 +6850,14 @@ prelude-ls@~1.1.2:
resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54"
integrity sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=

[email protected]:
version "2.0.0"
resolved "https://registry.yarnpkg.com/prepend-file/-/prepend-file-2.0.0.tgz#2d3256376a64ca3b5640153890a89cadbebaf1a9"
integrity sha512-U6on3jv5hQ+CNEO7gFn00PUlm3F/oXIQTMg6jpeQTQHLYSZl/Cxb4NpH44FA0By+maPXpfUaqmCoPUTu/Z3/8g==
dependencies:
path-exists "^4.0.0"
temp-write "^4.0.0"

prettier-linter-helpers@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz#d23d41fe1375646de2d0104d3454a3008802cf7b"
Expand Down Expand Up @@ -8168,6 +8176,22 @@ tapable@^2.0.0, tapable@^2.1.1:
resolved "https://registry.yarnpkg.com/tapable/-/tapable-2.2.0.tgz#5c373d281d9c672848213d0e037d1c4165ab426b"
integrity sha512-FBk4IesMV1rBxX2tfiK8RAmogtWn53puLOQlvO8XuwlgxcYbP4mVPS9Ph4aeamSyyVjOl24aYWAuc8U5kCVwMw==

temp-dir@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/temp-dir/-/temp-dir-1.0.0.tgz#0a7c0ea26d3a39afa7e0ebea9c1fc0bc4daa011d"
integrity sha1-CnwOom06Oa+n4OvqnB/AvE2qAR0=

temp-write@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/temp-write/-/temp-write-4.0.0.tgz#cd2e0825fc826ae72d201dc26eef3bf7e6fc9320"
integrity sha512-HIeWmj77uOOHb0QX7siN3OtwV3CTntquin6TNVg6SHOqCP3hYKmox90eeFOGaY1MqJ9WYDDjkyZrW6qS5AWpbw==
dependencies:
graceful-fs "^4.1.15"
is-stream "^2.0.0"
make-dir "^3.0.0"
temp-dir "^1.0.0"
uuid "^3.3.2"

terminal-link@^2.0.0:
version "2.1.1"
resolved "https://registry.yarnpkg.com/terminal-link/-/terminal-link-2.1.1.tgz#14a64a27ab3c0df933ea546fba55f2d078edc994"
Expand Down