[FSSDK-12881] NPM to GPR backfill + release workflow update#1168
Open
junaed-optimizely wants to merge 2 commits into
Open
[FSSDK-12881] NPM to GPR backfill + release workflow update#1168junaed-optimizely wants to merge 2 commits into
junaed-optimizely wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR extends the JS SDK release pipeline so each release is published to both npm and the GitHub Package Registry (GPR), and adds a manual workflow to backfill historical npm versions into GPR for parity.
Changes:
- Added a registry-agnostic
scripts/publish.shto publish a prebuilt tarball idempotently (skip if version already exists). - Updated the release workflow to build/test/pack once and publish the same tarball to both npm and GPR.
- Added a manual backfill workflow to pack existing versions from npm and republish them to GPR with appropriate dist-tags.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| scripts/publish.sh | New idempotent tarball publisher used by both release and backfill workflows. |
| .github/workflows/release.yml | Packs once and publishes the identical artifact to npm + GPR with per-step auth. |
| .github/workflows/ghr_backfill.yml | New manual workflow to backfill npm history into GPR. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+36
to
+41
| set -euo pipefail | ||
|
|
||
| registry="${1:?usage: publish.sh <registry-url> <tarball> <dist-tag>}" | ||
| tarball="${2:?usage: publish.sh <registry-url> <tarball> <dist-tag>}" | ||
| tag="${3:?usage: publish.sh <registry-url> <tarball> <dist-tag>}" | ||
| dry_run="${DRY_RUN:-false}" |
Comment on lines
+69
to
+86
| # Read npm's current dist-tags once and build a version -> tag map, so | ||
| # each backfilled version lands under the same tag it has on npm. | ||
| # `npm dist-tag ls` prints "tag: version" lines. Anything not currently | ||
| # tagged falls back to "imported" (a neutral tag that never moves latest). | ||
| dist_tags_json=$(npm dist-tag ls "$pkg" --registry "$npm_registry" \ | ||
| | jq -R -s 'split("\n") | map(select(length > 0) | split(": ")) | map({(.[1]): .[0]}) | add // {}') | ||
|
|
||
| for v in $versions; do | ||
| echo "::group::${pkg}@${v}" | ||
| tag=$(printf '%s' "$dist_tags_json" | jq -r --arg v "$v" '.[$v] // "imported"') | ||
| # npm pack writes the tarball filename to stdout and notices/errors to | ||
| # stderr; keep stderr visible so pack failures (auth/404/network) show | ||
| # in the logs. pipefail (set above) makes a failed pack abort the job. | ||
| tarball=$(npm pack "${pkg}@${v}" --registry "$npm_registry" | tail -n1) | ||
| scripts/publish.sh "$gpr_registry" "$tarball" "$tag" | ||
| rm -f "$tarball" | ||
| echo "::endgroup::" | ||
| done |
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
Today we publish
@optimizely/optimizely-sdkonly to npm. This change publishes every release to both npm and the GitHub Package Registry (GPR), and adds a manual workflow to backfill existing npm versions into GPR so it mirrors npm's full history.Changes
Test plan
Existing tests should pass
Issues