mirror of
https://github.com/joaquinjsb/gitea-release-please-action
synced 2026-05-12 20:51:38 +02:00
feat: allow github-release/release-pr to be run separately (#70)
This commit is contained in:
@@ -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 |
|
| `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 |
|
| `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`) |
|
| `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
|
### Release types supported
|
||||||
|
|
||||||
|
|||||||
@@ -26,6 +26,9 @@ inputs:
|
|||||||
changelog-types:
|
changelog-types:
|
||||||
description: 'changlelog commit types'
|
description: 'changlelog commit types'
|
||||||
require: false
|
require: false
|
||||||
|
command:
|
||||||
|
description: 'release-please command to run, either "github-release", or "release-pr" (defaults to running both)'
|
||||||
|
require: false
|
||||||
runs:
|
runs:
|
||||||
using: 'node12'
|
using: 'node12'
|
||||||
main: 'dist/index.js'
|
main: 'dist/index.js'
|
||||||
|
|||||||
61
dist/index.js
vendored
61
dist/index.js
vendored
@@ -2235,46 +2235,51 @@ async function main () {
|
|||||||
const token = core.getInput('token')
|
const token = core.getInput('token')
|
||||||
const fork = core.getInput('fork') ? true : undefined
|
const fork = core.getInput('fork') ? true : undefined
|
||||||
const changelogTypes = core.getInput('changelog-types')
|
const changelogTypes = core.getInput('changelog-types')
|
||||||
|
const command = core.getInput('command') ? core.getInput('command') : undefined
|
||||||
|
|
||||||
// Parse the changelogTypes if there are any
|
// Parse the changelogTypes if there are any
|
||||||
let changelogSections = undefined
|
let changelogSections
|
||||||
if (changelogTypes) {
|
if (changelogTypes) {
|
||||||
changelogSections = JSON.parse(changelogTypes)
|
changelogSections = JSON.parse(changelogTypes)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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"):
|
||||||
const gr = new GitHubRelease({
|
if (!command || command === 'github-release') {
|
||||||
label: RELEASE_LABEL,
|
const gr = new GitHubRelease({
|
||||||
repoUrl: process.env.GITHUB_REPOSITORY,
|
label: RELEASE_LABEL,
|
||||||
packageName,
|
repoUrl: process.env.GITHUB_REPOSITORY,
|
||||||
path,
|
packageName,
|
||||||
token
|
path,
|
||||||
})
|
token
|
||||||
const releaseCreated = await gr.createRelease()
|
})
|
||||||
if (releaseCreated) {
|
const releaseCreated = await gr.createRelease()
|
||||||
// eslint-disable-next-line
|
if (releaseCreated) {
|
||||||
const { upload_url, tag_name } = releaseCreated
|
// eslint-disable-next-line
|
||||||
core.setOutput('release_created', true)
|
const { upload_url, tag_name } = releaseCreated
|
||||||
core.setOutput('upload_url', upload_url)
|
core.setOutput('release_created', true)
|
||||||
core.setOutput('tag_name', tag_name)
|
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
|
// Next we check for PRs merged since the last release, and groom the
|
||||||
// release PR:
|
// release PR:
|
||||||
const release = ReleasePRFactory.buildStatic(releaseType, {
|
if (!command || command === 'release-pr') {
|
||||||
monorepoTags,
|
const release = ReleasePRFactory.buildStatic(releaseType, {
|
||||||
packageName,
|
monorepoTags,
|
||||||
path,
|
packageName,
|
||||||
apiUrl: 'https://api.github.com',
|
path,
|
||||||
repoUrl: process.env.GITHUB_REPOSITORY,
|
apiUrl: 'https://api.github.com',
|
||||||
fork,
|
repoUrl: process.env.GITHUB_REPOSITORY,
|
||||||
token: token,
|
fork,
|
||||||
label: RELEASE_LABEL,
|
token: token,
|
||||||
bumpMinorPreMajor,
|
label: RELEASE_LABEL,
|
||||||
changelogSections
|
bumpMinorPreMajor,
|
||||||
})
|
changelogSections
|
||||||
await release.run()
|
})
|
||||||
|
await release.run()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
main().catch(err => {
|
main().catch(err => {
|
||||||
|
|||||||
61
index.js
61
index.js
@@ -13,46 +13,51 @@ async function main () {
|
|||||||
const token = core.getInput('token')
|
const token = core.getInput('token')
|
||||||
const fork = core.getInput('fork') ? true : undefined
|
const fork = core.getInput('fork') ? true : undefined
|
||||||
const changelogTypes = core.getInput('changelog-types')
|
const changelogTypes = core.getInput('changelog-types')
|
||||||
|
const command = core.getInput('command') ? core.getInput('command') : undefined
|
||||||
|
|
||||||
// Parse the changelogTypes if there are any
|
// Parse the changelogTypes if there are any
|
||||||
let changelogSections = undefined
|
let changelogSections
|
||||||
if (changelogTypes) {
|
if (changelogTypes) {
|
||||||
changelogSections = JSON.parse(changelogTypes)
|
changelogSections = JSON.parse(changelogTypes)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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"):
|
||||||
const gr = new GitHubRelease({
|
if (!command || command === 'github-release') {
|
||||||
label: RELEASE_LABEL,
|
const gr = new GitHubRelease({
|
||||||
repoUrl: process.env.GITHUB_REPOSITORY,
|
label: RELEASE_LABEL,
|
||||||
packageName,
|
repoUrl: process.env.GITHUB_REPOSITORY,
|
||||||
path,
|
packageName,
|
||||||
token
|
path,
|
||||||
})
|
token
|
||||||
const releaseCreated = await gr.createRelease()
|
})
|
||||||
if (releaseCreated) {
|
const releaseCreated = await gr.createRelease()
|
||||||
// eslint-disable-next-line
|
if (releaseCreated) {
|
||||||
const { upload_url, tag_name } = releaseCreated
|
// eslint-disable-next-line
|
||||||
core.setOutput('release_created', true)
|
const { upload_url, tag_name } = releaseCreated
|
||||||
core.setOutput('upload_url', upload_url)
|
core.setOutput('release_created', true)
|
||||||
core.setOutput('tag_name', tag_name)
|
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
|
// Next we check for PRs merged since the last release, and groom the
|
||||||
// release PR:
|
// release PR:
|
||||||
const release = ReleasePRFactory.buildStatic(releaseType, {
|
if (!command || command === 'release-pr') {
|
||||||
monorepoTags,
|
const release = ReleasePRFactory.buildStatic(releaseType, {
|
||||||
packageName,
|
monorepoTags,
|
||||||
path,
|
packageName,
|
||||||
apiUrl: 'https://api.github.com',
|
path,
|
||||||
repoUrl: process.env.GITHUB_REPOSITORY,
|
apiUrl: 'https://api.github.com',
|
||||||
fork,
|
repoUrl: process.env.GITHUB_REPOSITORY,
|
||||||
token: token,
|
fork,
|
||||||
label: RELEASE_LABEL,
|
token: token,
|
||||||
bumpMinorPreMajor,
|
label: RELEASE_LABEL,
|
||||||
changelogSections
|
bumpMinorPreMajor,
|
||||||
})
|
changelogSections
|
||||||
await release.run()
|
})
|
||||||
|
await release.run()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
main().catch(err => {
|
main().catch(err => {
|
||||||
|
|||||||
Reference in New Issue
Block a user