Skip to content

Commit 9c54e66

Browse files
chore: update our release process
1 parent 3249e78 commit 9c54e66

10 files changed

Lines changed: 169 additions & 1438 deletions

File tree

.changeset/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Changesets
2+
3+
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
4+
with multi-package repos, or single-package repos to help you version and publish your code. You can
5+
find the full documentation for it [in our repository](https://github.com/changesets/changesets)
6+
7+
We have a quick list of common questions to get you started engaging with this project in
8+
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)

.changeset/config.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"$schema": "https://unpkg.com/@changesets/config@3.1.1/schema.json",
3+
"changelog": "@changesets/cli/changelog",
4+
"commit": false,
5+
"fixed": [],
6+
"linked": [],
7+
"access": "public",
8+
"baseBranch": "main",
9+
"updateInternalDependencies": "patch",
10+
"ignore": []
11+
}

.changeset/ten-terms-rescue.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"h2m-parser": minor
3+
---
4+
5+
Fast HTML to Markdown converter with Mozilla Readability extraction, streaming renderer, and LLM-ready output. 3.75x faster than alternatives

.github/workflows/publish-tag.yml

Lines changed: 0 additions & 61 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ jobs:
1717
release:
1818
name: Release
1919
runs-on: ubuntu-latest
20+
environment:
21+
name: release
22+
url: https://www.npmjs.com/package/@lgtm/htmltomd
2023
steps:
2124
- name: Checkout
2225
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 #v5.0.0
@@ -35,6 +38,7 @@ jobs:
3538
node-version: 20
3639
cache: 'pnpm'
3740
registry-url: 'https://registry.npmjs.org'
41+
always-auth: true
3842

3943
- name: Install dependencies
4044
run: pnpm install --frozen-lockfile
@@ -57,7 +61,6 @@ jobs:
5761
createGithubReleases: true
5862
env:
5963
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
60-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN || '' }} # TODO: remove when OIDC is configured
6164

6265
- name: Publish notification
6366
if: steps.changesets.outputs.published == 'true'

.gitignore

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@ node_modules
22
.DS_Store
33
dist
44
coverage
5-
.results
65
.bench
7-
bench/.results
86
bench/output
97
fixtures/
108
.vscode
@@ -13,9 +11,6 @@ fixtures/
1311
.env*
1412
.nyc_output
1513

16-
# Changeset state
17-
.changeset
18-
1914
# TypeDoc generated documentation
2015
docs/api
2116
docs/api-markdown

CONTRIBUTING.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Thanks for your interest in improving h2m-parser! Keeping cognitive load low is
2121

2222
- Husky runs `lint-staged` to format/lint staged files. Make sure your commits are clean.
2323
- Use [Changesets](https://github.com/changesets/changesets) for release notes. After feature work, run `pnpm changeset` to document changes and version bumps.
24+
- When the release PR opens, review the changelog and, after merging, approve the pending run in the `release` environment to publish.
2425
- CI runs `pnpm lint`, `pnpm typecheck`, `pnpm test`, and `pnpm build`. Keep the `verify` script green locally before pushing.
2526

2627
## Reporting issues

docs/RELEASE.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Release Process
2+
3+
This guide explains how we publish `@lgtm/htmltomd` with Changesets, GitHub Actions, and npm trusted publishing.
4+
5+
## What we use
6+
7+
- **Changesets** to stage version bumps and changelog entries.
8+
- A single workflow, `.github/workflows/release.yml`, that both opens the release PR and publishes packages.
9+
- An npm trusted publisher binding that issues ephemeral credentials through GitHub's OIDC provider.
10+
- A GitHub environment named `release` that gates real publishes (require your approval before jobs run).
11+
12+
## One-time setup (already completed)
13+
14+
1. **Seed npm** – publish the very first version manually (`npm publish --tag alpha --access public`) so the package name exists.
15+
2. **Configure trusted publishing** – on npm go to *Access → Add trusted publisher* and point it at `gustavovalverde/htmltomd`, workflow `.github/workflows/release.yml`, environment `release`.
16+
3. **Create the GitHub environment** – in the repo settings add an environment called `release`, add yourself as a required reviewer, and optionally set the URL to `https://www.npmjs.com/package/@lgtm/htmltomd`.
17+
18+
With that in place the workflow no longer needs an `NPM_TOKEN`; it exchanges an id-token for publish credentials automatically.
19+
20+
## Normal release flow
21+
22+
1. **Author changesets** – whenever a PR needs a release entry run `pnpm changeset` and commit the generated file under `.changeset/`.
23+
2. **Merge feature PRs** – once on `main`, the release workflow opens/updates a `chore(release): version packages` PR with the aggregated changelog.
24+
3. **Review the release PR** – check the generated CHANGELOG and version bumps. When happy, merge it.
25+
4. **Approve the publish run** – the merge triggers the `release` job; approve the pending run in the *Actions* tab (required reviewer on the `release` environment). The job builds, tests, publishes via Changesets, and creates the GitHub release notes.
26+
5. **Verify** – confirm the new version on npm (`npm view @lgtm/htmltomd version`) and skim the release notes.
27+
28+
## Manual triggers
29+
30+
Need to kick a release outside of an automatic merge? Use **Actions → Release → Run workflow**, choose the branch, and approve the run when prompted. The workflow handles the rest.
31+
32+
## Troubleshooting
33+
34+
- *Publish fails with auth errors*: confirm the npm trusted publisher entry still points at `.github/workflows/release.yml` and the `release` environment exists. Re-run the job after fixing.
35+
- *No release PR appears*: make sure there is at least one unpublished changeset file on `main`; otherwise the workflow exits early. You can run it manually via `workflow_dispatch`.
36+
- *Need to bypass automation*: as a last resort you can run `pnpm verify && pnpm build && npm publish --access public`, but follow up by re-running `pnpm changeset version` so history stays in sync.
37+
38+
## Retired workflows
39+
40+
We removed `.github/workflows/publish-tag.yml`; tag pushes no longer publish separately. Keep releases flowing through the single Changesets-driven workflow to avoid duplicate logic.

0 commit comments

Comments
 (0)