1
0
mirror of https://github.com/joaquinjsb/gitea-release-please-action synced 2026-05-13 12:21:38 +02:00

chore: build dist release-please-action (#265)

This commit is contained in:
google-github-actions-bot
2021-03-04 16:12:08 -06:00
committed by GitHub
parent d447fdb632
commit caf6799d1b
9 changed files with 172 additions and 137 deletions

50
dist/commit1.hbs vendored
View File

@@ -1,23 +1,16 @@
* {{header}} *{{#if scope}} **{{scope}}:**
{{~/if}} {{#if subject}}
{{~!-- commit link --}} {{#if @root.linkReferences~}} {{~subject}}
([{{hash}}](
{{~#if @root.repository}}
{{~#if @root.host}}
{{~@root.host}}/
{{~/if}}
{{~#if @root.owner}}
{{~@root.owner}}/
{{~/if}}
{{~@root.repository}}
{{~else}}
{{~@root.repoUrl}}
{{~/if}}/
{{~@root.commit}}/{{hash}}))
{{~else}} {{~else}}
{{~hash}} {{~header}}
{{~/if}} {{~/if}}
{{~!-- commit link --}}{{~#if hash}} {{#if @root.linkReferences~}}
([{{shortHash}}]({{commitUrlFormat}}))
{{~else}}
{{~shortHash}}
{{~/if}}{{~/if}}
{{~!-- commit references --}} {{~!-- commit references --}}
{{~#if references~}} {{~#if references~}}
, closes , closes
@@ -26,31 +19,12 @@
{{~#if this.owner}} {{~#if this.owner}}
{{~this.owner}}/ {{~this.owner}}/
{{~/if}} {{~/if}}
{{~this.repository}}#{{this.issue}}]( {{~this.repository}}{{this.prefix}}{{this.issue}}]({{issueUrlFormat}})
{{~#if @root.repository}}
{{~#if @root.host}}
{{~@root.host}}/
{{~/if}}
{{~#if this.repository}}
{{~#if this.owner}}
{{~this.owner}}/
{{~/if}}
{{~this.repository}}
{{~else}}
{{~#if @root.owner}}
{{~@root.owner}}/
{{~/if}}
{{~@root.repository}}
{{~/if}}
{{~else}}
{{~@root.repoUrl}}
{{~/if}}/
{{~@root.issue}}/{{this.issue}})
{{~else}} {{~else}}
{{~#if this.owner}} {{~#if this.owner}}
{{~this.owner}}/ {{~this.owner}}/
{{~/if}} {{~/if}}
{{~this.repository}}#{{this.issue}} {{~this.repository}}{{this.prefix}}{{this.issue}}
{{~/if}}{{/each}} {{~/if}}{{/each}}
{{~/if}} {{~/if}}

50
dist/commit2.hbs vendored
View File

@@ -1,15 +1,22 @@
*{{#if scope}} **{{scope}}:** * {{header}}
{{~/if}} {{#if subject}}
{{~subject}}
{{~else}}
{{~header}}
{{~/if}}
{{~!-- commit link --}}{{~#if hash}} {{#if @root.linkReferences~}} {{~!-- commit link --}} {{#if @root.linkReferences~}}
([{{shortHash}}]({{commitUrlFormat}})) ([{{hash}}](
{{~#if @root.repository}}
{{~#if @root.host}}
{{~@root.host}}/
{{~/if}}
{{~#if @root.owner}}
{{~@root.owner}}/
{{~/if}}
{{~@root.repository}}
{{~else}}
{{~@root.repoUrl}}
{{~/if}}/
{{~@root.commit}}/{{hash}}))
{{~else}} {{~else}}
{{~shortHash}} {{~hash}}
{{~/if}}{{~/if}} {{~/if}}
{{~!-- commit references --}} {{~!-- commit references --}}
{{~#if references~}} {{~#if references~}}
@@ -19,12 +26,31 @@
{{~#if this.owner}} {{~#if this.owner}}
{{~this.owner}}/ {{~this.owner}}/
{{~/if}} {{~/if}}
{{~this.repository}}{{this.prefix}}{{this.issue}}]({{issueUrlFormat}}) {{~this.repository}}#{{this.issue}}](
{{~#if @root.repository}}
{{~#if @root.host}}
{{~@root.host}}/
{{~/if}}
{{~#if this.repository}}
{{~#if this.owner}}
{{~this.owner}}/
{{~/if}}
{{~this.repository}}
{{~else}}
{{~#if @root.owner}}
{{~@root.owner}}/
{{~/if}}
{{~@root.repository}}
{{~/if}}
{{~else}}
{{~@root.repoUrl}}
{{~/if}}/
{{~@root.issue}}/{{this.issue}})
{{~else}} {{~else}}
{{~#if this.owner}} {{~#if this.owner}}
{{~this.owner}}/ {{~this.owner}}/
{{~/if}} {{~/if}}
{{~this.repository}}{{this.prefix}}{{this.issue}} {{~this.repository}}#{{this.issue}}
{{~/if}}{{/each}} {{~/if}}{{/each}}
{{~/if}} {{~/if}}

10
dist/footer.hbs vendored
View File

@@ -1,10 +0,0 @@
{{#if noteGroups}}
{{#each noteGroups}}
### {{title}}
{{#each notes}}
* {{text}}
{{/each}}
{{/each}}
{{/if}}

10
dist/footer1.hbs vendored
View File

@@ -0,0 +1,10 @@
{{#if noteGroups}}
{{#each noteGroups}}
### {{title}}
{{#each notes}}
* {{text}}
{{/each}}
{{/each}}
{{/if}}

22
dist/header1.hbs vendored
View File

@@ -1,9 +1,13 @@
## {{#if isPatch~}} <small> {{#if isPatch~}}
{{~/if~}} {{version}} ###
{{~#if title}} "{{title}}" {{~else~}}
{{~/if~}} ##
{{~#if date}} ({{date}}) {{~/if}} {{#if @root.linkCompare~}}
{{~/if~}} [{{version}}]({{compareUrlFormat}})
{{~#if isPatch~}} </small> {{~else}}
{{~/if}} {{~version}}
{{~/if}}
{{~#if title}} "{{title}}"
{{~/if}}
{{~#if date}} ({{date}})
{{/if}}

22
dist/header2.hbs vendored
View File

@@ -1,13 +1,9 @@
{{#if isPatch~}} ## {{#if isPatch~}} <small>
### {{~/if~}} {{version}}
{{~else~}} {{~#if title}} "{{title}}"
## {{~/if~}}
{{~/if}} {{#if @root.linkCompare~}} {{~#if date}} ({{date}})
[{{version}}]({{compareUrlFormat}}) {{~/if~}}
{{~else}} {{~#if isPatch~}} </small>
{{~version}} {{~/if}}
{{~/if}}
{{~#if title}} "{{title}}"
{{~/if}}
{{~#if date}} ({{date}})
{{/if}}

105
dist/index.js vendored
View File

@@ -30,11 +30,12 @@ async function main () {
const token = core.getInput('token', { required: true }) const token = core.getInput('token', { required: true })
const fork = getBooleanInput('fork') const fork = getBooleanInput('fork')
const changelogPath = core.getInput('changelog-path') || undefined const changelogPath = core.getInput('changelog-path') || undefined
const changelogTypes = core.getInput('changelog-types') const changelogTypes = core.getInput('changelog-types') || undefined
const changelogSections = changelogTypes && JSON.parse(changelogTypes) const changelogSections = changelogTypes && JSON.parse(changelogTypes)
const command = core.getInput('command') || undefined const command = core.getInput('command') || undefined
const versionFile = core.getInput('version-file') || undefined const versionFile = core.getInput('version-file') || undefined
const defaultBranch = core.getInput('default-branch') || undefined const defaultBranch = core.getInput('default-branch') || undefined
const pullRequestTitlePattern = core.getInput('pull-request-title-pattern') || undefined
// First we check for any merged release PRs (PRs merged with the label // First we check for any merged release PRs (PRs merged with the label
// "autorelease: pending"): // "autorelease: pending"):
@@ -48,7 +49,8 @@ async function main () {
token, token,
changelogPath, changelogPath,
releaseType, releaseType,
defaultBranch defaultBranch,
pullRequestTitlePattern
}) })
if (releaseCreated) { if (releaseCreated) {
@@ -75,7 +77,8 @@ async function main () {
bumpMinorPreMajor, bumpMinorPreMajor,
changelogSections, changelogSections,
versionFile, versionFile,
defaultBranch defaultBranch,
pullRequestTitlePattern
}) })
if (pr) { if (pr) {
@@ -89,6 +92,7 @@ const releasePlease = {
getBooleanInput getBooleanInput
} }
/* c8 ignore next 4 */
if (require.main === require.cache[eval('__filename')]) { if (require.main === require.cache[eval('__filename')]) {
main().catch(err => { main().catch(err => {
core.setFailed(`release-please failed: ${err.message}`) core.setFailed(`release-please failed: ${err.message}`)
@@ -5411,7 +5415,7 @@ const Endpoints = {
} }
}; };
const VERSION = "4.12.0"; const VERSION = "4.12.2";
function endpointsToMethods(octokit, endpointsMap) { function endpointsToMethods(octokit, endpointsMap) {
const newMethods = {}; const newMethods = {};
@@ -5737,7 +5741,7 @@ var pluginRequestLog = __nccwpck_require__(8883);
var pluginPaginateRest = __nccwpck_require__(4193); var pluginPaginateRest = __nccwpck_require__(4193);
var pluginRestEndpointMethods = __nccwpck_require__(3044); var pluginRestEndpointMethods = __nccwpck_require__(3044);
const VERSION = "18.2.0"; const VERSION = "18.2.1";
const Octokit = core.Octokit.plugin(pluginRequestLog.requestLog, pluginRestEndpointMethods.restEndpointMethods, pluginPaginateRest.paginateRest).defaults({ const Octokit = core.Octokit.plugin(pluginRequestLog.requestLog, pluginRestEndpointMethods.restEndpointMethods, pluginPaginateRest.paginateRest).defaults({
userAgent: `octokit-rest.js/${VERSION}` userAgent: `octokit-rest.js/${VERSION}`
@@ -9506,10 +9510,10 @@ module.exports = function (config) {
}) })
return Q.all([ return Q.all([
readFile(__nccwpck_require__.ab + "template2.hbs", 'utf-8'), readFile(__nccwpck_require__.ab + "template1.hbs", 'utf-8'),
readFile(__nccwpck_require__.ab + "header2.hbs", 'utf-8'), readFile(__nccwpck_require__.ab + "header1.hbs", 'utf-8'),
readFile(__nccwpck_require__.ab + "commit2.hbs", 'utf-8'), readFile(__nccwpck_require__.ab + "commit1.hbs", 'utf-8'),
readFile(__nccwpck_require__.ab + "footer1.hbs", 'utf-8') readFile(__nccwpck_require__.ab + "footer.hbs", 'utf-8')
]) ])
.spread((template, header, commit, footer) => { .spread((template, header, commit, footer) => {
const writerOpts = getWriterOpts(config) const writerOpts = getWriterOpts(config)
@@ -9721,10 +9725,10 @@ function conventionalChangelogWriterInit (context, options) {
includeDetails: false, includeDetails: false,
ignoreReverted: true, ignoreReverted: true,
doFlush: true, doFlush: true,
mainTemplate: readFileSync(__nccwpck_require__.ab + "template1.hbs", 'utf-8'), mainTemplate: readFileSync(__nccwpck_require__.ab + "template2.hbs", 'utf-8'),
headerPartial: readFileSync(__nccwpck_require__.ab + "header1.hbs", 'utf-8'), headerPartial: readFileSync(__nccwpck_require__.ab + "header2.hbs", 'utf-8'),
commitPartial: readFileSync(__nccwpck_require__.ab + "commit1.hbs", 'utf-8'), commitPartial: readFileSync(__nccwpck_require__.ab + "commit2.hbs", 'utf-8'),
footerPartial: readFileSync(__nccwpck_require__.ab + "footer.hbs", 'utf-8') footerPartial: readFileSync(__nccwpck_require__.ab + "footer1.hbs", 'utf-8')
}, options) }, options)
if ((!_.isFunction(options.transform) && _.isObject(options.transform)) || _.isUndefined(options.transform)) { if ((!_.isFunction(options.transform) && _.isObject(options.transform)) || _.isUndefined(options.transform)) {
@@ -51104,6 +51108,7 @@ class ReleasePR {
this.gh = options.github; this.gh = options.github;
this.changelogSections = options.changelogSections; this.changelogSections = options.changelogSections;
this.changelogPath = (_b = options.changelogPath) !== null && _b !== void 0 ? _b : this.changelogPath; this.changelogPath = (_b = options.changelogPath) !== null && _b !== void 0 ? _b : this.changelogPath;
this.pullRequestTitlePattern = options.pullRequestTitlePattern;
} }
// A releaser can override this method to automatically detect the // A releaser can override this method to automatically detect the
// packageName from source code (e.g. package.json "name") // packageName from source code (e.g. package.json "name")
@@ -51221,14 +51226,14 @@ class ReleasePR {
async buildPullRequestTitle(version, includePackageName) { async buildPullRequestTitle(version, includePackageName) {
const packageName = await this.getPackageName(); const packageName = await this.getPackageName();
const pullRequestTitle = includePackageName const pullRequestTitle = includePackageName
? pull_request_title_1.PullRequestTitle.ofComponentVersion(packageName.name, version) ? pull_request_title_1.PullRequestTitle.ofComponentVersion(packageName.name, version, this.pullRequestTitlePattern)
: pull_request_title_1.PullRequestTitle.ofVersion(version); : pull_request_title_1.PullRequestTitle.ofVersion(version, this.pullRequestTitlePattern);
return pullRequestTitle.toString(); return pullRequestTitle.toString();
} }
// Override this method to detect the release version from code (if it cannot be // Override this method to detect the release version from code (if it cannot be
// inferred from the release PR head branch) // inferred from the release PR head branch)
detectReleaseVersionFromTitle(title) { detectReleaseVersionFromTitle(title) {
const pullRequestTitle = pull_request_title_1.PullRequestTitle.parse(title); const pullRequestTitle = pull_request_title_1.PullRequestTitle.parse(title, this.pullRequestTitlePattern);
if (pullRequestTitle) { if (pullRequestTitle) {
return pullRequestTitle.getVersion(); return pullRequestTitle.getVersion();
} }
@@ -54716,11 +54721,11 @@ class ModuleVersion {
this.packageName = options.packageName; this.packageName = options.packageName;
} }
updateContent(content) { updateContent(content) {
const oldVersion = content.match(/v[0-9]\.[0-9]+\.[0-9](-\w+)?/); const oldVersion = content.match(/v[0-9]+\.[0-9]+\.[0-9]+(-\w+)?/);
if (oldVersion) { if (oldVersion) {
checkpoint_1.checkpoint(`updating ${this.path} from ${oldVersion} to v${this.version}`, checkpoint_1.CheckpointType.Success); checkpoint_1.checkpoint(`updating ${this.path} from ${oldVersion} to v${this.version}`, checkpoint_1.CheckpointType.Success);
} }
return content.replace(/v[0-9]\.[0-9]+\.[0-9](-\w+)?/g, `v${this.version}`); return content.replace(/v[0-9]+\.[0-9]+\.[0-9]+(-\w+)?/g, `v${this.version}`);
} }
} }
exports.ModuleVersion = ModuleVersion; exports.ModuleVersion = ModuleVersion;
@@ -55106,42 +55111,69 @@ exports.indentCommit = indentCommit;
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.PullRequestTitle = void 0; exports.PullRequestTitle = exports.generateMatchPattern = void 0;
// cannot import from '..' - transpiled code references to RELEASE_PLEASE // cannot import from '..' - transpiled code references to RELEASE_PLEASE
// at the script level are undefined, they are only defined inside function // at the script level are undefined, they are only defined inside function
// or instance methods/properties. // or instance methods/properties.
const DEFAULT_PATTERN = /^chore(\((?<branch>[\w-.]+)\))?: release ?(?<component>[\w-.]*)? v?(?<version>[0-9].*)$/; const DEFAULT_PR_TITLE_PATTERN = 'chore${scope}: release${component} ${version}';
function generateMatchPattern(pullRequestTitlePattern) {
if (pullRequestTitlePattern &&
pullRequestTitlePattern.search(/\$\{scope\}/) === -1)
throw Error("pullRequestTitlePattern miss the part of '${scope}'");
if (pullRequestTitlePattern &&
pullRequestTitlePattern.search(/\$\{component\}/) === -1)
throw Error("pullRequestTitlePattern miss the part of '${component}'");
if (pullRequestTitlePattern &&
pullRequestTitlePattern.search(/\$\{version\}/) === -1)
throw Error("pullRequestTitlePattern miss the part of '${version}'");
return new RegExp(`^${(pullRequestTitlePattern || DEFAULT_PR_TITLE_PATTERN)
.replace('${scope}', '(\\((?<branch>[\\w-.]+)\\))?')
.replace('${component}', ' ?(?<component>[\\w-.]*)?')
.replace('${version}', 'v?(?<version>[0-9].*)')}$`);
}
exports.generateMatchPattern = generateMatchPattern;
class PullRequestTitle { class PullRequestTitle {
constructor(opts) { constructor(opts) {
this.version = opts.version; this.version = opts.version;
this.component = opts.component; this.component = opts.component;
this.targetBranch = opts.targetBranch; this.targetBranch = opts.targetBranch;
this.pullRequestTitlePattern =
opts.pullRequestTitlePattern || DEFAULT_PR_TITLE_PATTERN;
this.matchPattern = generateMatchPattern(this.pullRequestTitlePattern);
} }
static parse(title) { static parse(title, pullRequestTitlePattern) {
const match = title.match(DEFAULT_PATTERN); const matchPattern = generateMatchPattern(pullRequestTitlePattern);
const match = title.match(matchPattern);
if (match === null || match === void 0 ? void 0 : match.groups) { if (match === null || match === void 0 ? void 0 : match.groups) {
return new PullRequestTitle({ return new PullRequestTitle({
version: match.groups['version'], version: match.groups['version'],
component: match.groups['component'], component: match.groups['component'],
targetBranch: match.groups['branch'], targetBranch: match.groups['branch'],
pullRequestTitlePattern: pullRequestTitlePattern,
}); });
} }
return undefined; return undefined;
} }
static create(_title) { static ofComponentVersion(component, version, pullRequestTitlePattern) {
return undefined; return new PullRequestTitle({ version, component, pullRequestTitlePattern });
} }
static ofComponentVersion(component, version) { static ofVersion(version, pullRequestTitlePattern) {
return new PullRequestTitle({ version, component }); return new PullRequestTitle({ version, pullRequestTitlePattern });
} }
static ofVersion(version) { static ofTargetBranchVersion(targetBranch, version, pullRequestTitlePattern) {
return new PullRequestTitle({ version }); return new PullRequestTitle({
version,
targetBranch,
pullRequestTitlePattern,
});
} }
static ofTargetBranchVersion(targetBranch, version) { static ofComponentTargetBranchVersion(component, targetBranch, version, pullRequestTitlePattern) {
return new PullRequestTitle({ version, targetBranch }); return new PullRequestTitle({
} version,
static ofComponentTargetBranchVersion(component, targetBranch, version) { component,
return new PullRequestTitle({ version, component, targetBranch }); targetBranch,
pullRequestTitlePattern,
});
} }
getTargetBranch() { getTargetBranch() {
return this.targetBranch; return this.targetBranch;
@@ -55155,7 +55187,10 @@ class PullRequestTitle {
toString() { toString() {
const scope = this.targetBranch ? `(${this.targetBranch})` : ''; const scope = this.targetBranch ? `(${this.targetBranch})` : '';
const component = this.component ? ` ${this.component}` : ''; const component = this.component ? ` ${this.component}` : '';
return `chore${scope}: release${component} ${this.version}`; return this.pullRequestTitlePattern
.replace('${scope}', scope)
.replace('${component}', component)
.replace('${version}', this.getVersion());
} }
} }
exports.PullRequestTitle = PullRequestTitle; exports.PullRequestTitle = PullRequestTitle;
@@ -66944,7 +66979,7 @@ module.exports = JSON.parse("{\"_args\":[[\"pino@6.11.1\",\"/home/runner/work/re
/***/ ((module) => { /***/ ((module) => {
"use strict"; "use strict";
module.exports = {"i8":"11.0.1"}; module.exports = {"i8":"11.1.0"};
/***/ }), /***/ }),

20
dist/template1.hbs vendored
View File

@@ -1,11 +1,23 @@
{{> header}} {{> header}}
{{#if noteGroups}}
{{#each noteGroups}}
### ⚠ {{title}}
{{#each notes}}
* {{#if commit.scope}}**{{commit.scope}}:** {{/if}}{{text}}
{{/each}}
{{/each}}
{{/if}}
{{#each commitGroups}} {{#each commitGroups}}
{{#if title}}
### {{title}}
{{/if}}
{{#each commits}} {{#each commits}}
{{> commit root=@root}} {{> commit root=@root}}
{{/each}} {{/each}}
{{/each}} {{/each}}
{{> footer}}

20
dist/template2.hbs vendored
View File

@@ -1,23 +1,11 @@
{{> header}} {{> header}}
{{#if noteGroups}}
{{#each noteGroups}}
### ⚠ {{title}}
{{#each notes}}
* {{#if commit.scope}}**{{commit.scope}}:** {{/if}}{{text}}
{{/each}}
{{/each}}
{{/if}}
{{#each commitGroups}} {{#each commitGroups}}
{{#if title}}
### {{title}}
{{/if}}
{{#each commits}} {{#each commits}}
{{> commit root=@root}} {{> commit root=@root}}
{{/each}} {{/each}}
{{/each}} {{/each}}
{{> footer}}