1
0
mirror of https://github.com/joaquinjsb/gitea-release-please-action synced 2026-06-09 22:28:13 +02:00

feat: allow github-release/release-pr to be run separately (#70)

This commit is contained in:
Benjamin E. Coe
2020-09-17 14:00:34 -07:00
committed by GitHub
parent c66d20dc19
commit 37d423feba
4 changed files with 70 additions and 56 deletions

View File

@@ -50,6 +50,7 @@ Automate releases with Conventional Commit Messages.
| `upload_url` | Directly related to [**Create a release**](https://developer.github.com/v3/repos/releases/#response-4) API |
| `tag_name` | Directly related to [**Create a release**](https://developer.github.com/v3/repos/releases/#response-4) API |
| `fork` | Should the PR be created from a fork (does not work with `secrets.GITHUB_TOKEN`) |
| `command` | release-please command to run, either `github-release`, or `release-pr` (_defaults to running both_) |
### Release types supported

View File

@@ -26,6 +26,9 @@ inputs:
changelog-types:
description: 'changlelog commit types'
require: false
command:
description: 'release-please command to run, either "github-release", or "release-pr" (defaults to running both)'
require: false
runs:
using: 'node12'
main: 'dist/index.js'

7
dist/index.js vendored
View File

@@ -2235,15 +2235,17 @@ async function main () {
const token = core.getInput('token')
const fork = core.getInput('fork') ? true : undefined
const changelogTypes = core.getInput('changelog-types')
const command = core.getInput('command') ? core.getInput('command') : undefined
// Parse the changelogTypes if there are any
let changelogSections = undefined
let changelogSections
if (changelogTypes) {
changelogSections = JSON.parse(changelogTypes)
}
// First we check for any merged release PRs (PRs merged with the label
// "autorelease: pending"):
if (!command || command === 'github-release') {
const gr = new GitHubRelease({
label: RELEASE_LABEL,
repoUrl: process.env.GITHUB_REPOSITORY,
@@ -2259,9 +2261,11 @@ async function main () {
core.setOutput('upload_url', upload_url)
core.setOutput('tag_name', tag_name)
}
}
// Next we check for PRs merged since the last release, and groom the
// release PR:
if (!command || command === 'release-pr') {
const release = ReleasePRFactory.buildStatic(releaseType, {
monorepoTags,
packageName,
@@ -2276,6 +2280,7 @@ async function main () {
})
await release.run()
}
}
main().catch(err => {
core.setFailed(`release-please failed: ${err.message}`)

View File

@@ -13,15 +13,17 @@ async function main () {
const token = core.getInput('token')
const fork = core.getInput('fork') ? true : undefined
const changelogTypes = core.getInput('changelog-types')
const command = core.getInput('command') ? core.getInput('command') : undefined
// Parse the changelogTypes if there are any
let changelogSections = undefined
let changelogSections
if (changelogTypes) {
changelogSections = JSON.parse(changelogTypes)
}
// First we check for any merged release PRs (PRs merged with the label
// "autorelease: pending"):
if (!command || command === 'github-release') {
const gr = new GitHubRelease({
label: RELEASE_LABEL,
repoUrl: process.env.GITHUB_REPOSITORY,
@@ -37,9 +39,11 @@ async function main () {
core.setOutput('upload_url', upload_url)
core.setOutput('tag_name', tag_name)
}
}
// Next we check for PRs merged since the last release, and groom the
// release PR:
if (!command || command === 'release-pr') {
const release = ReleasePRFactory.buildStatic(releaseType, {
monorepoTags,
packageName,
@@ -54,6 +58,7 @@ async function main () {
})
await release.run()
}
}
main().catch(err => {
core.setFailed(`release-please failed: ${err.message}`)