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
10 changes: 10 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Changesets

Run `yarn changeset` after changing a publishable package.

Choose the packages that changed, select the appropriate semver bump, and write a short summary for users.

When the PR merges to `main`, the release workflow will either:

- open or update a `Version Packages` PR if there are pending changesets
- publish to npm once that version PR is merged
20 changes: 20 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"$schema": "https://unpkg.com/@changesets/config@3.1.1/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": [
"@reflag/eslint-config",
"@reflag/tsconfig",
"customer-admin-panel",
"nextjs-bootstrap-demo",
"nextjs-flag-demo",
"nextjs-openfeature-example",
"reflag-react-native-sdk-bare-rn",
"reflag-react-sdk-expo"
]
}
4 changes: 4 additions & 0 deletions .changeset/fair-badgers-move.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
---

Document the repository's migration to Changesets-managed releases.
37 changes: 19 additions & 18 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
name: Publish updated packages
name: Release packages

on:
push:
branches:
- main

concurrency: ${{ github.workflow }}-${{ github.ref }}

jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: read
contents: write
id-token: write
pull-requests: write
steps:
- uses: actions/checkout@v4
# Setup .npmrc file to publish to npm
- name: Enable corepack
run: corepack enable
- uses: actions/setup-node@v6
Expand All @@ -25,34 +27,33 @@ jobs:
scope: "@reflag"
- name: Install dependencies
run: yarn install --immutable
- name: Build packages
run: yarn build
- name: Publish
run: |
yarn lerna list --since --parseable --no-private | while read -r pkg; do
name=$(node -p "require('$pkg/package.json').name")
version=$(node -p "require('$pkg/package.json').version")
published=$(npm view "$name" version --json 2>/dev/null || echo "")
if [ "$published" = "\"$version\"" ]; then
echo "SKIP $name@$version"
else
echo "PUBLISH $name@$version (registry has $published)"
(cd "$pkg" && npm publish --access public --provenance)
fi
done
- name: Create release PR or publish packages
id: changesets
uses: changesets/action@v1
with:
version: yarn version-packages
publish: yarn build && yarn release
title: Version Packages
commit: Version Packages
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Build docs
if: steps.changesets.outputs.published == 'true'
run: yarn docs
- name: Checkout docs with SSH
if: steps.changesets.outputs.published == 'true'
uses: actions/checkout@v3
with:
repository: reflagcom/docs
ssh-key: ${{ secrets.DOCS_DEPLOY_KEY }}
path: reflag-docs
- name: Copy generated docs to docs repo
if: steps.changesets.outputs.published == 'true'
run: |
rm -rf reflag-docs/sdk
cp -R dist/docs reflag-docs/sdk
- name: Commit and push changes
if: steps.changesets.outputs.published == 'true'
run: |
cd reflag-docs
git config user.name "github-actions[bot]"
Expand Down
19 changes: 16 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,22 @@ Use the Reflag with OpenFeature on the server in Node.js through the Reflag Open
### Versioning

1. Create a new branch locally
2. Run `yarn run version`
3. Push and PR
2. Run `yarn changeset`
3. Select the packages that changed and the correct bump type
4. Commit the generated file in `.changeset/`
5. Push and open a PR

### Publishing

The [Github Action](.github/workflows/publish.yml) will automatically publish any versioned packages when merging to `main`
Repository setup:

1. Configure npm Trusted Publisher entries for the packages in this repo against the `reflagcom/javascript` GitHub repository and the `publish.yml` workflow
2. Keep the workflow on GitHub-hosted runners with `id-token: write`, plus `contents: write` and `pull-requests: write` for the release PR flow

When a PR with one or more changesets is merged to `main`, the release workflow will open or update a `Version Packages` PR.

Merging that PR will:

1. Apply the version bumps
2. Publish the updated packages to npm
3. Rebuild and push the generated SDK docs
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"packages/openfeature-browser-provider/example"
],
"scripts": {
"changeset": "changeset",
"dev": "lerna run dev --parallel",
"build": "lerna run build --stream",
"test:ci": "lerna run test:ci --stream",
Expand All @@ -20,11 +21,13 @@
"prettier:fix": "lerna run prettier -- --write",
"lint": "lerna run lint --stream",
"lint:ci": "lerna run lint:ci --stream",
"version": "lerna version --exact --no-push",
"version-packages": "changeset version",
"release": "changeset publish",
"docs": "./docs.sh"
},
"packageManager": "yarn@4.10.3",
"devDependencies": {
"@changesets/cli": "^2.29.6",
"lerna": "^8.1.3",
"prettier": "^3.5.2",
"react": "19.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/openfeature-node-provider/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"vitest": "~1.6.0"
},
"dependencies": {
"@reflag/node-sdk": "1.1.0"
"@reflag/node-sdk": "1.2.0"
},
"peerDependencies": {
"@openfeature/server-sdk": ">=1.16.1"
Expand Down
Loading
Loading