Skip to content

feat(actions): npm-publish-hardened accepts multi-tarball input#30

Merged
jan-kubica merged 2 commits into
mainfrom
feat/npm-publish-hardened-multi-tarball
May 13, 2026
Merged

feat(actions): npm-publish-hardened accepts multi-tarball input#30
jan-kubica merged 2 commits into
mainfrom
feat/npm-publish-hardened-multi-tarball

Conversation

@jan-kubica
Copy link
Copy Markdown
Contributor

Why

The three napi-rs publishing repos (`regex-set`, `aho-corasick`, `fuzzy-search`) pack 1 root tarball + N platform tarballs and publish them via an inline bash loop. The composite previously only accepted a single tarball, so a 1:1 migration would need 6–8 discrete steps per repo with dynamic tarball filenames the pack step can't expose statically.

This PR adds a `tarballs` (plural) input that accepts a newline-separated list. The action publishes each tarball sequentially with the same per-tarball semantics — idempotent `npm view` early-return, 5-attempt retry with backoff, final eventual-consistency poll.

Order matters: a napi-rs meta-package depends on its platform sub-packages being on the registry first. The caller controls ordering by listing platform tarballs before root in the input.

Backwards compatibility

The existing singular `tarball` input keeps working unchanged. `stdnum` and `text-search` migrations don't need to be touched.

`tarball` and `tarballs` are mutually exclusive — setting both is an error.

Test plan

  • shellcheck clean
  • local: single mode → reaches publish path ✓
  • local: multi mode (2 tarballs) → publishes both ✓
  • local: both inputs set → exits 2 with clear error ✓
  • local: neither input → exits 2 ✓
  • local: tarballs with blank lines → filters cleanly ✓
  • local: missing tarball file → exits 2 with path ✓
  • post-merge: bump SHA in stella/fuzzy-search and migrate

Adds a `tarballs` input (newline-separated paths) alongside the
existing singular `tarball`. Exactly one of the two must be set.
When `tarballs` is used, the action publishes each tarball
sequentially with the same per-tarball semantics — idempotent
`npm view` early-return, 5-attempt retry with backoff, final
eventual-consistency poll. Order matters: a napi-rs meta-package
depends on its platform sub-packages being published first, so the
caller controls ordering by listing platform tarballs before root.

The three napi-rs publishing repos (regex-set, aho-corasick,
fuzzy-search) currently pack 1 root + N platform tarballs and
publish them via an inline bash loop. The new input lets each repo
collapse that whole step into a single composite invocation passing
both `${{ steps.pack.outputs.aux_tarballs }}` (the newline-separated
list) and the root tarball.

The existing singular `tarball` input keeps working unchanged —
stdnum and text-search migrations don't need to be touched.

Tested locally across 7 cases: single mode, multi mode, both-set
error, neither-set error, blank-line filtering, missing-file error,
multi success path.
@jan-kubica jan-kubica requested a review from nnad3N as a code owner May 13, 2026 16:39
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request extends the npm-publish-hardened action to support publishing multiple tarballs by introducing a tarballs input and refactoring the publish.sh script to process a queue of tarballs sequentially. The refactor includes improved pre-validation and a modular publish_one function. The reviewer suggested updating the action.yml description to more accurately reflect that one of the two inputs is required for a successful execution.

required: true
description: >
Path to a pre-packed .tgz to publish. Mutually exclusive with
`tarballs` — exactly one of the two must be set.
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The description states "exactly one of the two must be set". However, since both tarball and tarballs are required: false, it's possible to set neither. While the script handles this case correctly by exiting with an error, the action's input description is misleading for users. It would be clearer to state that one of the two inputs is functionally required for a successful run.

      `tarballs` — one of `tarball` or `tarballs` must be set.

@jan-kubica
Copy link
Copy Markdown
Contributor Author

CC on behalf of @jan-kubica — applied. Both descriptions now spell out that the inputs are alternatives where one must be set, not optional inputs.

@jan-kubica jan-kubica merged commit 4292546 into main May 13, 2026
1 check passed
@jan-kubica jan-kubica deleted the feat/npm-publish-hardened-multi-tarball branch May 13, 2026 16:45
@github-actions github-actions Bot locked and limited conversation to collaborators May 13, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant