Skip to content

Commit 58fd5e1

Browse files
authored
Merge pull request #1 from danger/test-pr
A test PR
2 parents f5507cc + 43e4a73 commit 58fd5e1

3 files changed

Lines changed: 1800 additions & 840 deletions

File tree

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
node_modules
22
dist
3+
.yarn/*
4+
!.yarn/patches
5+
!.yarn/plugins

scripts/release.ts

Lines changed: 9 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,15 @@
44
* Release script for risk.
55
*
66
* Usage:
7-
* node --experimental-strip-types scripts/release.ts <patch|minor|major>
7+
* yarn release <patch|minor|major>
88
*
99
* What it does:
10-
* 1. Checks for clean working tree
10+
* 1. Checks for clean working tree on main
1111
* 2. Runs tests and typecheck
1212
* 3. Bumps version in package.json
13-
* 4. Extracts release notes from CHANGELOG.md
14-
* 5. Commits, tags, and pushes
15-
* 6. Creates a GitHub release with the changelog entry
16-
* 7. Publishes to npm
13+
* 4. Commits, tags, and pushes
14+
*
15+
* The publish.yml workflow handles the rest (GitHub release + npm publish).
1716
*/
1817

1918
import { execSync } from "node:child_process"
@@ -38,7 +37,7 @@ function die(msg: string): never {
3837

3938
const bump = process.argv[2] as "patch" | "minor" | "major" | undefined
4039
if (!bump || !["patch", "minor", "major"].includes(bump)) {
41-
console.log("Usage: scripts/release.ts <patch|minor|major>")
40+
console.log("Usage: yarn release <patch|minor|major>")
4241
process.exit(1)
4342
}
4443

@@ -55,10 +54,10 @@ if (branch !== "main") {
5554
}
5655

5756
console.log("Running tests...")
58-
run("npm test", { stdio: "inherit" })
57+
run("yarn test", { stdio: "inherit" })
5958

6059
console.log("Running typecheck...")
61-
run("npm run typecheck", { stdio: "inherit" })
60+
run("yarn typecheck", { stdio: "inherit" })
6261

6362
// --- Bump version ---
6463

@@ -76,24 +75,6 @@ pkg.version = newVersion
7675
writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + "\n")
7776
console.log(`\nVersion: ${oldVersion} -> ${newVersion}`)
7877

79-
// --- Extract changelog entry ---
80-
81-
const changelogPath = resolve(root, "CHANGELOG.md")
82-
const changelog = readFileSync(changelogPath, "utf-8")
83-
84-
// Find the section for the new version, fall back to the first section
85-
const sections = changelog.split(/^## /m).filter(Boolean)
86-
const currentSection = sections.find(s => s.startsWith(newVersion)) ?? sections[0]
87-
const releaseNotes = currentSection
88-
? currentSection.replace(/^\S+\s*\n/, "").trim() // Remove the version heading line
89-
: `Release ${newVersion}`
90-
91-
if (!currentSection?.startsWith(newVersion)) {
92-
console.log(`Warning: No CHANGELOG entry found for ${newVersion}, using first entry.`)
93-
}
94-
95-
console.log(`\nRelease notes:\n${releaseNotes}\n`)
96-
9778
// --- Commit, tag, push ---
9879

9980
const tag = `v${newVersion}`
@@ -103,17 +84,4 @@ run(`git commit -m "Release ${tag}"`)
10384
run(`git tag -a ${tag} -m "Release ${tag}"`)
10485
run(`git push origin main --follow-tags`)
10586

106-
console.log(`Pushed ${tag} to origin.`)
107-
108-
// --- GitHub release ---
109-
110-
console.log("Creating GitHub release...")
111-
const releaseBody = `## ${newVersion}\n\n${releaseNotes}`
112-
run(`gh release create ${tag} --title "${tag}" --notes ${JSON.stringify(releaseBody)}`)
113-
console.log(`GitHub release created: https://github.com/danger/risk/releases/tag/${tag}`)
114-
115-
// --- npm publish ---
116-
117-
console.log("Publishing to npm...")
118-
run("npm publish", { stdio: "inherit" })
119-
console.log(`\nPublished risk@${newVersion} to npm.`)
87+
console.log(`\nPushed ${tag} to origin. The publish workflow will handle the rest.`)

0 commit comments

Comments
 (0)