Skip to content
This repository has been archived by the owner on Aug 15, 2024. It is now read-only.

Commit

Permalink
chore: build dist release-please-action (#489)
Browse files Browse the repository at this point in the history
  • Loading branch information
google-github-actions-bot authored May 18, 2022
1 parent fe3f4f7 commit e3b39f9
Showing 1 changed file with 53 additions and 21 deletions.
74 changes: 53 additions & 21 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -81022,9 +81022,9 @@ class Manifest {
github,
...config,
});
const component = await strategy.getComponent();
const component = await strategy.getBranchComponent();
const releasedVersions = {};
const latestVersion = await latestReleaseVersion(github, targetBranch, version => isPublishedVersion(strategy, version), config.includeComponentInTag ? component : '', config.pullRequestTitlePattern);
const latestVersion = await latestReleaseVersion(github, targetBranch, version => isPublishedVersion(strategy, version), component, config.pullRequestTitlePattern);
if (latestVersion) {
releasedVersions[path] = latestVersion;
}
Expand Down Expand Up @@ -81481,35 +81481,45 @@ class Manifest {
}
}
async createReleasesForPullRequest(releases, pullRequest) {
// create the release
const promises = [];
for (const release of releases) {
promises.push(this.createRelease(release));
}
logger_1.logger.info(`Creating ${releases.length} releases for pull #${pullRequest.number}`);
const duplicateReleases = [];
const githubReleases = [];
for (const promise of promises) {
for (const release of releases) {
try {
githubReleases.push(await promise);
githubReleases.push(await this.createRelease(release));
}
catch (err) {
if (err instanceof errors_1.DuplicateReleaseError) {
logger_1.logger.warn(`Duplicate release tag: ${err.tag}`);
logger_1.logger.warn(`Duplicate release tag: ${release.tag.toString()}`);
duplicateReleases.push(err);
}
else {
throw err;
}
}
}
if (duplicateReleases.length > 0 && githubReleases.length === 0) {
throw duplicateReleases[0];
if (duplicateReleases.length > 0) {
if (duplicateReleases.length + githubReleases.length ===
releases.length) {
// we've either tagged all releases or they were duplicates:
// adjust tags on pullRequest
await Promise.all([
this.github.removeIssueLabels(this.labels, pullRequest.number),
this.github.addIssueLabels(this.releaseLabels, pullRequest.number),
]);
}
if (githubReleases.length === 0) {
// If all releases were duplicate, throw a duplicate error
throw duplicateReleases[0];
}
}
else {
// adjust tags on pullRequest
await Promise.all([
this.github.removeIssueLabels(this.labels, pullRequest.number),
this.github.addIssueLabels(this.releaseLabels, pullRequest.number),
]);
}
// adjust tags on pullRequest
await Promise.all([
this.github.removeIssueLabels(this.labels, pullRequest.number),
this.github.addIssueLabels(this.releaseLabels, pullRequest.number),
]);
return githubReleases;
}
async createRelease(release) {
Expand Down Expand Up @@ -87680,6 +87690,12 @@ class ComponentBranchName extends BranchName {
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.CommitSplit = void 0;
const manifest_1 = __nccwpck_require__(31999);
/**
* Helper class for splitting commits by component path. If `packagePaths`
* is configured, then only consider the provided paths. If `includeEmpty`
* is configured, then commits without any touched files apply to all
* configured component paths.
*/
class CommitSplit {
constructor(opts) {
opts = opts || {};
Expand Down Expand Up @@ -87715,7 +87731,15 @@ class CommitSplit {
this.packagePaths = paths;
}
}
// split(commits: Commit[]): Record<string, Commit[]>
/**
* Split commits by component path. If the commit splitter is configured
* with a set of tracked package paths, then only consider paths for
* configured components. If `includeEmpty` is configured, then a commit
* that does not touch any files will be applied to all components'
* commits.
* @param {Commit[]} commits The commits to split
* @returns {Record<string, Commit[]>} Commits indexed by component path
*/
split(commits) {
const splitCommits = {};
commits.forEach(commit => {
Expand Down Expand Up @@ -87750,8 +87774,16 @@ class CommitSplit {
splitCommits[pkgName].push(commit);
}
if (commit.files.length === 0 && this.includeEmpty) {
for (const pkgName in splitCommits) {
splitCommits[pkgName].push(commit);
if (this.packagePaths) {
for (const pkgName of this.packagePaths) {
splitCommits[pkgName] = splitCommits[pkgName] || [];
splitCommits[pkgName].push(commit);
}
}
else {
for (const pkgName in splitCommits) {
splitCommits[pkgName].push(commit);
}
}
}
});
Expand Down Expand Up @@ -113542,7 +113574,7 @@ module.exports = {};
/***/ ((module) => {

"use strict";
module.exports = {"i8":"13.16.3"};
module.exports = {"i8":"13.16.4"};

/***/ }),

Expand Down

0 comments on commit e3b39f9

Please sign in to comment.