Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Changesets in graphql-js

This repo uses Changesets to manage version bumps and release PR automation.

## Contributor flow

1. Add a changeset file when the PR should affect a published package:
- `npm run changeset`
- Choose `patch`, `minor`, or `major` for `graphql`
2. Commit the generated `.changeset/*.md` file.

## Release lines

Changesets automation is currently enabled only on `17.x.x`.
11 changes: 11 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/config@3.0.0/schema.json",
"changelog": false,
"commit": false,
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "17.x.x",
"updateInternalDependencies": "patch",
"ignore": []
}
8 changes: 8 additions & 0 deletions .changeset/pre.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"mode": "pre",
"tag": "alpha",
"initialVersions": {
"graphql": "17.0.0-alpha.10"
},
"changesets": []
}
5 changes: 5 additions & 0 deletions .changeset/wacky-streets-obey.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'graphql': patch
---

Add changesets to 17.x.x alpha
27 changes: 5 additions & 22 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,28 +86,11 @@ Feel free to reach out via the [graphql-js channel](https://discord.com/channels

## Release on NPM

_Only core contributors may release to NPM._

To release a new version on NPM, first ensure all tests pass with `npm test`,
then use `npm version patch|minor|major` in order to increment the version in
package.json and tag and commit a release. Then `git push && git push --tags`
to sync this change with source control. Then `npm publish npmDist` to actually
publish the release to NPM.
Once published, add [release notes](https://github.com/graphql/graphql-js/releases).
Use [semver](https://semver.org/) to determine which version part to increment.

Example for a patch release:

```sh
npm ci
npm test
npm version patch --ignore-scripts=false
git push --follow-tags
cd npmDist && npm publish
npm run changelog
```

Then upload the changelog to [https://github.com/graphql/graphql-js/releases](https://github.com/graphql/graphql-js/releases).
Releases are managed by Changesets and GitHub Actions:

- Contributors add changesets in PRs (`npm run changeset`) for user-facing changes.
- Changesets release automation is currently enabled only on `17.x.x`.
- Merging the release PR triggers publish to NPM.

## License

Expand Down
45 changes: 45 additions & 0 deletions .github/workflows/changesets.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Changesets
on:
push:
branches:
- 17.x.x
workflow_dispatch:
permissions: {}
jobs:
release:
name: Create release PR or publish
if: ${{ !github.event.repository.fork && github.ref_name == '17.x.x' }}
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}
cancel-in-progress: true
permissions:
contents: write # for changesets action to commit/tag
pull-requests: write # for changesets action to create/update release PR
id-token: write # for npm trusted publishing via OIDC
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false

- name: Setup Node.js
uses: actions/setup-node@v4
with:
cache: npm
node-version-file: '.node-version'

- name: Install Dependencies
run: npm ci --ignore-scripts

- name: Run Changesets
uses: changesets/action@v1
with:
title: 'chore(release): version packages'
commit: 'chore(release): version packages'
version: npm run release:version
publish: npm run release:publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_CONFIG_PROVENANCE: true
Loading
Loading