mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-25 03:44:29 +03:00
✨ releases.create accepts optional content array
no issue e.g. content: ['line\n']
This commit is contained in:
parent
0b49f17250
commit
5247eb95f5
@ -79,7 +79,8 @@ releaseUtils
|
|||||||
gistUrl: String [optional],
|
gistUrl: String [optional],
|
||||||
preRelease: Boolean [optional, Default: false],
|
preRelease: Boolean [optional, Default: false],
|
||||||
draft: Boolean [optional, Default: true],
|
draft: Boolean [optional, Default: true],
|
||||||
filterEmojiCommits: Boolean [optional, Default: true]
|
filterEmojiCommits: Boolean [optional, Default: true],
|
||||||
|
content: Array [optional]
|
||||||
});
|
});
|
||||||
|
|
||||||
releaseUtils
|
releaseUtils
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const os = require('os');
|
const os = require('os');
|
||||||
|
const _ = require('lodash');
|
||||||
const Promise = require('bluebird');
|
const Promise = require('bluebird');
|
||||||
const requestPromise = require('request-promise');
|
const requestPromise = require('request-promise');
|
||||||
const request = require('request');
|
const request = require('request');
|
||||||
@ -34,19 +35,28 @@ module.exports.create = (options = {}) => {
|
|||||||
filterEmojiCommits = options.filterEmojiCommits;
|
filterEmojiCommits = options.filterEmojiCommits;
|
||||||
}
|
}
|
||||||
|
|
||||||
let content = fs.readFileSync(options.changelogPath).toString('utf8').split(os.EOL);
|
let body = [];
|
||||||
|
let changelog = fs.readFileSync(options.changelogPath).toString('utf8').split(os.EOL);
|
||||||
|
|
||||||
if (filterEmojiCommits) {
|
// @NOTE: optional array of string lines, which we pre-pend
|
||||||
content = localUtils.filterEmojiCommits(content);
|
if (options.hasOwnProperty('content') && _.isArray(options.content)) {
|
||||||
|
body = body.concat(options.content);
|
||||||
}
|
}
|
||||||
|
|
||||||
content = content.filter((item) => {
|
if (filterEmojiCommits) {
|
||||||
|
changelog = localUtils.filterEmojiCommits(changelog);
|
||||||
|
}
|
||||||
|
|
||||||
|
body = body.concat(changelog);
|
||||||
|
|
||||||
|
// CASE: clean before upload
|
||||||
|
body = body.filter((item) => {
|
||||||
return item !== undefined;
|
return item !== undefined;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (options.gistUrl) {
|
if (options.gistUrl) {
|
||||||
content.push('');
|
body.push('');
|
||||||
content.push('You can see the [full change log](' + options.gistUrl + ') for the details of every change included in this release.');
|
body.push('You can see the [full change log](' + options.gistUrl + ') for the details of every change included in this release.');
|
||||||
}
|
}
|
||||||
|
|
||||||
const auth = 'Basic ' + new Buffer(options.github.username + ':' + options.github.token).toString('base64');
|
const auth = 'Basic ' + new Buffer(options.github.username + ':' + options.github.token).toString('base64');
|
||||||
@ -62,7 +72,7 @@ module.exports.create = (options = {}) => {
|
|||||||
tag_name: options.tagName,
|
tag_name: options.tagName,
|
||||||
target_commitish: 'master',
|
target_commitish: 'master',
|
||||||
name: options.releaseName,
|
name: options.releaseName,
|
||||||
body: content.join(os.EOL),
|
body: body.join(os.EOL),
|
||||||
draft: draft,
|
draft: draft,
|
||||||
prerelease: prerelease
|
prerelease: prerelease
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user