exp
This commit is contained in:
parent
4f5e3068cc
commit
b3615798ac
21
.github/workflows/publish-release.js
vendored
21
.github/workflows/publish-release.js
vendored
|
@ -19,18 +19,12 @@ module.exports = /*async*/ ({github, context, core}) => {
|
||||||
console.log(`Validate version '${version}'.`)
|
console.log(`Validate version '${version}'.`)
|
||||||
|
|
||||||
// git branch must exist
|
// git branch must exist
|
||||||
try {
|
const refs = await restapi.git.listMatchingRefs({
|
||||||
const ref = await restapi.git.getRef({
|
|
||||||
owner: context.repo.owner,
|
owner: context.repo.owner,
|
||||||
repo: context.repo.repo,
|
repo: context.repo.repo,
|
||||||
ref: 'heads/release/' + version
|
ref: `heads/release/${version}`
|
||||||
})
|
})
|
||||||
if (ref == null) {
|
if (firstOrDefault(refs, (x) => x.ref == `heads/release/${version}`) == null) {
|
||||||
core.setFailed(`Could not find branch 'release/${version}'.`)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (error) {
|
|
||||||
core.setFailed(`Could not find branch 'release/${version}'.`)
|
core.setFailed(`Could not find branch 'release/${version}'.`)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -72,20 +66,15 @@ module.exports = /*async*/ ({github, context, core}) => {
|
||||||
console.log(`Found yet-unpublished GitHub Release for tag '${tag}'.`)
|
console.log(`Found yet-unpublished GitHub Release for tag '${tag}'.`)
|
||||||
|
|
||||||
// tag must not exist
|
// tag must not exist
|
||||||
try {
|
|
||||||
const refs = await restapi.git.listMatchingRefs({
|
const refs = await restapi.git.listMatchingRefs({
|
||||||
owner: context.repo.owner,
|
owner: context.repo.owner,
|
||||||
repo: context.repo.repo,
|
repo: context.repo.repo,
|
||||||
//ref: 'tags/' + tag
|
ref: `tags/${tag}`
|
||||||
ref: 'tags/wip'
|
|
||||||
})
|
})
|
||||||
console.log(refs)
|
if (firstOrDefault(refs.data, (x) => x.ref == `tags/${tag}`) != null) {
|
||||||
core.setFailed(`Tag '${tag}' already exists.`)
|
core.setFailed(`Tag '${tag}' already exists.`)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
catch (error) {
|
|
||||||
// this is expected - the tag should not exist
|
|
||||||
}
|
|
||||||
console.log(`Verified that tag '${tag}' does not exist yet.`)
|
console.log(`Verified that tag '${tag}' does not exist yet.`)
|
||||||
|
|
||||||
console.log('Release is valid.')
|
console.log('Release is valid.')
|
||||||
|
|
Loading…
Reference in New Issue
Block a user