Skip to content

ci: publish to npm from a release workflow after approval - #523

Merged
g-despot merged 4 commits into
mainfrom
ci/npm-release-environment
Dec 4, 2026
Merged

g-despot merged 4 commits into
mainfrom
ci/npm-release-environment

Conversation

@g-despot

@g-despot g-despot commented Dec 3, 2026

Copy link
Copy Markdown
Collaborator

Moves npm publishing out of main.yaml into a new release.yaml that runs in an npm environment, so each release needs a second person's approval. Same design as weaviate/agents-typescript-client#67 and the C# clients.

  • main.yaml is now named Main and defaults to a read-only token. A new build-package job builds the three tarballs and the docs with no dependency cache and uploads them on tag pushes. The old publish job is gone. release-tag still checks the package versions.
  • release.yaml runs on workflow_run when Main succeeds for a final vX.Y.Z tag, so it always uses the workflow on main. Tags such as v3.15.3-wc never ask for approval. Before publishing it checks, through the GitHub API, that the tag points at the tested commit and that this commit is on main, and that the files are exactly @weaviate/{core,node,web} at the tag's version. It publishes the tarballs without a checkout, installs or repo scripts, and skips any version already on npm, so a re-run after a partial publish finishes the rest. Separate jobs then deploy the docs and draft the GitHub release.
  • Action pins move to download-artifact v8, upload-artifact v7 and setup-node v7.2.0. The unused release:publish scripts are removed.

Before merging, a repo admin creates the npm environment (required reviewers, prevent self-review, no admin bypass, branch main only). Right after merging, the Trusted Publisher of all three packages on npm changes to workflow release.yaml and environment npm. Then turn on "disallow tokens" and delete the NPM_AUTOMATION_TOKEN secret.

The release build still installs with --no-frozen-lockfile, as before.

@g-despot
g-despot requested a review from a team as a code owner December 3, 2026 13:45

@orca-security-eu orca-security-eu Bot 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.

Orca Security Scan Summary

Status Check Issues by priority
Passed Passed Infrastructure as Code high 0   medium 0   low 0   info 0 View in Orca
Passed Passed SAST high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Secrets high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Vulnerabilities high 0   medium 0   low 0   info 0 View in Orca

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.

🟡 Changes recommended

Out-of-order release approvals can roll back npm’s latest tags and deployed docs, while noncanonical tags can reach environment-protected approval before validation.

2 open issues
What changed in this PR

Moves npm publishing out of Main into a separate release workflow gated by the npm approval environment.

Changes:

  • Builds uncached release artifacts with read-only default permissions.
  • Validates tags and packages before publishing, then deploys docs and drafts a GitHub release.
  • Updates action pins and removes unused publishing scripts.
File Description
package.json Removes obsolete release publishing commands.
.github/​workflows/​release.yaml Adds approval-gated publishing and downstream release jobs.
.github/​workflows/​main.yaml Separates artifact building from publishing and updates action pins.

Review effort: Balanced

Comment thread .github/workflows/release.yaml Resolved
Comment thread .github/workflows/release.yaml Resolved
Comment thread .github/workflows/release.yaml Resolved
Comment thread .github/workflows/release.yaml Resolved
@g-despot
g-despot merged commit 0df757c into main Dec 4, 2026
29 of 32 checks passed
@g-despot
g-despot deleted the ci/npm-release-environment branch December 4, 2026 15:05
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