Skip to content

Commit c2b6d64

Browse files
CopilotTylerJDev
andauthored
Add Changesets-based release tracking flow
Co-authored-by: TylerJDev <26746305+TylerJDev@users.noreply.github.com>
1 parent 8e7fe2a commit c2b6d64

10 files changed

Lines changed: 1474 additions & 118 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.0.0/schema.json",
3+
"changelog": ["@changesets/changelog-github", {"repo": "github/remote-input-element"}],
4+
"commit": false,
5+
"fixed": [],
6+
"linked": [],
7+
"access": "public",
8+
"baseBranch": "main",
9+
"updateInternalDependencies": "patch",
10+
"ignore": []
11+
}

.github/workflows/pr.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,5 @@ jobs:
2424
run: npm run build
2525
- name: Run test
2626
run: npm run test
27+
- name: Run release script tests
28+
run: npm run test:release-script

.github/workflows/publish.yml

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

.github/workflows/release.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch: {}
8+
9+
concurrency: ${{ github.workflow }}-${{ github.ref }}
10+
11+
permissions:
12+
contents: write
13+
pull-requests: write
14+
id-token: write
15+
16+
jobs:
17+
release:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v4
21+
with:
22+
# Full history and tags are required so the release-preparation
23+
# script can compare against the previous release tag.
24+
fetch-depth: 0
25+
26+
- uses: actions/setup-node@v4
27+
with:
28+
node-version: 18
29+
registry-url: https://registry.npmjs.org
30+
31+
- name: Install dependencies
32+
run: npm ci
33+
34+
- name: Run tests
35+
run: npm test
36+
37+
- name: Prepare release (synthetic changeset for unreleased changes)
38+
run: npm run prepare-release
39+
40+
- name: Create release pull request or publish
41+
uses: changesets/action@v2
42+
with:
43+
title: 'Release: version packages'
44+
commit: 'chore: version packages'
45+
publish: npm run release
46+
env:
47+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,15 @@ npm install
7171
npm test
7272
```
7373

74+
## Releasing
75+
76+
This project uses [Changesets](https://github.com/changesets/changesets) to manage versioning, changelogs, and publishing to npm.
77+
78+
- **Explicit changesets**: When you make a user-facing change, run `npx changeset` and follow the prompts to describe the change and pick a bump type (`patch`, `minor`, or `major`). Commit the generated file in `.changeset/`. Explicit changesets always take precedence over the automatic behavior described below.
79+
- **Automatic patch releases**: Many merges (for example, Dependabot dependency bumps) don't come with a changeset. The [`release` workflow](.github/workflows/release.yml) runs `scripts/prepare-release.mjs` before invoking `changesets/action`. If no explicit changeset exists, but there are commits merged since the last published release tag, it generates a single synthetic `patch` changeset summarizing those commits (linking pull request numbers when available) so a release PR still gets opened.
80+
- **Release pull request**: On every push to `main` (or a manual run via `workflow_dispatch`), the workflow opens or updates a "Release: version packages" pull request with the version bump and changelog entry. Merging that pull request triggers the same workflow again, which publishes the new version to npm (with [provenance](https://docs.npmjs.com/generating-provenance-statements)) and to GitHub Packages, and creates the matching git tag.
81+
- **Manual runs**: Use the "Run workflow" button on the `Release` workflow in the Actions tab (`workflow_dispatch`) at any time to regenerate or refresh the release pull request without waiting for a push to `main`.
82+
7483
## License
7584

7685
Distributed under the MIT license. See LICENSE for details.

0 commit comments

Comments
 (0)