6b863fe294
Follow-up to https://github.com/vercel/next.js/pull/32337 this removes the un-necessary step where we fetch all of the tags which requires pulling a lot of un-necessary git history inflating cache size and publish times. The only reason these tags were needing to be fetched is due to an issue in how the `actions/checkout` step works (https://github.com/actions/checkout/issues/882). This reduces the publish times by at least 4 minutes by removing the tags fetching step https://github.com/vercel/next.js/actions/runs/3598569786/jobs/6061449995#step:16:14 As a further optimization this adds concurrency to the `npm publish` calls themselves to hopefully reduce time spent there as well.
26 lines
706 B
JavaScript
Executable file
26 lines
706 B
JavaScript
Executable file
const { execSync } = require('child_process')
|
|
|
|
const checkIsRelease = async () => {
|
|
let commitId = process.argv[2] || ''
|
|
|
|
// parse only the last string which should be version if
|
|
// it's a publish commit
|
|
const commitMsg = execSync(
|
|
`git log -n 1 --pretty='format:%B'${commitId ? ` ${commitId}` : ''}`
|
|
)
|
|
.toString()
|
|
.trim()
|
|
|
|
const versionString = commitMsg.split(' ').pop().trim()
|
|
const publishMsgRegex = /^v\d{1,}\.\d{1,}\.\d{1,}(-\w{1,}\.\d{1,})?$/
|
|
|
|
if (publishMsgRegex.test(versionString)) {
|
|
console.log(versionString)
|
|
process.exit(0)
|
|
} else {
|
|
console.log('not publish commit', { commitId, commitMsg, versionString })
|
|
process.exit(1)
|
|
}
|
|
}
|
|
|
|
checkIsRelease()
|