Skip to content

Commit 0b1e915

Browse files
Add Changesets for per-package versioning and npm publish
- Install @changesets/cli and @changesets/changelog-github - .changeset/config.json: public access, GitHub changelog, ignore private packages (monorepo root and gov-components) - release.yml: replace tag-triggered publish with Changesets action — on every push to main it either opens a "Version Packages" PR (when changesets are pending) or publishes to npm (when that PR is merged) - package.json: add changeset / version-packages / release convenience scripts Contributor workflow: 1. npx changeset → pick packages + semver bump → commit the .md file 2. Changesets bot opens Version PR bumping package.json versions 3. Merge Version PR → CI publishes only the changed packages Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent de5b2bc commit 0b1e915

5 files changed

Lines changed: 1170 additions & 45 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.4/schema.json",
3+
"changelog": ["@changesets/changelog-github", { "repo": "SFDC-Assets/gps-design-systems-react" }],
4+
"commit": false,
5+
"fixed": [],
6+
"linked": [],
7+
"access": "public",
8+
"baseBranch": "main",
9+
"updateInternalDependencies": "patch",
10+
"ignore": ["@sfgps-ds/monorepo", "@gov-ido/gov-components"]
11+
}

.github/workflows/release.yml

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,20 @@ name: Release
22

33
on:
44
push:
5-
tags:
6-
- 'v*'
5+
branches: [main]
76

87
jobs:
98
release:
10-
name: Publish to npm
9+
name: Publish changed packages
1110
runs-on: ubuntu-latest
1211
permissions:
13-
contents: read
12+
contents: write
13+
pull-requests: write
1414

1515
steps:
1616
- uses: actions/checkout@9f698171ed81b15d1823a05fc7211befd50c8ae0 # v6.0.3
1717
with:
18+
fetch-depth: 0
1819
token: ${{ secrets.GH_PAT != '' && secrets.GH_PAT || github.token }}
1920
persist-credentials: false
2021

@@ -43,7 +44,13 @@ jobs:
4344
- name: Test (react-bridge)
4445
run: npm run test --workspace=packages/react-bridge
4546

46-
- name: Publish
47-
run: npm publish --workspace=packages/react-uswds --access public
47+
- name: Create Version PR or publish
48+
id: changesets
49+
uses: changesets/action@v1
50+
with:
51+
publish: npx changeset publish
52+
title: 'chore: version packages'
53+
commit: 'chore: version packages'
4854
env:
55+
GITHUB_TOKEN: ${{ secrets.GH_PAT != '' && secrets.GH_PAT || github.token }}
4956
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)