Skip to content

chore: set up release-please and trusted publishing - #39685

Open
pieh wants to merge 2 commits into
release-please/1b-no-changelog-in-tarballsfrom
release-please/2-setup
Open

pieh wants to merge 2 commits into
release-please/1b-no-changelog-in-tarballsfrom
release-please/2-setup

Conversation

@pieh

@pieh pieh commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Description

Relies on #39684

Documentation

Tests

Related Issues

@pieh
pieh added this pull request to stack #39686 September 11, 2026 10:29
@gatsbot gatsbot Bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Sep 11, 2026
@pieh
pieh force-pushed the release-please/2-setup branch from b644fad to d5b94d7 Compare September 11, 2026 11:53
@pieh pieh changed the title chore: set up release-please chore: set up release-please and trusted publishing Sep 11, 2026
{
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
"bootstrap-sha": "aea34d80b48583f36894eae89de0b90581201c6b",
"last-release-sha": "aea34d80b48583f36894eae89de0b90581201c6b",

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

last-release-sha only needed for very first publish - will need to remove this later

@pieh pieh removed the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Sep 11, 2026
Comment on lines +109 to +121
// No package has its own LICENSE - lerna copied the root one into each package
// directory for the duration of the pack, so every published tarball has one.
// Keep doing that: npm includes LICENSE regardless of `files`/.npmignore.
function withRootLicenses(packages) {
const source = path.join(rootPath, `LICENSE`)
const copied = packages
.map(pkg => path.join(pkg.location, `LICENSE`))
.filter(target => !fs.existsSync(target))

copied.forEach(target => fs.copyFileSync(source, target))

return () => copied.forEach(target => fs.rmSync(target, { force: true }))
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this preserve handling that lerna publish was doing automatically. Without it move to npm publish would stop including LICENSE in released packages

Comment on lines +63 to +92
async function isPublished({ name, version }, attempt = 1) {
try {
const { stdout } = await run(`npm`, [
`view`,
`${name}@${version}`,
`version`,
])
// Some npm versions answer an unknown version with an empty success
// rather than an error
return stdout.trim() !== ``
} catch (error) {
const output = `${error.stdout || ``}${error.stderr || ``}`
const isMissing =
output.includes(`E404`) ||
output.includes(`No match found`) ||
output.includes(`is not in this registry`)

if (isMissing) {
return false
}
if (attempt < REGISTRY_ATTEMPTS) {
console.log(` ${name}@${version}: lookup failed, retrying (${attempt})`)
await delay(attempt * 1000)
return isPublished({ name, version }, attempt + 1)
}
throw new Error(
`Could not determine whether ${name}@${version} is published:\n${output}`
)
}
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is replacement for lerna's --from-package (skip trying to publish version that already is on npm)

Comment thread .prettierignore
Comment on lines +35 to +37

# changelogs are generated by release-please, which formats them its own way
packages/*/CHANGELOG.md

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CHANGELOG.md additions produced by release-please fail prettier, but as they are generated and not hand-written, it seems best to avoid linting them (instead of trying to format them after release-please which gets complicated and the more straight forward setup is the better)

@pieh
pieh marked this pull request as ready for review September 11, 2026 14:04
@pieh
pieh force-pushed the release-please/2-setup branch from d5b94d7 to 79d0ad6 Compare September 14, 2026 19:40
@pieh
pieh removed this pull request from stack #39686 September 14, 2026 19:42
@pieh
pieh changed the base branch from release-please/1-reset-package-versions to release-please/1b-no-changelog-in-tarballs September 14, 2026 19:43
@pieh
pieh added this pull request to stack #39692 September 14, 2026 19:43
@pieh
pieh force-pushed the release-please/2-setup branch from 79d0ad6 to a781c98 Compare September 14, 2026 19:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant