Skip to content

[FSSDK-12881] NPM to GPR backfill + release workflow update#1168

Open
junaed-optimizely wants to merge 2 commits into
masterfrom
junaed/fssdk-12881-ghr-workflow-adjustmet
Open

[FSSDK-12881] NPM to GPR backfill + release workflow update#1168
junaed-optimizely wants to merge 2 commits into
masterfrom
junaed/fssdk-12881-ghr-workflow-adjustmet

Conversation

@junaed-optimizely

Copy link
Copy Markdown
Contributor

Summary

Today we publish @optimizely/optimizely-sdk only 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

  • scripts/publish.sh (new) — registry-agnostic, idempotent publisher: publish.sh . Skips (no-op) if the version already exists on the target registry, supports DRY_RUN, publishes the prebuilt tarball with --ignore-scripts. The tag is passed in, so all tag logic stays in the workflow.
  • .github/workflows/release.yml (rewritten) — single publish job now builds/tests once, npm packs a single tarball, and publishes that same artifact to npm and GPR (byte-identical). Existing latest / v{major}-latest / beta/alpha/rc tag logic and the workflow_dispatch dry-run are preserved. Adds packages: write + GPR .npmrc auth; removes unused BROWSERSTACK_* env.
  • .github/workflows/ghr_backfill.yml (new) — manual workflow (inputs: version, dry_run) that packs each npm version and republishes it to GPR. Applies each version's current npm dist-tag (falls back to imported), so backfilling old versions never moves GPR's latest. Idempotent/re-runnable.

Test plan

Existing tests should pass

Issues

  • FSSDK-12881

Comment thread .github/workflows/ghr_backfill.yml
@coveralls

coveralls commented Jul 15, 2026

Copy link
Copy Markdown

Coverage Status

coverage: 77.725%. remained the same — junaed/fssdk-12881-ghr-workflow-adjustmet into master

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.sh to 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 thread .github/workflows/ghr_backfill.yml

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

Comment thread scripts/publish.sh
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants