mirror of
https://github.com/joaquinjsb/gitea-release-please-action
synced 2026-05-09 04:21:13 +02:00
chore: build dist release-please-action (#484)
This commit is contained in:
committed by
GitHub
parent
fdea77eccf
commit
505fed925d
115
dist/index.js
vendored
115
dist/index.js
vendored
@@ -81191,6 +81191,7 @@ class Manifest {
|
||||
github: this.github,
|
||||
targetBranch: this.targetBranch,
|
||||
repositoryConfig: this.repositoryConfig,
|
||||
manifestPath: this.manifestPath,
|
||||
}));
|
||||
let strategies = strategiesByPath;
|
||||
for (const plugin of plugins) {
|
||||
@@ -81592,6 +81593,7 @@ function extractReleaserConfig(config) {
|
||||
changelogType: config['changelog-type'],
|
||||
pullRequestTitlePattern: config['pull-request-title-pattern'],
|
||||
tagSeparator: config['tag-separator'],
|
||||
separatePullRequests: config['separate-pull-requests'],
|
||||
};
|
||||
}
|
||||
/**
|
||||
@@ -81605,7 +81607,7 @@ function extractReleaserConfig(config) {
|
||||
* @param {string} releaseAs Optional. Override release-as and use the given version
|
||||
*/
|
||||
async function parseConfig(github, configFile, branch, onlyPath, releaseAs) {
|
||||
const config = await github.getFileJson(configFile, branch);
|
||||
const config = await fetchManifestConfig(github, configFile, branch);
|
||||
const defaultConfig = extractReleaserConfig(config);
|
||||
const repositoryConfig = {};
|
||||
for (const path in config.packages) {
|
||||
@@ -81635,21 +81637,61 @@ async function parseConfig(github, configFile, branch, onlyPath, releaseAs) {
|
||||
};
|
||||
return { config: repositoryConfig, options: manifestOptions };
|
||||
}
|
||||
/**
|
||||
* Helper to fetch manifest config
|
||||
*
|
||||
* @param {GitHub} github
|
||||
* @param {string} configFile
|
||||
* @param {string} branch
|
||||
* @returns {ManifestConfig}
|
||||
* @throws {ConfigurationError} if missing the manifest config file
|
||||
*/
|
||||
async function fetchManifestConfig(github, configFile, branch) {
|
||||
try {
|
||||
return await github.getFileJson(configFile, branch);
|
||||
}
|
||||
catch (e) {
|
||||
if (e instanceof errors_1.FileNotFoundError) {
|
||||
throw new errors_1.ConfigurationError(`Missing required manifest config: ${configFile}`, 'base', `${github.repository.owner}/${github.repository.repo}`);
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Helper to parse the manifest versions file.
|
||||
*
|
||||
* @param {GitHub} github GitHub client
|
||||
* @param {string} manifestFile Path in the repository to the versions file
|
||||
* @param {string} branch Branch to fetch the versions file from
|
||||
* @returns {Record<string, string>}
|
||||
*/
|
||||
async function parseReleasedVersions(github, manifestFile, branch) {
|
||||
const manifestJson = await github.getFileJson(manifestFile, branch);
|
||||
const manifestJson = await fetchReleasedVersions(github, manifestFile, branch);
|
||||
const releasedVersions = {};
|
||||
for (const path in manifestJson) {
|
||||
releasedVersions[path] = version_1.Version.parse(manifestJson[path]);
|
||||
}
|
||||
return releasedVersions;
|
||||
}
|
||||
/**
|
||||
* Helper to fetch manifest config
|
||||
*
|
||||
* @param {GitHub} github
|
||||
* @param {string} manifestFile
|
||||
* @param {string} branch
|
||||
* @throws {ConfigurationError} if missing the manifest config file
|
||||
*/
|
||||
async function fetchReleasedVersions(github, manifestFile, branch) {
|
||||
try {
|
||||
return await github.getFileJson(manifestFile, branch);
|
||||
}
|
||||
catch (e) {
|
||||
if (e instanceof errors_1.FileNotFoundError) {
|
||||
throw new errors_1.ConfigurationError(`Missing required manifest versions: ${manifestFile}`, 'base', `${github.repository.owner}/${github.repository.repo}`);
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
function isPublishedVersion(strategy, version) {
|
||||
return strategy.isPublishedVersion
|
||||
? strategy.isPublishedVersion(version)
|
||||
@@ -81750,7 +81792,7 @@ async function latestReleaseVersion(github, targetBranch, releaseFilter, prefix,
|
||||
return candidateTagVersion.sort((a, b) => b.compare(a))[0];
|
||||
}
|
||||
function mergeReleaserConfig(defaultConfig, pathConfig) {
|
||||
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
||||
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
|
||||
return {
|
||||
releaseType: (_b = (_a = pathConfig.releaseType) !== null && _a !== void 0 ? _a : defaultConfig.releaseType) !== null && _b !== void 0 ? _b : 'node',
|
||||
bumpMinorPreMajor: (_c = pathConfig.bumpMinorPreMajor) !== null && _c !== void 0 ? _c : defaultConfig.bumpMinorPreMajor,
|
||||
@@ -81770,6 +81812,7 @@ function mergeReleaserConfig(defaultConfig, pathConfig) {
|
||||
includeVInTag: (_s = pathConfig.includeVInTag) !== null && _s !== void 0 ? _s : defaultConfig.includeVInTag,
|
||||
tagSeparator: (_t = pathConfig.tagSeparator) !== null && _t !== void 0 ? _t : defaultConfig.tagSeparator,
|
||||
pullRequestTitlePattern: (_u = pathConfig.pullRequestTitlePattern) !== null && _u !== void 0 ? _u : defaultConfig.pullRequestTitlePattern,
|
||||
separatePullRequests: (_v = pathConfig.separatePullRequests) !== null && _v !== void 0 ? _v : defaultConfig.separatePullRequests,
|
||||
};
|
||||
}
|
||||
/**
|
||||
@@ -81895,12 +81938,6 @@ const cargo_lock_1 = __nccwpck_require__(68875);
|
||||
* into a single rust package.
|
||||
*/
|
||||
class CargoWorkspace extends workspace_1.WorkspacePlugin {
|
||||
constructor(github, targetBranch, repositoryConfig, options = {}) {
|
||||
super(github, targetBranch, repositoryConfig, {
|
||||
...options,
|
||||
updateAllPackages: true,
|
||||
});
|
||||
}
|
||||
async buildAllPackages(candidates) {
|
||||
var _a, _b, _c, _d;
|
||||
const cargoManifestContent = await this.github.getFileContentsOnBranch('Cargo.toml', this.targetBranch);
|
||||
@@ -82079,6 +82116,9 @@ class CargoWorkspace extends workspace_1.WorkspacePlugin {
|
||||
packageNameFromPackage(pkg) {
|
||||
return pkg.name;
|
||||
}
|
||||
pathFromPackage(pkg) {
|
||||
return pkg.path;
|
||||
}
|
||||
}
|
||||
exports.CargoWorkspace = CargoWorkspace;
|
||||
function getChangelogDepsNotes(originalManifest, updatedManifest) {
|
||||
@@ -82356,11 +82396,20 @@ class Merge extends plugin_1.ManifestPlugin {
|
||||
return candidates;
|
||||
}
|
||||
logger_1.logger.info(`Merging ${candidates.length} pull requests`);
|
||||
const [inScopeCandidates, outOfScopeCandidates] = candidates.reduce((collection, candidate) => {
|
||||
if (candidate.config.separatePullRequests) {
|
||||
collection[1].push(candidate);
|
||||
}
|
||||
else {
|
||||
collection[0].push(candidate);
|
||||
}
|
||||
return collection;
|
||||
}, [[], []]);
|
||||
const releaseData = [];
|
||||
const labels = new Set();
|
||||
let rawUpdates = [];
|
||||
let rootRelease = null;
|
||||
for (const candidate of candidates) {
|
||||
for (const candidate of inScopeCandidates) {
|
||||
const pullRequest = candidate.pullRequest;
|
||||
rawUpdates = rawUpdates.concat(...pullRequest.updates);
|
||||
for (const label of pullRequest.labels) {
|
||||
@@ -82390,6 +82439,7 @@ class Merge extends plugin_1.ManifestPlugin {
|
||||
releaseType,
|
||||
},
|
||||
},
|
||||
...outOfScopeCandidates,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -82615,7 +82665,7 @@ class NodeWorkspace extends workspace_1.WorkspacePlugin {
|
||||
return candidates;
|
||||
}
|
||||
async buildGraph(allPackages) {
|
||||
var _a, _b, _c, _d;
|
||||
var _a, _b, _c;
|
||||
const graph = new Map();
|
||||
const workspacePackageNames = new Set(allPackages.map(packageJson => packageJson.name));
|
||||
for (const packageJson of allPackages) {
|
||||
@@ -82623,7 +82673,6 @@ class NodeWorkspace extends workspace_1.WorkspacePlugin {
|
||||
...((_a = packageJson.dependencies) !== null && _a !== void 0 ? _a : {}),
|
||||
...((_b = packageJson.devDependencies) !== null && _b !== void 0 ? _b : {}),
|
||||
...((_c = packageJson.optionalDependencies) !== null && _c !== void 0 ? _c : {}),
|
||||
...((_d = packageJson.peerDependencies) !== null && _d !== void 0 ? _d : {}),
|
||||
});
|
||||
const workspaceDeps = allDeps.filter(dep => workspacePackageNames.has(dep));
|
||||
graph.set(packageJson.name, {
|
||||
@@ -82640,6 +82689,9 @@ class NodeWorkspace extends workspace_1.WorkspacePlugin {
|
||||
packageNameFromPackage(pkg) {
|
||||
return pkg.name;
|
||||
}
|
||||
pathFromPackage(pkg) {
|
||||
return pkg.location;
|
||||
}
|
||||
}
|
||||
exports.NodeWorkspace = NodeWorkspace;
|
||||
function getChangelogDepsNotes(original, updated) {
|
||||
@@ -82742,8 +82794,10 @@ function addPath(path, file) {
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.WorkspacePlugin = void 0;
|
||||
const plugin_1 = __nccwpck_require__(31651);
|
||||
const manifest_1 = __nccwpck_require__(31999);
|
||||
const logger_1 = __nccwpck_require__(68809);
|
||||
const merge_1 = __nccwpck_require__(90514);
|
||||
const release_please_manifest_1 = __nccwpck_require__(9817);
|
||||
/**
|
||||
* The plugin generalizes the logic for handling a workspace and
|
||||
* will bump dependencies of managed packages if those dependencies
|
||||
@@ -82757,9 +82811,10 @@ const merge_1 = __nccwpck_require__(90514);
|
||||
*/
|
||||
class WorkspacePlugin extends plugin_1.ManifestPlugin {
|
||||
constructor(github, targetBranch, repositoryConfig, options = {}) {
|
||||
var _a;
|
||||
var _a, _b;
|
||||
super(github, targetBranch, repositoryConfig);
|
||||
this.updateAllPackages = (_a = options.updateAllPackages) !== null && _a !== void 0 ? _a : false;
|
||||
this.manifestPath = (_a = options.manifestPath) !== null && _a !== void 0 ? _a : manifest_1.DEFAULT_RELEASE_PLEASE_MANIFEST;
|
||||
this.updateAllPackages = (_b = options.updateAllPackages) !== null && _b !== void 0 ? _b : false;
|
||||
}
|
||||
async run(candidates) {
|
||||
logger_1.logger.info('Running workspace plugin');
|
||||
@@ -82790,6 +82845,7 @@ class WorkspacePlugin extends plugin_1.ManifestPlugin {
|
||||
const orderedPackages = this.buildGraphOrder(graph, packageNamesToUpdate);
|
||||
logger_1.logger.info(`Updating ${orderedPackages.length} packages`);
|
||||
const updatedVersions = new Map();
|
||||
const updatedPathVersions = new Map();
|
||||
for (const pkg of orderedPackages) {
|
||||
const packageName = this.packageNameFromPackage(pkg);
|
||||
logger_1.logger.debug(`package: ${packageName}`);
|
||||
@@ -82803,6 +82859,7 @@ class WorkspacePlugin extends plugin_1.ManifestPlugin {
|
||||
const version = this.bumpVersion(pkg);
|
||||
logger_1.logger.debug(`version: ${version} forced bump`);
|
||||
updatedVersions.set(packageName, version);
|
||||
updatedPathVersions.set(this.pathFromPackage(pkg), version);
|
||||
}
|
||||
}
|
||||
let newCandidates = [];
|
||||
@@ -82825,6 +82882,20 @@ class WorkspacePlugin extends plugin_1.ManifestPlugin {
|
||||
logger_1.logger.info(`Merging ${newCandidates.length} in-scope candidates`);
|
||||
const mergePlugin = new merge_1.Merge(this.github, this.targetBranch, this.repositoryConfig);
|
||||
newCandidates = await mergePlugin.run(newCandidates);
|
||||
if (newCandidates.length === 1) {
|
||||
const newUpdates = newCandidates[0].pullRequest.updates;
|
||||
newUpdates.push({
|
||||
path: this.manifestPath,
|
||||
createIfMissing: false,
|
||||
updater: new release_please_manifest_1.ReleasePleaseManifest({
|
||||
version: newCandidates[0].pullRequest.version,
|
||||
versionsMap: updatedPathVersions,
|
||||
}),
|
||||
});
|
||||
}
|
||||
else {
|
||||
logger_1.logger.warn(`Expected 1 merged candidate, got ${newCandidates.length}`);
|
||||
}
|
||||
logger_1.logger.info(`Post-processing ${newCandidates.length} in-scope candidates`);
|
||||
newCandidates = this.postProcessCandidates(newCandidates, updatedVersions);
|
||||
return [...outOfScopeCandidates, ...newCandidates];
|
||||
@@ -82859,6 +82930,7 @@ class WorkspacePlugin extends plugin_1.ManifestPlugin {
|
||||
* being updated.
|
||||
*/
|
||||
buildGraphOrder(graph, packageNamesToUpdate) {
|
||||
logger_1.logger.info(`building graph order, existing package names: ${packageNamesToUpdate}`);
|
||||
// invert the graph so it's dependency name => packages that depend on it
|
||||
const dependentGraph = this.invertGraph(graph);
|
||||
const visited = new Set();
|
||||
@@ -82979,6 +83051,9 @@ class BaseStrategy {
|
||||
var _a;
|
||||
return this.normalizeComponent((_a = this.packageName) !== null && _a !== void 0 ? _a : (await this.getDefaultPackageName()));
|
||||
}
|
||||
async getBranchComponent() {
|
||||
return this.component || (await this.getDefaultComponent());
|
||||
}
|
||||
async getPackageName() {
|
||||
var _a;
|
||||
return (_a = this.packageName) !== null && _a !== void 0 ? _a : (await this.getDefaultPackageName());
|
||||
@@ -83049,8 +83124,9 @@ class BaseStrategy {
|
||||
const newVersionTag = new tag_name_1.TagName(newVersion, this.includeComponentInTag ? component : undefined, this.tagSeparator, this.includeVInTag);
|
||||
logger_1.logger.debug('pull request title pattern:', this.pullRequestTitlePattern);
|
||||
const pullRequestTitle = pull_request_title_1.PullRequestTitle.ofComponentTargetBranchVersion(component || '', this.targetBranch, newVersion, this.pullRequestTitlePattern);
|
||||
const branchName = component
|
||||
? branch_name_1.BranchName.ofComponentTargetBranch(component, this.targetBranch)
|
||||
const branchComponent = await this.getBranchComponent();
|
||||
const branchName = branchComponent
|
||||
? branch_name_1.BranchName.ofComponentTargetBranch(branchComponent, this.targetBranch)
|
||||
: branch_name_1.BranchName.ofTargetBranch(this.targetBranch);
|
||||
const releaseNotesBody = await this.buildReleaseNotes(conventionalCommits, newVersion, newVersionTag, latestRelease, commits);
|
||||
if (this.changelogEmpty(releaseNotesBody)) {
|
||||
@@ -83174,10 +83250,11 @@ class BaseStrategy {
|
||||
let releaseData;
|
||||
if (pullRequestBody.releaseData.length === 1 &&
|
||||
!pullRequestBody.releaseData[0].component) {
|
||||
const branchComponent = await this.getBranchComponent();
|
||||
// standalone release PR, ensure the components match
|
||||
if (this.normalizeComponent(branchName.component) !==
|
||||
this.normalizeComponent(component)) {
|
||||
logger_1.logger.warn(`PR component: ${branchName.component} does not match configured component: ${component}`);
|
||||
this.normalizeComponent(branchComponent)) {
|
||||
logger_1.logger.warn(`PR component: ${branchName.component} does not match configured component: ${branchComponent}`);
|
||||
return;
|
||||
}
|
||||
releaseData = pullRequestBody.releaseData[0];
|
||||
@@ -113465,7 +113542,7 @@ module.exports = {};
|
||||
/***/ ((module) => {
|
||||
|
||||
"use strict";
|
||||
module.exports = {"i8":"13.15.0"};
|
||||
module.exports = {"i8":"13.16.3"};
|
||||
|
||||
/***/ }),
|
||||
|
||||
|
||||
Reference in New Issue
Block a user