Repository navigation
ci(wbn-sign): migrate npm publishing to Google OSS Exit Gate - #925
alonsopf89 wants to merge 4 commits into
Conversation
Signed-off-by: Fernando Alonso Pecina <fernandoalonso@google.com>
| - name: Checkout repository | ||
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
|
|
||
| - name: Use Node.js 22.x |
There was a problem hiding this comment.
Can we move to Node 24 or 26? 22 is already in maintenance mode.
Signed-off-by: Fernando Alonso Pecina <fernandoalonso@google.com>
|
Thanks for the review @rferens! Updated |
rferens
left a comment
There was a problem hiding this comment.
Hey, sorry for so long review. I had to onboard a bit on this topic. I spotted some problems that might require your attention.
Please take a look at this one which AI spotted for me:
Artifact Registry NPM Version Immutability on Retries
Artifact Registry's npm implementation retains version tombstones: once wbn-sign@X.Y.Z is uploaded to webpackage--npm, you cannot re-upload wbn-sign@X.Y.Z to Artifact Registry—even if gcloud artifacts versions delete was run (publisher.go).
- If a run uploads to AR (npm publish) and fails before or during Exit Gate publishing, retrying the workflow for the same version will fail at npm publish unless the package entry in AR is wiped first.
- Adding gcloud artifacts packages delete wbn-sign --project=oss-exit-gate-prod --repository=webpackage--npm --location=us --quiet || true before npm publish ensures a clean staging state on retries (go/oss-exit-gate-faq#delete-ar-artifacts).
| @@ -0,0 +1,65 @@ | |||
| name: Publish wbn-sign to npm via OSS Exit Gate | |||
There was a problem hiding this comment.
is there a way to test this workflow without real publishing?
There was a problem hiding this comment.
Added a dry_run boolean input on workflow_dispatch: when dry_run is checked (true), the workflow runs the build, tests, WIF authentication, and Artifact Registry staging check, then cleans up the staged package in AR and exits without uploading manifest.json to GCS (so nothing is published to public npm).
|
|
||
| on: | ||
| release: | ||
| types: [published] |
There was a problem hiding this comment.
Maybe we should allow for only manual run? We don't use any releases now in this repo (IIUC how [published] works), and it would cause a trigger collision because we have 2 npm packages in this one repo: wbn, and wbn-sign, so not sure if we want to always update both, because they are developed separately. Do you have an idea how to separate their releases?
Also, it would be good to leave some comment or instruction how to publish (in this file or in js/CONTRIBUTING.md)
There was a problem hiding this comment.
Done! Switched to workflow_dispatch only with a package choice input (wbn-sign or wbn) so each package is built and released independently from js/sign or js/bundle, and added step-by-step publishing instructions in both .github/workflows/publish-npm.yml and js/CONTRIBUTING.md.
| npm publish --access public --registry="https://us-npm.pkg.dev/oss-exit-gate-prod/webpackage--npm/" | ||
| cat << 'MANIFEST' > manifest.json | ||
| { | ||
| "publish_all": true |
There was a problem hiding this comment.
Do we always want to publish everything? Cannot be that one of packages (wbn, sign-wbn) is damaged there, while other passed tests and both are published? Maybe it should be more targetted? AI recommended me sth like:
PKG_VERSION=$(node -p "require('./package.json').version")
cat << MANIFEST > manifest.json
{
"publish_all": false,
"publishing_groups": [
{
"packages": [
{
"name": "wbn-sign",
"version": "${PKG_VERSION}"
}
]
}
]
}
MANIFEST
There was a problem hiding this comment.
Done! Updated manifest.json to use "publish_all": false with publishing_groups targeting only ${PACKAGE_NAME} and ${PKG_VERSION}.
… dry_run, and AR cleanup
|
Thanks for the thorough review @rferens! I've updated the PR to address all of your points:
|
|
Thank you for the approval, @rferens! All 9 |
Summary
Adds
.github/workflows/publish-npm.ymlto publishwbn-sign(js/sign) through Google OSS Exit Gate (go/oss-exit-gate) using keyless Workload Identity Federation (WIF), matching the setup inchromeos/wbn-sign-gcp-kms#16.webpackage/npm(cl/1005822927)https://us-npm.pkg.dev/oss-exit-gate-prod/webpackage--npm/gs://oss-exit-gate-prod-projects-bucket/webpackage/npm/manifests/wbn-sign@0.3.3b/577052994(parentb/576673325)cc @zgroza @cmfcmf @GrapeGreen @rferens @sonkkeli