Skip to content

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

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

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 pr-snapshot release path so 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 release_to_npm.yml_pr-release-reusable.ymlpublish.ts as --customVersion / --distTag, passed via env: (not ${{ }}) to avoid shell injection.

Why

Mirrors a privately-shipped coordinated-disclosure fix (x.y.z-SECURITY.N) onto npmjs under the security tag so OSS consumers can re-resolve without editing package.json.

Safety rails

validateCustomVersionInputs rejects: non-prerelease / invalid semver, dist_tag=latest, custom_version without dist_tag (and vice-versa), and use on a release commit. OIDC + --provenance unchanged.

Testing

E2E: trigger pr-snapshot with custom_version=11.7.3-SECURITY.0, dist_tag=security on a test branch. Confirm packages publish under the security tag (npm view @instructure/ui-buttons dist-tags) and that latest 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
@balzss balzss marked this pull request as ready for review July 7, 2026 16:18
@balzss balzss requested a review from matyasf July 7, 2026 16:20
Comment on lines +179 to +187
if (!distTag) {
throw new Error('--distTag is required when --customVersion is set.')
}
} else if (distTag) {
// distTag on its own would override the tag while still auto-computing the
// version — almost certainly not what the operator intended.
throw new Error('--distTag can only be used together with --customVersion.')
}
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

bit awkward if/else structure, but its OK. I would extract this to the top with something like if (customVersion && !distTag || !customVersion && distTag) { throw new Error(..

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.

2 participants