mirror of
https://github.com/joaquinjsb/gitea-release-please-action
synced 2026-05-10 20:41:13 +02:00
feat: adds support for releases from alternate paths (#50)
Refs: https://github.com/googleapis/release-please/pull/501
This commit is contained in:
@@ -40,6 +40,8 @@ Automate releases with Conventional Commit Messages.
|
||||
| `release-type` | What type of project is this a release for? Reference [Release types supported](#release-types-supported); new types of releases can be [added here](https://github.com/googleapis/release-please/tree/master/src/releasers) |
|
||||
| `package-name` | A name for the artifact releases are being created for (this might be the `name` field in a `setup.py` or `package.json`) |
|
||||
| `bump-minor-pre-major` | Should breaking changes before 1.0.0 produce minor bumps? Default `No` |
|
||||
| `--path` | create a release from a path other than the repository's root |
|
||||
| `--monorepo-tags` | add prefix to tags and branches, allowing multiple libraries to be released from the same repository. |
|
||||
|
||||
| output | description |
|
||||
|:---:|---|
|
||||
|
||||
164
dist/index.js
vendored
164
dist/index.js
vendored
@@ -1079,6 +1079,7 @@ exports.SourceNode = SourceNode;
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.GitHubRelease = void 0;
|
||||
const chalk = __webpack_require__(843);
|
||||
const path_1 = __webpack_require__(622);
|
||||
const checkpoint_1 = __webpack_require__(923);
|
||||
const release_pr_factory_1 = __webpack_require__(796);
|
||||
const github_1 = __webpack_require__(614);
|
||||
@@ -1092,6 +1093,7 @@ class GitHubRelease {
|
||||
this.labels = options.label.split(',');
|
||||
this.repoUrl = options.repoUrl;
|
||||
this.token = options.token;
|
||||
this.path = options.path;
|
||||
this.packageName = options.packageName;
|
||||
this.releaseType = options.releaseType;
|
||||
this.changelogPath = 'CHANGELOG.md';
|
||||
@@ -1101,8 +1103,11 @@ class GitHubRelease {
|
||||
const gitHubReleasePR = await this.gh.findMergedReleasePR(this.labels);
|
||||
if (gitHubReleasePR) {
|
||||
checkpoint_1.checkpoint(`found release branch ${chalk.green(gitHubReleasePR.version)} at ${chalk.green(gitHubReleasePR.sha)}`, checkpoint_1.CheckpointType.Success);
|
||||
const changelogContents = (await this.gh.getFileContents(this.changelogPath)).parsedContent;
|
||||
const latestReleaseNotes = GitHubRelease.extractLatestReleaseNotes(changelogContents, gitHubReleasePR.version);
|
||||
const changelogContents = (await this.gh.getFileContents(this.addPath(this.changelogPath))).parsedContent;
|
||||
console.info(changelogContents, gitHubReleasePR.version);
|
||||
const latestReleaseNotes = GitHubRelease.extractLatestReleaseNotes(changelogContents,
|
||||
// For monorepo releases, the library name is prepended to the tag and branch:
|
||||
gitHubReleasePR.version.split('-').pop() || gitHubReleasePR.version);
|
||||
checkpoint_1.checkpoint(`found release notes: \n---\n${chalk.grey(latestReleaseNotes)}\n---\n`, checkpoint_1.CheckpointType.Success);
|
||||
// Attempt to lookup the package name from a well known location, such
|
||||
// as package.json, if none is provided:
|
||||
@@ -1126,6 +1131,14 @@ class GitHubRelease {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
addPath(file) {
|
||||
if (this.path === undefined) {
|
||||
return file;
|
||||
}
|
||||
else {
|
||||
return path_1.join(this.path, `./${file}`);
|
||||
}
|
||||
}
|
||||
gitHubInstance(octokitAPIs) {
|
||||
const [owner, repo] = parseGithubRepoUrl(this.repoUrl);
|
||||
return new github_1.GitHub({
|
||||
@@ -1521,7 +1534,9 @@ class ReleasePR {
|
||||
: DEFAULT_LABELS.split(',');
|
||||
this.repoUrl = options.repoUrl;
|
||||
this.token = options.token;
|
||||
this.path = options.path;
|
||||
this.packageName = options.packageName;
|
||||
this.monorepoTags = options.monorepoTags || false;
|
||||
this.releaseAs = options.releaseAs;
|
||||
this.apiUrl = options.apiUrl;
|
||||
this.proxyKey = options.proxyKey;
|
||||
@@ -1608,10 +1623,14 @@ class ReleasePR {
|
||||
}
|
||||
return { version, previousTag };
|
||||
}
|
||||
async commits(sha, perPage = 100, labels = false, path = null) {
|
||||
async commits(opts) {
|
||||
const sha = opts.sha;
|
||||
const perPage = opts.perPage || 100;
|
||||
const labels = opts.labels || false;
|
||||
const path = opts.path || undefined;
|
||||
const commits = await this.gh.commitsSinceSha(sha, perPage, labels, path);
|
||||
if (commits.length) {
|
||||
checkpoint_1.checkpoint(`found ${commits.length} commits since ${sha}`, checkpoint_1.CheckpointType.Success);
|
||||
checkpoint_1.checkpoint(`found ${commits.length} commits since ${sha ? sha : 'beginning of time'}`, checkpoint_1.CheckpointType.Success);
|
||||
}
|
||||
else {
|
||||
checkpoint_1.checkpoint(`no commits found since ${sha}`, checkpoint_1.CheckpointType.Failure);
|
||||
@@ -1630,7 +1649,12 @@ class ReleasePR {
|
||||
octokitAPIs,
|
||||
});
|
||||
}
|
||||
async openPR(sha, changelogEntry, updates, version, includePackageName = false) {
|
||||
async openPR(options) {
|
||||
const sha = options.sha;
|
||||
const changelogEntry = options.changelogEntry;
|
||||
const updates = options.updates;
|
||||
const version = options.version;
|
||||
const includePackageName = options.includePackageName;
|
||||
const title = includePackageName
|
||||
? `Release ${this.packageName} ${version}`
|
||||
: `chore: release ${version}`;
|
||||
@@ -1656,6 +1680,16 @@ class ReleasePR {
|
||||
changelogEmpty(changelogEntry) {
|
||||
return changelogEntry.split('\n').length === 1;
|
||||
}
|
||||
addPath(file) {
|
||||
if (this.path === undefined) {
|
||||
return file;
|
||||
}
|
||||
else {
|
||||
const path = this.path.replace(/[/\\]$/, '');
|
||||
file = file.replace(/^[/\\]/, '');
|
||||
return `${path}/${file}`;
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.ReleasePR = ReleasePR;
|
||||
ReleasePR.releaserName = 'base';
|
||||
@@ -1695,10 +1729,12 @@ const { ReleasePRFactory } = __webpack_require__(796)
|
||||
const RELEASE_LABEL = 'autorelease: pending'
|
||||
|
||||
async function main () {
|
||||
const token = core.getInput('token')
|
||||
const releaseType = core.getInput('release-type')
|
||||
const packageName = core.getInput('package-name')
|
||||
const bumpMinorPreMajor = Boolean(core.getInput('bump-minor-pre-major'))
|
||||
const monorepoTags = Boolean(core.getInput('monorepo-tags'))
|
||||
const packageName = core.getInput('package-name')
|
||||
const path = core.getInput('path')
|
||||
const releaseType = core.getInput('release-type')
|
||||
const token = core.getInput('token')
|
||||
|
||||
// First we check for any merged release PRs (PRs merged with the label
|
||||
// "autorelease: pending"):
|
||||
@@ -1706,10 +1742,12 @@ async function main () {
|
||||
label: RELEASE_LABEL,
|
||||
repoUrl: process.env.GITHUB_REPOSITORY,
|
||||
packageName,
|
||||
token
|
||||
path,
|
||||
token,
|
||||
})
|
||||
const releaseCreated = await gr.createRelease()
|
||||
if (releaseCreated) {
|
||||
// eslint-disable-next-line
|
||||
const { upload_url, tag_name } = releaseCreated
|
||||
core.setOutput('release_created', true)
|
||||
core.setOutput('upload_url', upload_url)
|
||||
@@ -1719,12 +1757,14 @@ async function main () {
|
||||
// Next we check for PRs merged since the last release, and groom the
|
||||
// release PR:
|
||||
const release = ReleasePRFactory.buildStatic(releaseType, {
|
||||
packageName: packageName,
|
||||
monorepoTags,
|
||||
packageName,
|
||||
path,
|
||||
apiUrl: 'https://api.github.com',
|
||||
repoUrl: process.env.GITHUB_REPOSITORY,
|
||||
token: token,
|
||||
label: RELEASE_LABEL,
|
||||
bumpMinorPreMajor: bumpMinorPreMajor
|
||||
bumpMinorPreMajor
|
||||
})
|
||||
await release.run()
|
||||
}
|
||||
@@ -8117,7 +8157,7 @@ module.exports = eq
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
const VERSION = "2.2.4";
|
||||
const VERSION = "2.3.0";
|
||||
|
||||
/**
|
||||
* Some “list” response that can be paginated have a different response structure
|
||||
@@ -16431,8 +16471,11 @@ const CHANGELOG_SECTIONS = [
|
||||
];
|
||||
class Python extends release_pr_1.ReleasePR {
|
||||
async _run() {
|
||||
const latestTag = await this.gh.latestTag();
|
||||
const commits = await this.commits(latestTag ? latestTag.sha : undefined);
|
||||
const latestTag = await this.gh.latestTag(this.monorepoTags ? `${this.packageName}-` : undefined);
|
||||
const commits = await this.commits({
|
||||
sha: latestTag ? latestTag.sha : undefined,
|
||||
path: this.path,
|
||||
});
|
||||
const cc = new conventional_commits_1.ConventionalCommits({
|
||||
commits,
|
||||
githubRepoUrl: this.repoUrl,
|
||||
@@ -16454,24 +16497,30 @@ class Python extends release_pr_1.ReleasePR {
|
||||
}
|
||||
const updates = [];
|
||||
updates.push(new changelog_1.Changelog({
|
||||
path: 'CHANGELOG.md',
|
||||
path: this.addPath('CHANGELOG.md'),
|
||||
changelogEntry,
|
||||
version: candidate.version,
|
||||
packageName: this.packageName,
|
||||
}));
|
||||
updates.push(new setup_cfg_1.SetupCfg({
|
||||
path: 'setup.cfg',
|
||||
path: this.addPath('setup.cfg'),
|
||||
changelogEntry,
|
||||
version: candidate.version,
|
||||
packageName: this.packageName,
|
||||
}));
|
||||
updates.push(new setup_py_1.SetupPy({
|
||||
path: 'setup.py',
|
||||
path: this.addPath('setup.py'),
|
||||
changelogEntry,
|
||||
version: candidate.version,
|
||||
packageName: this.packageName,
|
||||
}));
|
||||
await this.openPR(commits[0].sha, `${changelogEntry}\n---\n`, updates, candidate.version);
|
||||
await this.openPR({
|
||||
sha: commits[0].sha,
|
||||
changelogEntry: `${changelogEntry}\n---\n`,
|
||||
updates,
|
||||
version: candidate.version,
|
||||
includePackageName: this.monorepoTags,
|
||||
});
|
||||
}
|
||||
defaultInitialVersion() {
|
||||
return '0.1.0';
|
||||
@@ -37846,8 +37895,8 @@ class GitHub {
|
||||
}));
|
||||
return refResponse.data.object.sha;
|
||||
}
|
||||
async latestTag() {
|
||||
const tags = await this.allTags();
|
||||
async latestTag(prefix) {
|
||||
const tags = await this.allTags(prefix);
|
||||
const versions = Object.keys(tags).filter(t => {
|
||||
// remove any pre-releases from the list:
|
||||
return !t.includes('-');
|
||||
@@ -37917,15 +37966,19 @@ class GitHub {
|
||||
}
|
||||
return openReleasePRs;
|
||||
}
|
||||
async allTags() {
|
||||
async allTags(prefix) {
|
||||
const tags = {};
|
||||
for await (const response of this.octokit.paginate.iterator(this.decoratePaginateOpts({
|
||||
method: 'GET',
|
||||
url: `/repos/${this.owner}/${this.repo}/tags?per_page=100${this.proxyKey ? `&key=${this.proxyKey}` : ''}`,
|
||||
}))) {
|
||||
response.data.forEach((data) => {
|
||||
const version = semver.valid(data.name);
|
||||
if (version) {
|
||||
// For monorepos, a prefix can be provided, indicating that only tags
|
||||
// matching the prefix should be returned:
|
||||
if (prefix && !data.name.startsWith(prefix))
|
||||
return;
|
||||
let version = data.name.replace(prefix, '');
|
||||
if ((version = semver.valid(version))) {
|
||||
tags[version] = { sha: data.commit.sha, name: data.name, version };
|
||||
}
|
||||
});
|
||||
@@ -38276,8 +38329,11 @@ const package_json_1 = __webpack_require__(815);
|
||||
const samples_package_json_1 = __webpack_require__(637);
|
||||
class Node extends release_pr_1.ReleasePR {
|
||||
async _run() {
|
||||
const latestTag = await this.gh.latestTag();
|
||||
const commits = await this.commits(latestTag ? latestTag.sha : undefined);
|
||||
const latestTag = await this.gh.latestTag(this.monorepoTags ? `${this.packageName}-` : undefined);
|
||||
const commits = await this.commits({
|
||||
sha: latestTag ? latestTag.sha : undefined,
|
||||
path: this.path,
|
||||
});
|
||||
const cc = new conventional_commits_1.ConventionalCommits({
|
||||
commits,
|
||||
githubRepoUrl: this.repoUrl,
|
||||
@@ -38299,36 +38355,42 @@ class Node extends release_pr_1.ReleasePR {
|
||||
const updates = [];
|
||||
// Make an effort to populate packageName from the contents of
|
||||
// the package.json, rather than forcing this to be set:
|
||||
const contents = await this.gh.getFileContents('package.json');
|
||||
const contents = await this.gh.getFileContents(this.addPath('package.json'));
|
||||
const pkg = JSON.parse(contents.parsedContent);
|
||||
if (pkg.name)
|
||||
this.packageName = pkg.name;
|
||||
updates.push(new package_json_1.PackageJson({
|
||||
path: 'package-lock.json',
|
||||
path: this.addPath('package-lock.json'),
|
||||
changelogEntry,
|
||||
version: candidate.version,
|
||||
packageName: this.packageName,
|
||||
}));
|
||||
updates.push(new samples_package_json_1.SamplesPackageJson({
|
||||
path: 'samples/package.json',
|
||||
path: this.addPath('samples/package.json'),
|
||||
changelogEntry,
|
||||
version: candidate.version,
|
||||
packageName: this.packageName,
|
||||
}));
|
||||
updates.push(new changelog_1.Changelog({
|
||||
path: 'CHANGELOG.md',
|
||||
path: this.addPath('CHANGELOG.md'),
|
||||
changelogEntry,
|
||||
version: candidate.version,
|
||||
packageName: this.packageName,
|
||||
}));
|
||||
updates.push(new package_json_1.PackageJson({
|
||||
path: 'package.json',
|
||||
path: this.addPath('package.json'),
|
||||
changelogEntry,
|
||||
version: candidate.version,
|
||||
packageName: this.packageName,
|
||||
contents,
|
||||
}));
|
||||
await this.openPR(commits[0].sha, `${changelogEntry}\n---\n`, updates, candidate.version);
|
||||
await this.openPR({
|
||||
sha: commits[0].sha,
|
||||
changelogEntry: `${changelogEntry}\n---\n`,
|
||||
updates,
|
||||
version: candidate.version,
|
||||
includePackageName: this.monorepoTags,
|
||||
});
|
||||
}
|
||||
// A releaser can implement this method to automatically detect
|
||||
// the release name when creating a GitHub release, for instance by returning
|
||||
@@ -39653,8 +39715,11 @@ const changelog_1 = __webpack_require__(261);
|
||||
const version_txt_1 = __webpack_require__(25);
|
||||
class Simple extends release_pr_1.ReleasePR {
|
||||
async _run() {
|
||||
const latestTag = await this.gh.latestTag();
|
||||
const commits = await this.commits(latestTag ? latestTag.sha : undefined);
|
||||
const latestTag = await this.gh.latestTag(this.monorepoTags ? `${this.packageName}-` : undefined);
|
||||
const commits = await this.commits({
|
||||
sha: latestTag ? latestTag.sha : undefined,
|
||||
path: this.path,
|
||||
});
|
||||
const cc = new conventional_commits_1.ConventionalCommits({
|
||||
commits,
|
||||
githubRepoUrl: this.repoUrl,
|
||||
@@ -39689,7 +39754,13 @@ class Simple extends release_pr_1.ReleasePR {
|
||||
contents,
|
||||
skipCi: false,
|
||||
}));
|
||||
await this.openPR(commits[0].sha, `${changelogEntry}\n---\n`, updates, candidate.version);
|
||||
await this.openPR({
|
||||
sha: commits[0].sha,
|
||||
changelogEntry: `${changelogEntry}\n---\n`,
|
||||
updates,
|
||||
version: candidate.version,
|
||||
includePackageName: this.monorepoTags,
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.Simple = Simple;
|
||||
@@ -41994,7 +42065,7 @@ module.exports = exports['default'];
|
||||
/* 759 */
|
||||
/***/ (function(module) {
|
||||
|
||||
module.exports = {"_from":"release-please@latest","_id":"release-please@5.5.2","_inBundle":false,"_integrity":"sha512-NAnAYFhvgNZXeBcwyhOckWEOzLob7vbEjTT2ZmOoHOeo2sHX0/qf8Jqj0iNGLGhDOb/AWj6Nc/UKv+Jyly0FEA==","_location":"/release-please","_phantomChildren":{},"_requested":{"type":"tag","registry":true,"raw":"release-please@latest","name":"release-please","escapedName":"release-please","rawSpec":"latest","saveSpec":null,"fetchSpec":"latest"},"_requiredBy":["#USER","/"],"_resolved":"https://registry.npmjs.org/release-please/-/release-please-5.5.2.tgz","_shasum":"355753127b30875be35ec0335b0295a5fe4c2637","_spec":"release-please@latest","_where":"/Users/bencoe/oss/release-please-action","author":{"name":"Google Inc."},"bin":{"release-please":"build/src/bin/release-please.js"},"bugs":{"url":"https://github.com/googleapis/release-please/issues"},"bundleDependencies":false,"dependencies":{"@octokit/graphql":"^4.3.1","@octokit/request":"^5.3.4","@octokit/rest":"^18.0.0","chalk":"^4.0.0","concat-stream":"^2.0.0","conventional-changelog-conventionalcommits":"^4.0.0","conventional-changelog-writer":"^4.0.6","conventional-commits-filter":"^2.0.2","conventional-commits-parser":"^3.0.3","figures":"^3.0.0","parse-github-repo-url":"^1.4.1","semver":"^7.0.0","type-fest":"^0.16.0","yargs":"^15.0.0"},"deprecated":false,"description":"generate release PRs based on the conventionalcommits.org spec","devDependencies":{"@microsoft/api-documenter":"^7.8.10","@microsoft/api-extractor":"^7.8.10","@octokit/types":"^5.0.0","@types/chai":"^4.1.7","@types/mocha":"^8.0.0","@types/node":"^11.13.6","@types/semver":"^7.0.0","@types/yargs":"^15.0.4","c8":"^7.0.0","chai":"^4.2.0","cross-env":"^7.0.0","gts":"^2.0.0","mocha":"^8.0.0","nock":"^13.0.0","snap-shot-it":"^7.0.0","typescript":"^3.8.3"},"engines":{"node":">=10.12.0"},"files":["build/src","templates","!build/src/**/*.map"],"homepage":"https://github.com/googleapis/release-please#readme","keywords":["release","conventional-commits"],"license":"Apache-2.0","main":"./build/src/index.js","name":"release-please","repository":{"type":"git","url":"git+https://github.com/googleapis/release-please.git"},"scripts":{"api-documenter":"api-documenter yaml --input-folder=temp","api-extractor":"api-extractor run --local","clean":"gts clean","compile":"tsc -p .","docs-test":"echo add docs tests","fix":"gts fix","lint":"gts check","prepare":"npm run compile","presystem-test":"npm run compile","pretest":"npm run compile","system-test":"echo 'no system tests'","test":"cross-env ENVIRONMENT=test c8 mocha --recursive --timeout=5000 build/test","test:all":"cross-env ENVIRONMENT=test c8 mocha --recursive --timeout=20000 build/system-test build/test","test:snap":"SNAPSHOT_UPDATE=1 npm test"},"version":"5.5.2"};
|
||||
module.exports = {"_from":"release-please@latest","_id":"release-please@5.6.0","_inBundle":false,"_integrity":"sha512-p/CR4x8PAkMb2ScYwYEKNAsgSsBTeTWyKo95ST0vVwceL0KXBIoDLWJ3PNwIx+vxFe4adBnd28uGU/Bz5l+uLw==","_location":"/release-please","_phantomChildren":{},"_requested":{"type":"tag","registry":true,"raw":"release-please@latest","name":"release-please","escapedName":"release-please","rawSpec":"latest","saveSpec":null,"fetchSpec":"latest"},"_requiredBy":["#USER","/"],"_resolved":"https://registry.npmjs.org/release-please/-/release-please-5.6.0.tgz","_shasum":"5f08831abc8d911e11617c92444f99c2af4ccc41","_spec":"release-please@latest","_where":"/Users/bencoe/oss/release-please-action","author":{"name":"Google Inc."},"bin":{"release-please":"build/src/bin/release-please.js"},"bugs":{"url":"https://github.com/googleapis/release-please/issues"},"bundleDependencies":false,"dependencies":{"@octokit/graphql":"^4.3.1","@octokit/request":"^5.3.4","@octokit/rest":"^18.0.0","chalk":"^4.0.0","concat-stream":"^2.0.0","conventional-changelog-conventionalcommits":"^4.0.0","conventional-changelog-writer":"^4.0.6","conventional-commits-filter":"^2.0.2","conventional-commits-parser":"^3.0.3","figures":"^3.0.0","parse-github-repo-url":"^1.4.1","semver":"^7.0.0","type-fest":"^0.16.0","yargs":"^15.0.0"},"deprecated":false,"description":"generate release PRs based on the conventionalcommits.org spec","devDependencies":{"@microsoft/api-documenter":"^7.8.10","@microsoft/api-extractor":"^7.8.10","@octokit/types":"^5.0.0","@types/chai":"^4.1.7","@types/mocha":"^8.0.0","@types/node":"^11.13.6","@types/semver":"^7.0.0","@types/yargs":"^15.0.4","c8":"^7.0.0","chai":"^4.2.0","cross-env":"^7.0.0","gts":"^2.0.0","mocha":"^8.0.0","nock":"^13.0.0","snap-shot-it":"^7.0.0","typescript":"^3.8.3"},"engines":{"node":">=10.12.0"},"files":["build/src","templates","!build/src/**/*.map"],"homepage":"https://github.com/googleapis/release-please#readme","keywords":["release","conventional-commits"],"license":"Apache-2.0","main":"./build/src/index.js","name":"release-please","repository":{"type":"git","url":"git+https://github.com/googleapis/release-please.git"},"scripts":{"api-documenter":"api-documenter yaml --input-folder=temp","api-extractor":"api-extractor run --local","clean":"gts clean","compile":"tsc -p .","docs-test":"echo add docs tests","fix":"gts fix","lint":"gts check","prepare":"npm run compile","presystem-test":"npm run compile","pretest":"npm run compile","system-test":"echo 'no system tests'","test":"cross-env ENVIRONMENT=test c8 mocha --recursive --timeout=5000 build/test","test:all":"cross-env ENVIRONMENT=test c8 mocha --recursive --timeout=20000 build/system-test build/test","test:snap":"SNAPSHOT_UPDATE=1 npm test"},"version":"5.6.0"};
|
||||
|
||||
/***/ }),
|
||||
/* 760 */
|
||||
@@ -44456,7 +44527,7 @@ const Endpoints = {
|
||||
}
|
||||
};
|
||||
|
||||
const VERSION = "4.1.1";
|
||||
const VERSION = "4.1.2";
|
||||
|
||||
function endpointsToMethods(octokit, endpointsMap) {
|
||||
const newMethods = {};
|
||||
@@ -45453,7 +45524,7 @@ var pluginRequestLog = __webpack_require__(916);
|
||||
var pluginPaginateRest = __webpack_require__(299);
|
||||
var pluginRestEndpointMethods = __webpack_require__(842);
|
||||
|
||||
const VERSION = "18.0.2";
|
||||
const VERSION = "18.0.3";
|
||||
|
||||
const Octokit = core.Octokit.plugin(pluginRequestLog.requestLog, pluginRestEndpointMethods.restEndpointMethods, pluginPaginateRest.paginateRest).defaults({
|
||||
userAgent: `octokit-rest.js/${VERSION}`
|
||||
@@ -47742,8 +47813,11 @@ const changelog_1 = __webpack_require__(261);
|
||||
const readme_1 = __webpack_require__(458);
|
||||
class TerraformModule extends release_pr_1.ReleasePR {
|
||||
async _run() {
|
||||
const latestTag = await this.gh.latestTag();
|
||||
const commits = await this.commits(latestTag ? latestTag.sha : undefined);
|
||||
const latestTag = await this.gh.latestTag(this.monorepoTags ? `${this.packageName}-` : undefined);
|
||||
const commits = await this.commits({
|
||||
sha: latestTag ? latestTag.sha : undefined,
|
||||
path: this.path,
|
||||
});
|
||||
const cc = new conventional_commits_1.ConventionalCommits({
|
||||
commits,
|
||||
githubRepoUrl: this.repoUrl,
|
||||
@@ -47764,18 +47838,24 @@ class TerraformModule extends release_pr_1.ReleasePR {
|
||||
}
|
||||
const updates = [];
|
||||
updates.push(new changelog_1.Changelog({
|
||||
path: 'CHANGELOG.md',
|
||||
path: this.addPath('CHANGELOG.md'),
|
||||
changelogEntry,
|
||||
version: candidate.version,
|
||||
packageName: this.packageName,
|
||||
}));
|
||||
updates.push(new readme_1.ReadMe({
|
||||
path: 'README.md',
|
||||
path: this.addPath('README.md'),
|
||||
changelogEntry,
|
||||
version: candidate.version,
|
||||
packageName: this.packageName,
|
||||
}));
|
||||
await this.openPR(commits[0].sha, `${changelogEntry}\n---\n`, updates, candidate.version);
|
||||
await this.openPR({
|
||||
sha: commits[0].sha,
|
||||
changelogEntry: `${changelogEntry}\n---\n`,
|
||||
updates,
|
||||
version: candidate.version,
|
||||
includePackageName: this.monorepoTags,
|
||||
});
|
||||
}
|
||||
defaultInitialVersion() {
|
||||
return '0.1.0';
|
||||
|
||||
15
index.js
15
index.js
@@ -5,10 +5,12 @@ const { ReleasePRFactory } = require('release-please/build/src/release-pr-factor
|
||||
const RELEASE_LABEL = 'autorelease: pending'
|
||||
|
||||
async function main () {
|
||||
const token = core.getInput('token')
|
||||
const releaseType = core.getInput('release-type')
|
||||
const packageName = core.getInput('package-name')
|
||||
const bumpMinorPreMajor = Boolean(core.getInput('bump-minor-pre-major'))
|
||||
const monorepoTags = Boolean(core.getInput('monorepo-tags'))
|
||||
const packageName = core.getInput('package-name')
|
||||
const path = core.getInput('path')
|
||||
const releaseType = core.getInput('release-type')
|
||||
const token = core.getInput('token')
|
||||
|
||||
// First we check for any merged release PRs (PRs merged with the label
|
||||
// "autorelease: pending"):
|
||||
@@ -16,6 +18,7 @@ async function main () {
|
||||
label: RELEASE_LABEL,
|
||||
repoUrl: process.env.GITHUB_REPOSITORY,
|
||||
packageName,
|
||||
path,
|
||||
token
|
||||
})
|
||||
const releaseCreated = await gr.createRelease()
|
||||
@@ -30,12 +33,14 @@ async function main () {
|
||||
// Next we check for PRs merged since the last release, and groom the
|
||||
// release PR:
|
||||
const release = ReleasePRFactory.buildStatic(releaseType, {
|
||||
packageName: packageName,
|
||||
monorepoTags,
|
||||
packageName,
|
||||
path,
|
||||
apiUrl: 'https://api.github.com',
|
||||
repoUrl: process.env.GITHUB_REPOSITORY,
|
||||
token: token,
|
||||
label: RELEASE_LABEL,
|
||||
bumpMinorPreMajor: bumpMinorPreMajor
|
||||
bumpMinorPreMajor
|
||||
})
|
||||
await release.run()
|
||||
}
|
||||
|
||||
52
package-lock.json
generated
52
package-lock.json
generated
@@ -120,11 +120,11 @@
|
||||
}
|
||||
},
|
||||
"@octokit/plugin-paginate-rest": {
|
||||
"version": "2.2.4",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.2.4.tgz",
|
||||
"integrity": "sha512-oT/lohKytvstJ4oL7yueNRhqbjYJ7BExYDAHxyYyZtiSZj5y2F1SRINvZwQ+E4esH30YovE2jDysUltty4OYEA==",
|
||||
"version": "2.3.0",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.3.0.tgz",
|
||||
"integrity": "sha512-Ye2ZJreP0ZlqJQz8fz+hXvrEAEYK4ay7br1eDpWzr6j76VXs/gKqxFcH8qRzkB3fo/2xh4Vy9VtGii4ZDc9qlA==",
|
||||
"requires": {
|
||||
"@octokit/types": "^5.0.0"
|
||||
"@octokit/types": "^5.2.0"
|
||||
}
|
||||
},
|
||||
"@octokit/plugin-request-log": {
|
||||
@@ -133,9 +133,9 @@
|
||||
"integrity": "sha512-ywoxP68aOT3zHCLgWZgwUJatiENeHE7xJzYjfz8WI0goynp96wETBF+d95b8g/uL4QmS6owPVlaxiz3wyMAzcw=="
|
||||
},
|
||||
"@octokit/plugin-rest-endpoint-methods": {
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-4.1.1.tgz",
|
||||
"integrity": "sha512-6bPYA3PkjqIn/QUS5dHPz6FDekHRsDz4I+oTL68siia+KOZnSvjq7oOrztiSlRT5vb9ItXhgVH4C5JMpk1yijQ==",
|
||||
"version": "4.1.2",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-4.1.2.tgz",
|
||||
"integrity": "sha512-PTI7wpbGEZ2IR87TVh+TNWaLcgX/RsZQalFbQCq8XxYUrQ36RHyERrHSNXFy5gkWpspUAOYRSV707JJv6BhqJA==",
|
||||
"requires": {
|
||||
"@octokit/types": "^5.1.1",
|
||||
"deprecation": "^2.3.1"
|
||||
@@ -167,20 +167,20 @@
|
||||
}
|
||||
},
|
||||
"@octokit/rest": {
|
||||
"version": "18.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/rest/-/rest-18.0.2.tgz",
|
||||
"integrity": "sha512-4nHwhnfeRfiAx/x41aC8VjzznJbDEEX38ZCHIqD9CarU4QdEc9RqdNox+RBT5OaRHyuS1P/lgSk56N2sePdJlw==",
|
||||
"version": "18.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/rest/-/rest-18.0.3.tgz",
|
||||
"integrity": "sha512-GubgemnLvUJlkhouTM2BtX+g/voYT/Mqh0SASGwTnLvSkW1irjt14N911/ABb6m1Hru0TwScOgFgMFggp3igfQ==",
|
||||
"requires": {
|
||||
"@octokit/core": "^3.0.0",
|
||||
"@octokit/plugin-paginate-rest": "^2.2.0",
|
||||
"@octokit/plugin-request-log": "^1.0.0",
|
||||
"@octokit/plugin-rest-endpoint-methods": "4.1.1"
|
||||
"@octokit/plugin-rest-endpoint-methods": "4.1.2"
|
||||
}
|
||||
},
|
||||
"@octokit/types": {
|
||||
"version": "5.1.2",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-5.1.2.tgz",
|
||||
"integrity": "sha512-+zuMnja97vuZmWa+HdUY+0KB9MLwcEHueSSyKu0G/HqZaFYCVdLpBkavb0xyDlH7eoBdvAvSX/+Y8+4FOEZkrQ==",
|
||||
"version": "5.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-5.2.0.tgz",
|
||||
"integrity": "sha512-XjOk9y4m8xTLIKPe1NFxNWBdzA2/z3PFFA/bwf4EoH6oS8hM0Y46mEa4Cb+KCyj/tFDznJFahzQ0Aj3o1FYq4A==",
|
||||
"requires": {
|
||||
"@types/node": ">= 8"
|
||||
}
|
||||
@@ -196,9 +196,9 @@
|
||||
"integrity": "sha1-aaI6OtKcrwCX8G7aWbNh7i8GOfY="
|
||||
},
|
||||
"@types/node": {
|
||||
"version": "14.0.24",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.0.24.tgz",
|
||||
"integrity": "sha512-btt/oNOiDWcSuI721MdL8VQGnjsKjlTMdrKyTcLCKeQp/n4AAMFJ961wMbp+09y8WuGPClDEv07RIItdXKIXAA=="
|
||||
"version": "14.0.26",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.0.26.tgz",
|
||||
"integrity": "sha512-W+fpe5s91FBGE0pEa0lnqGLL4USgpLgs4nokw16SrBBco/gQxuua7KnArSEOd5iaMqbbSHV10vUDkJYJJqpXKA=="
|
||||
},
|
||||
"@types/normalize-package-data": {
|
||||
"version": "2.4.0",
|
||||
@@ -1474,9 +1474,9 @@
|
||||
"integrity": "sha1-caUMhCnfync8kqOQpKA7OfzVHT4="
|
||||
},
|
||||
"is-plain-object": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-4.1.0.tgz",
|
||||
"integrity": "sha512-1N1OpoS8S4Ua+FsH6Mhvgaj0di3uRXgulcv2dnFu2J/WcEsDNbBoiUX6mYmhQ2cAzZ+B/lTJtX1qUSL5RwsGug=="
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-4.1.1.tgz",
|
||||
"integrity": "sha512-5Aw8LLVsDlZsETVMhoMXzqsXwQqr/0vlnBYzIXJbYo2F4yYlhLHs+Ez7Bod7IIQKWkJbJfxrWD7pA1Dw1TKrwA=="
|
||||
},
|
||||
"is-regex": {
|
||||
"version": "1.1.0",
|
||||
@@ -1921,9 +1921,9 @@
|
||||
"integrity": "sha1-nn2LslKmy2ukJZUGC3v23z28H1A="
|
||||
},
|
||||
"parse-json": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.0.0.tgz",
|
||||
"integrity": "sha512-OOY5b7PAEFV0E2Fir1KOkxchnZNCdowAJgQ5NuxjpBKTRP3pQhwkrkxqQjeoKJ+fO7bCpmIZaogI4eZGDMEGOw==",
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.0.1.tgz",
|
||||
"integrity": "sha512-ztoZ4/DYeXQq4E21v169sC8qWINGpcosGv9XhTDvg9/hWvx/zrFkc9BiWxR58OJLHGk28j5BL0SDLeV2WmFZlQ==",
|
||||
"requires": {
|
||||
"@babel/code-frame": "^7.0.0",
|
||||
"error-ex": "^1.3.1",
|
||||
@@ -2231,9 +2231,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"release-please": {
|
||||
"version": "5.5.2",
|
||||
"resolved": "https://registry.npmjs.org/release-please/-/release-please-5.5.2.tgz",
|
||||
"integrity": "sha512-NAnAYFhvgNZXeBcwyhOckWEOzLob7vbEjTT2ZmOoHOeo2sHX0/qf8Jqj0iNGLGhDOb/AWj6Nc/UKv+Jyly0FEA==",
|
||||
"version": "5.6.0",
|
||||
"resolved": "https://registry.npmjs.org/release-please/-/release-please-5.6.0.tgz",
|
||||
"integrity": "sha512-p/CR4x8PAkMb2ScYwYEKNAsgSsBTeTWyKo95ST0vVwceL0KXBIoDLWJ3PNwIx+vxFe4adBnd28uGU/Bz5l+uLw==",
|
||||
"requires": {
|
||||
"@octokit/graphql": "^4.3.1",
|
||||
"@octokit/request": "^5.3.4",
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
"homepage": "https://github.com/bcoe/release-please-action#readme",
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.2.4",
|
||||
"release-please": "^5.5.2"
|
||||
"release-please": "^5.6.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@zeit/ncc": "^0.22.3",
|
||||
|
||||
Reference in New Issue
Block a user