[FSSDK-12882] release pipeline update#343
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the @optimizely/react-sdk release tooling to make publishing repeatable across both npm and GitHub Package Registry (GHR) by introducing a shared, idempotent publish script, splitting the release workflow into separate npm/GHR jobs, and adding a manual backfill workflow for populating historical versions into GHR from npm tarballs.
Changes:
- Added
scripts/publish.shto publish idempotently to a specified registry and compute the correct dist-tag from the version. - Refactored the release workflow to publish to npm and GHR in separate jobs using the shared publish script.
- Added a manual backfill workflow to republish npm tarballs into GHR (with optional dry-run).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| scripts/publish.sh | New registry-agnostic publish helper with version-exists guard and dist-tag selection. |
| .github/workflows/react_release.yml | Splits release publishing into npm and GHR jobs, both calling the shared publish script. |
| .github/workflows/ghr_backfill.yml | Adds manual workflow to backfill versions from npm into GHR using packed tarballs and the publish script. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| *) tag=latest ;; | ||
| esac | ||
|
|
||
| if npm view "${pkg}@${version}" version --registry "$registry" >/dev/null 2>&1; then |
There was a problem hiding this comment.
npm the npm view command fails for any reason (like network error) other than the package not existing, it will assume the package does not exists and will continue. Can we make this check more robust?
There was a problem hiding this comment.
like calling the api directly to fetch version data?
| *-beta*) tag=beta ;; | ||
| *-alpha*) tag=alpha ;; | ||
| *-rc*) tag=rc ;; | ||
| *) tag=latest ;; |
There was a problem hiding this comment.
this tag should be set to latest only if the published version is strictly greater than the latest published version. We should cover the cases where a patch is released for a previous minor of the latest major, like so: current latest: 6.5.0, but we are releasing say 6.4.1. We don't face such cases normally but would be good to cover
| current_latest=$(npm view "${pkg}" version --registry "$registry" 2>/dev/null || true) | ||
| our_major=${version%%.*} | ||
| latest_major=${current_latest%%.*} | ||
| if [[ "$our_major" =~ ^[0-9]+$ && "$latest_major" =~ ^[0-9]+$ ]] && (( our_major < latest_major )); then |
There was a problem hiding this comment.
the tag should be set to latest only if the version being published is strictly greater than the latest published version. We should cover the cases where a patch is released for a previous minor of the latest major, like so: current latest: 6.5.0, but we are releasing say 6.4.1. We don't face such cases normally but would be good to cover
Summary
Adds GitHub Package Registry (GHR) publishing alongside the existing npm release, and a way to backfill historical versions to GHR.
Changes
Recovery
Test plan
Existing tests should pass
Issues