Add GitHub Actions workflow to publish npm package on GitHub release#291
Add GitHub Actions workflow to publish npm package on GitHub release#291
Conversation
Agent-Logs-Url: https://github.com/albe/node-event-storage/sessions/717b0f78-783e-4637-82ce-0fc99f88415c Co-authored-by: albe <4259532+albe@users.noreply.github.com>
|
@copilot add a pre release step that creates a npm pack bundle and verifies it contains all necessary files, but no files that shouldn't be there like a .env, data files or node_modules/* . |
…pm publish Agent-Logs-Url: https://github.com/albe/node-event-storage/sessions/c6f68e01-53fd-412a-b63a-7007af423814 Co-authored-by: albe <4259532+albe@users.noreply.github.com>
Agent-Logs-Url: https://github.com/albe/node-event-storage/sessions/c6f68e01-53fd-412a-b63a-7007af423814 Co-authored-by: albe <4259532+albe@users.noreply.github.com>
Done in commit
Running the smoke test locally also uncovered a real bug: |
Automates npm publishing when a GitHub Release is published, eliminating manual
npm publishsteps.Changes
.github/workflows/npm-publish.yml— new workflow triggered onrelease: publishedwith two jobs:verify(runs first):npm packto build the tarballindex.js,EventStore.js,Storage.js,Partition.js,Index.js,metadataUtil.js).env,node_modules/,/data/)bench/subproject and runsnpm run benchas a smoke test — any runtime failure blocks publishingpublish(only runs ifverifysucceeds):registry-url: https://registry.npmjs.orgnpm publish --provenance --access publicauthenticated viaNPM_TOKENsecretid-token: writepermission for provenance attestation; all other permissions are minimally scopedpackage.json— added missingsrc/metadataUtil.jsto thefilesarray (it was excluded from the tarball but is required at runtime byReadableStorage.js).gitignore— added*.tgzto prevent locally-created pack tarballs from being accidentally committedRequired setup
Add an npm access token as a repository secret named
NPM_TOKEN(Settings → Secrets and variables → Actions → New repository secret).