Skip to content

feat(ui-scripts): allow pr-snapshot to publish at an operator-supplied prerelease version#2556

Draft
balzss wants to merge 1 commit into
masterfrom
tagged-release
Draft

feat(ui-scripts): allow pr-snapshot to publish at an operator-supplied prerelease version#2556
balzss wants to merge 1 commit into
masterfrom
tagged-release

Conversation

@balzss

@balzss balzss commented May 12, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds optional custom_version + dist_tag inputs to the existing pr-snapshot release path. When set, an operator can publish an exact prerelease (e.g. 11.7.3-SECURITY.0) to npmjs under a non-latest tag. Blank inputs → behavior unchanged.

Plumbed through release_to_npm.yml_pr-release-reusable.ymlpublish.js as --customVersion / --distTag (passed via env:, not ${{ }}, to avoid shell injection).

Why

After a coordinated-disclosure fix ships privately as x.y.z-SECURITY.N, this mirrors that exact version onto npmjs under the security tag (never latest), so OSS consumers can re-resolve from the private registry without editing package.json.

Safety rails (validateCustomVersionInputs)

custom_version must be a valid semver prerelease (no stable slots); dist_tag can't be latest, is required with custom_version, and rejected alone; rejected on release commits. OIDC + --provenance unchanged.

Test Plan

Input validation — each should fail fast with the listed error

Run from a non-release commit: pnpm exec ui-scripts publish --prRelease <flags>

Flags Expected
--customVersion=not-semver --distTag=security ❌ not valid semver
--customVersion=11.7.4 --distTag=security ❌ must be a prerelease
--customVersion=11.7.3-SECURITY.0 --distTag required
--customVersion=11.7.3-SECURITY.0 --distTag=latest --distTag can't be latest
--distTag=security (no customVersion) --distTag only valid with --customVersion
any of the above on a release commit ❌ rejected (not supported for releases)
(no new flags) ✅ unchanged pr-snapshot behavior

End-to-end (reviewer sanity check)

  • Trigger release_to_npmpr-snapshot with custom_version=11.7.3-SECURITY.0, dist_tag=security on a test branch.
  • Confirm packages publish to npmjs at 11.7.3-SECURITY.0 under the security tag (npm view @instructure/ui-buttons dist-tags).
  • Confirm the latest dist-tag is unchanged.

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented May 12, 2026

Copy link
Copy Markdown
PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://instructure.design/pr-preview/pr-2556/

Built to branch gh-pages at 2026-06-24 12:37 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@github-actions

github-actions Bot commented May 12, 2026

Copy link
Copy Markdown

Visual regression report

No changes.

Status Count
Unchanged 32
Changed 0
New 0
Removed 0

📊 View full report

Baselines come from the visual-baselines branch. They refresh on every merge to master.

github-actions Bot pushed a commit that referenced this pull request May 12, 2026
@balzss balzss changed the title feat(ui-scripts): add tagged-release flow for exact prerelease publishes to npm feat(ui-scripts): allow pr-snapshot to publish at an operator-supplied prerelease version May 12, 2026
@balzss balzss self-assigned this May 12, 2026
…d prerelease version

Adds two optional inputs to the pr-snapshot workflow_dispatch path:
custom_version (e.g. 11.7.3-SECURITY.0) and dist_tag (e.g. security).
When set, they override the auto-computed snapshot version and the
default pr-snapshot dist-tag.

Use case: mirror a previously-published private security release onto
the public registry under a non-latest dist-tag, so open-source
consumers who pinned to a prerelease version from the private registry
can switch their resolution to npmjs without changing package.json.

Workflow plumbing:
  - release_to_npm.yml: two new optional inputs forwarded to the
    pr-release job
  - _pr-release-reusable.yml: accepts the inputs, validates them, and
    forwards as --customVersion / --distTag (via env vars to avoid
    shell-injection from workflow_dispatch input values)

publish.js:
  - new --customVersion / --distTag flags
  - publishSnapshotVersion uses customVersion when supplied, else
    falls back to calculateNextSnapshotVersion as today
  - validateCustomVersionInputs() enforces guards: valid semver,
    prerelease only (refuses stable versions so we can never take
    over a future stable slot), distTag not 'latest', distTag
    required when customVersion is set

Existing pr-snapshot behavior is unchanged when the new inputs are
blank. OIDC auth + --provenance preserved.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
github-actions Bot pushed a commit that referenced this pull request Jun 24, 2026
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.

1 participant