fix: make GitHub releases canonical for release-please (#295)
This commit is contained in:
@@ -1,33 +0,0 @@
|
||||
#!/usr/bin/env bun
|
||||
import { updateRootChangelog } from "../../src/release/metadata"
|
||||
import type { ReleaseComponent } from "../../src/release/types"
|
||||
|
||||
type EntryInput = {
|
||||
component: ReleaseComponent
|
||||
version: string
|
||||
date: string
|
||||
sections: Record<string, string[]>
|
||||
}
|
||||
|
||||
function parseEntries(argv: string[]): EntryInput[] {
|
||||
const jsonIndex = argv.findIndex((arg) => arg === "--entries")
|
||||
if (jsonIndex === -1) return []
|
||||
const raw = argv[jsonIndex + 1]
|
||||
if (!raw) return []
|
||||
return JSON.parse(raw) as EntryInput[]
|
||||
}
|
||||
|
||||
const write = process.argv.includes("--write")
|
||||
const entries = parseEntries(process.argv.slice(2))
|
||||
|
||||
if (entries.length === 0) {
|
||||
console.error("No changelog entries provided. Pass --entries '<json>'.")
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
const result = await updateRootChangelog({
|
||||
entries,
|
||||
write,
|
||||
})
|
||||
|
||||
console.log(`${result.changed ? "update" : "keep"} ${result.path}`)
|
||||
@@ -1,16 +1,32 @@
|
||||
#!/usr/bin/env bun
|
||||
import path from "path"
|
||||
import { validateReleasePleaseConfig } from "../../src/release/config"
|
||||
import { syncReleaseMetadata } from "../../src/release/metadata"
|
||||
import { readJson } from "../../src/utils/files"
|
||||
|
||||
const releasePleaseConfig = await readJson<{ packages: Record<string, unknown> }>(
|
||||
path.join(process.cwd(), ".github", "release-please-config.json"),
|
||||
)
|
||||
const configErrors = validateReleasePleaseConfig(releasePleaseConfig)
|
||||
const result = await syncReleaseMetadata({ write: false })
|
||||
const changed = result.updates.filter((update) => update.changed)
|
||||
|
||||
if (changed.length === 0) {
|
||||
if (configErrors.length === 0 && changed.length === 0) {
|
||||
console.log("Release metadata is in sync.")
|
||||
process.exit(0)
|
||||
}
|
||||
|
||||
console.error("Release metadata drift detected:")
|
||||
for (const update of changed) {
|
||||
console.error(`- ${update.path}`)
|
||||
if (configErrors.length > 0) {
|
||||
console.error("Release configuration errors detected:")
|
||||
for (const error of configErrors) {
|
||||
console.error(`- ${error}`)
|
||||
}
|
||||
}
|
||||
|
||||
if (changed.length > 0) {
|
||||
console.error("Release metadata drift detected:")
|
||||
for (const update of changed) {
|
||||
console.error(`- ${update.path}`)
|
||||
}
|
||||
}
|
||||
process.exit(1)
|
||||
|
||||
Reference in New Issue
Block a user