chore: add npm publish workflow and release script#499
Merged
Conversation
- GitHub Actions workflow publishes all packages to npm on `v*` tag push (requires NPM_TOKEN secret) - scripts/release.sh bumps versions across all packages, commits, and creates the tag Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds automated release tooling for the monorepo: a shell script to bump versions/tag releases, and a GitHub Actions workflow to publish workspace packages to npm on v* tags.
Changes:
- Added
scripts/release.shto bump versions across the 5 publishable packages, commit, and create av<version>tag. - Added
.github/workflows/publish.ymlto build and publish the 5 packages to npm when av*tag is pushed.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
scripts/release.sh |
Automates version bumping + tagging for the 5 publishable packages. |
.github/workflows/publish.yml |
CI workflow that installs/builds and publishes all packages to npm on tag push. |
Comments suppressed due to low confidence (3)
scripts/release.sh:25
- The release script only updates inter-package version pins in
dependencies, but the workspace packages currently pingl-reactindevDependencies(e.g. gl-react-dom/expo/headless/native). After a release bump, these devDependency pins will stay on the old version, which can lead to inconsistent local builds/tests and future diffs. Consider updating the same pins indevDependenciesas well (and any other sections you expect to carry a version range, such asoptionalDependencies).
if (d.dependencies) {
if (d.dependencies['gl-react']) d.dependencies['gl-react'] = '^$VERSION';
if (d.dependencies['gl-react-expo']) d.dependencies['gl-react-expo'] = '^$VERSION';
}
fs.writeFileSync(p, JSON.stringify(d, null, 2) + '\n');
scripts/release.sh:13
- This script tags and commits without verifying the working tree is clean. If the caller has unrelated local changes, they’ll be included in the release commit/tag unintentionally. Consider adding an early guard (e.g. fail if
git diff/git diff --cachedis non-empty) before mutating package.json files.
cd $(dirname $0)/..
PACKAGES="packages/gl-react packages/gl-react-dom packages/gl-react-expo packages/gl-react-headless packages/gl-react-native"
scripts/release.sh:11
cd $(dirname $0)/..is unquoted, which can break if the repo path contains spaces or special characters. Quoting$0and the command substitution (or using a more robust script-dir pattern) would make the script safer to run in more environments.
cd $(dirname $0)/..
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+4
to
+9
| VERSION=$1 | ||
| if [ -z "$VERSION" ]; then | ||
| echo "Usage: $0 <version>" | ||
| echo "Example: $0 5.3.0" | ||
| exit 1 | ||
| fi |
Comment on lines
+1
to
+12
| name: Publish to npm | ||
|
|
||
| on: | ||
| push: | ||
| tags: | ||
| - 'v*' | ||
|
|
||
| jobs: | ||
| publish: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 |
No NPM_TOKEN secret needed — npm verifies trust via OIDC. Uses npm publish directly (Yarn 4 doesn't support OIDC) with --provenance. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Also bump gl-react pin in devDependencies (where it actually lives) - Guard against uncommitted changes before mutating package.json files - Quote dirname path to handle spaces in repo path Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
.github/workflows/publish.yml: publishes all 5 packages to npm automatically when av*tag is pushed, using npm's Trusted Publishers (OIDC) — no secrets neededscripts/release.sh: bumps versions across all packages (includingdevDependencies), guards against dirty working tree, commits, and creates the git tagSetup (one-time, already done)
Configure Trusted Publishers on npmjs.com for each of the 5 packages (
gl-react,gl-react-dom,gl-react-expo,gl-react-headless,gl-react-native):gre/ Repository:gl-react/ Workflow:publish.ymlHow to release
The workflow triggers on the tag push, builds, and publishes all 5 packages with provenance attestation.
🤖 Generated with Claude Code