Verified Commit 2d911357 authored by staltz's avatar staltz

dx: add changelog file automation

parent 412ea245
# Changelog
## 0.18.9-26.beta
* Attempt to fix #128, has-internet false positives ([see details](https://gitlab.com/staltz/manyverse/commit/45e60fc0fc05e27e896c453040751360f194b882)), closes [#128](https://gitlab.com/staltz/manyverse/issues/128)
* Connections tab update has-internet quicker ([see details](https://gitlab.com/staltz/manyverse/commit/acd625cfe1e6f46db4ebcdd908e4b8f3c2fe7510))
* Require Android OS 5.0 or higher ([see details](https://gitlab.com/staltz/manyverse/commit/547d0ddd9cc91de8a11f928a0d2d78b99fa59d74))
## 0.18.9-25b.beta
* Minor improvements and bug fixes
## 0.18.9-25.beta
* Fix bug report email address ([see details](https://gitlab.com/staltz/manyverse/commit/0a0abaf26ddfa98832536f75c07746825b67bc1d))
## 0.18.9-21.beta
* Minor improvements and bug fixes
This diff is collapsed.
......@@ -15,10 +15,13 @@
"build-android-release": "npm run build-android-assets && cd android && ./gradlew assembleRelease && cd ..",
"start": "npm run lib && npm run propagate-replacements && node node_modules/react-native/local-cli/cli.js start",
"test-e2e-android": "./tools/test-e2e-android",
"changelog": "npm run update-repo-changelog && npm run update-dat-latest-readme",
"update-repo-changelog": "./tools/update-repo-changelog.js",
"update-dat-latest-readme": "./tools/update-dat-latest-readme.js",
"update-version": "./tools/update-version.js",
"dat-release": "./tools/dat-release",
"commit-after-release": "./tools/commit-after-release",
"release": "npm run update-version && npm run clean-bundler && npm run clean-android && npm run build-android-release && npm run test-e2e-android && npm run dat-release && npm run commit-after-release"
"commit-release": "./tools/commit-release",
"release": "npm run update-version && npm run clean-bundler && npm run clean-android && npm run build-android-release && npm run test-e2e-android && npm run changelog && npm run commit-release && npm run dat-release"
},
"dependencies": {
"@cycle/isolate": "3.4",
......@@ -87,9 +90,12 @@
"xstream-sample": "1.0.0"
},
"devDependencies": {
"add-stream": "~1.0.0",
"appium": "1.7.2",
"babel-preset-react-native": "4.0.0",
"cheerio": "^1.0.0-rc.2",
"conventional-changelog": "~2.0.3",
"into-stream": "~3.1.0",
"jase": "1.2.0",
"left-pad": "1.3.0",
"patch-package": "^5.1.1",
......
const conventionalChangelog = require('conventional-changelog');
const firstReleaseCommit = 'e78c434e0e79201def84bc3d940ba7b953ddaf96';
const mainTemplate = `{{> header}}
{{#if commitGroups.length}}
{{#each commitGroups}}
{{#each commits}}
{{> commit [email protected]}}
{{/each}}
{{/each}}
{{else}}
* Minor improvements and bug fixes
{{/if}}
{{> footer}}
`;
const headerPartial = `## {{version}}
`;
const commitPartial = `* {{subject}}
{{~!-- commit link --}} {{#if @root.linkReferences~}}
([see details](
{{~#if @root.repository}}
{{~#if @root.host}}
{{[email protected]}}/
{{~/if}}
{{~#if @root.owner}}
{{[email protected]}}/
{{~/if}}
{{[email protected]}}
{{~else}}
{{[email protected]}}
{{~/if}}/
{{[email protected]}}/{{hash}}))
{{~else}}
{{~hash}}
{{~/if}}
{{~!-- commit references --}}
{{~#if references~}}
, closes
{{~#each references}} {{#if @root.linkReferences~}}
[
{{~#if this.owner}}
{{~this.owner}}/
{{~/if}}
{{~this.repository}}#{{this.issue}}](
{{~#if @root.repository}}
{{~#if @root.host}}
{{[email protected]}}/
{{~/if}}
{{~#if this.repository}}
{{~#if this.owner}}
{{~this.owner}}/
{{~/if}}
{{~this.repository}}
{{~else}}
{{~#if @root.owner}}
{{[email protected]}}/
{{~/if}}
{{[email protected]}}
{{~/if}}
{{~else}}
{{[email protected]}}
{{~/if}}/
{{[email protected]}}/{{this.issue}})
{{~else}}
{{~#if this.owner}}
{{~this.owner}}/
{{~/if}}
{{~this.repository}}#{{this.issue}}
{{~/if}}{{/each}}
{{~/if}}
`;
module.exports = function generateChangelog(releaseCount) {
const options = {
releaseCount,
};
const context = {
host: 'https://gitlab.com',
owner: 'staltz',
repository: 'manyverse',
};
const gitRawCommitsOpts = {from: firstReleaseCommit};
const parserOpts = {
headerPattern: /^(\w*): (.*)$/,
headerCorrespondence: [`type`, `subject`],
};
function capitalize(str) {
return str[0].toUpperCase() + str.substr(1);
}
const writerOpts = {
groupBy: 'release',
transform: function(commit, context) {
if (commit.type === 'ux') {
commit.subject = capitalize(commit.subject);
return commit;
} else {
return;
}
},
generateOn: (commit, _commits, context) => {
if (releaseCount > 0 && context.releases >= releaseCount) return false;
if (commit.type === 'release') {
context.releases = context.releases || 0;
context.releases += 1;
return true;
}
return false;
},
mainTemplate,
headerPartial,
commitPartial,
};
return conventionalChangelog(
options,
context,
gitRawCommitsOpts,
parserOpts,
writerOpts,
);
};
#!/usr/bin/env node
const addStream = require('add-stream');
const intoStream = require('into-stream');
const fs = require('fs');
const generateChangelog = require('./generate-changelog');
intoStream(
'# Manyverse\n\n*A social network off the grid*\n\n[Website](https://manyver.se)\n\n',
)
.pipe(addStream(generateChangelog(1)))
.pipe(fs.createWriteStream('../dat-release-latest/README.md'));
#!/usr/bin/env node
const addStream = require('add-stream');
const intoStream = require('into-stream');
const fs = require('fs');
const generateChangelog = require('./generate-changelog');
intoStream('# Changelog\n\n')
.pipe(addStream(generateChangelog(0)))
.pipe(fs.createWriteStream('./CHANGELOG.md'));
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment