fix: make release-artifact-cleanup executable (#15225)
* fix: make release-artifact-cleanup executable * fix misc issues in cleanup script
This commit is contained in:
parent
8bc0c343fa
commit
363712d057
1 changed files with 4 additions and 4 deletions
8
script/release-artifact-cleanup.js
Normal file → Executable file
8
script/release-artifact-cleanup.js
Normal file → Executable file
|
@ -3,7 +3,7 @@
|
||||||
if (!process.env.CI) require('dotenv-safe').load()
|
if (!process.env.CI) require('dotenv-safe').load()
|
||||||
require('colors')
|
require('colors')
|
||||||
const args = require('minimist')(process.argv.slice(2), {
|
const args = require('minimist')(process.argv.slice(2), {
|
||||||
boolean: ['tag']
|
string: ['tag']
|
||||||
})
|
})
|
||||||
const { execSync } = require('child_process')
|
const { execSync } = require('child_process')
|
||||||
const { GitProcess } = require('dugite')
|
const { GitProcess } = require('dugite')
|
||||||
|
@ -20,7 +20,7 @@ github.authenticate({
|
||||||
})
|
})
|
||||||
|
|
||||||
function getLastBumpCommit (tag) {
|
function getLastBumpCommit (tag) {
|
||||||
const data = execSync(`git log -n1 --grep "Bump ${tag}" --format="format:{hash: %H, message: '%s'}"`)
|
const data = execSync(`git log -n1 --grep "Bump ${tag}" --format='format:{"hash": "%H", "message": "%s"}'`).toString()
|
||||||
return JSON.parse(data)
|
return JSON.parse(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,9 +90,9 @@ async function deleteTag (tag, targetRepo) {
|
||||||
|
|
||||||
async function cleanReleaseArtifacts () {
|
async function cleanReleaseArtifacts () {
|
||||||
const tag = args.tag
|
const tag = args.tag
|
||||||
const lastBumpCommit = getLastBumpCommit().message
|
const isNightly = args.tag.includes('nightly')
|
||||||
|
|
||||||
if (lastBumpCommit.indexOf('nightly' > 0)) {
|
if (isNightly) {
|
||||||
await deleteDraft(tag, 'nightlies')
|
await deleteDraft(tag, 'nightlies')
|
||||||
await deleteTag(tag, 'nightlies')
|
await deleteTag(tag, 'nightlies')
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue