diff --git a/.github/workflows/test_build_deploy.yml b/.github/workflows/test_build_deploy.yml index 233aaeee1b..77be5b5de8 100644 --- a/.github/workflows/test_build_deploy.yml +++ b/.github/workflows/test_build_deploy.yml @@ -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 diff --git a/bin/changelog.js b/bin/changelog.js index 43c9ab6943..c9ab537c7a 100644 --- a/bin/changelog.js +++ b/bin/changelog.js @@ -20,12 +20,18 @@ 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. + * 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]; @@ -36,8 +42,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'); } diff --git a/package.json b/package.json index 44e7407356..6e679b70e1 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/yarn.lock b/yarn.lock index 070b9ec4a1..6c87c3eaa2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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" @@ -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== @@ -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= +prepend-file@2.0.0: + 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" @@ -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"