This commit is contained in:
Stephan 2022-03-18 17:42:21 +01:00
parent d6ed51a6f0
commit 863aefcc9d
2 changed files with 11 additions and 1 deletions

View File

@ -1,6 +1,7 @@
module.exports = /*async*/ ({github, context, core}) => { module.exports = /*async*/ ({github, context, core}) => {
const restapi = github.rest const restapi = github.rest
var dryrun = context.payload.inputs.dryrun
function firstOrDefault(items, predicate) { function firstOrDefault(items, predicate) {
for (const item of items) { for (const item of items) {
@ -33,6 +34,7 @@ module.exports = /*async*/ ({github, context, core}) => {
core.setFailed(`Could not find branch 'release/${version}'.`) core.setFailed(`Could not find branch 'release/${version}'.`)
return return
} }
console.log(`Found branch 'release/${version}'.`)
// github milestone must exist and be open // github milestone must exist and be open
const milestone = await getMilestone() const milestone = await getMilestone()
@ -46,6 +48,7 @@ module.exports = /*async*/ ({github, context, core}) => {
core.setFailed(`Milestone '${version}' is already closed.`) core.setFailed(`Milestone '${version}' is already closed.`)
return return
} }
console.log(`Found open milestone '${version}'.`)
// github release must exist and not be published yet // github release must exist and not be published yet
try { try {
@ -68,6 +71,7 @@ module.exports = /*async*/ ({github, context, core}) => {
core.setFailed(`Could not find a GitHub release for tag '${tag}'.`) core.setFailed(`Could not find a GitHub release for tag '${tag}'.`)
return return
} }
console.log(`Found yet-unpublished GitHub Release for tag '${tag}'.`)
// tag must not exist // tag must not exist
try { try {
@ -82,8 +86,9 @@ module.exports = /*async*/ ({github, context, core}) => {
catch (error) { catch (error) {
// this is expected - the tag should not exist // this is expected - the tag should not exist
} }
console.log(`Verified that tag '${tag}' does not exist yet.`)
console.log(`Found branch 'release/${version}', a yet-unpublished GitHub Release for tag '${tag}' which does not exist yet.`) console.log('Release is valid.')
} }
async function publishRelease() { async function publishRelease() {

View File

@ -5,6 +5,11 @@ on:
version: version:
description: 'Version' description: 'Version'
required: true required: true
dryrun:
description: 'DryRun'
required: true
type: boolean
default: true
jobs: jobs:
job: job: