Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/publish-npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ jobs:
env:
PRERELEASE: ${{ github.event.release.prerelease }}
run: |
if [ "$PRERELEASE" = "true" ]; then
npm publish corebc-*.tgz --access public --provenance --tag next
VERSION=$(node --print 'JSON.parse(require("node:fs").readFileSync("package.json", "utf8")).version')
if [ "$PRERELEASE" = "true" ] || [[ "$VERSION" == *-* ]]; then
npm publish corebc-*.tgz --access public --provenance --tag rc
else
npm publish corebc-*.tgz --access public --provenance --tag latest
fi
6 changes: 4 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@ Open a pull request explaining the problem, changed behavior, and validation. Bu

1. Update `package.json` and `src.ts/_version.ts` to the intended version, install dependencies with `npm install`, and document changes in `CHANGELOG.md`.
2. Run `npm run check` and commit source, configuration, and documentation changes.
3. Create a GitHub release whose tag is the version, optionally prefixed with `v`.
3. Create a GitHub release whose tag is the version, optionally prefixed with `v`. Select the branch containing that version as the release target; any branch is supported and must contain the release workflow.

The release workflow checks the tag against the package version, reruns validation and the dependency audit, and publishes the validated npm archive with provenance. Both workflows use `npm install` with package-manager caching disabled; npm creates an ephemeral runner lockfile for the dependency audit. GitHub prereleases use the `next` dist-tag; normal releases use `latest`.
The release workflow checks the tag against the package version, reruns validation and the dependency audit, and publishes the validated npm archive with provenance. Both workflows use `npm install` with package-manager caching disabled; npm creates an ephemeral runner lockfile for the dependency audit. GitHub pre-releases and versions with a pre-release suffix use the `rc` dist-tag; stable releases use `latest`.

For example, to publish a release candidate from `any-branch`, set both version files to `1.1.2-rc.1` on that branch and commit the changes. Create a GitHub release with tag `1.1.2-rc.1` (or `v1.1.2-rc.1`), target `any-branch`, select **Pre-release**, and publish it. Publishing the release triggers npm publication, including when publishing a saved draft; merely creating a tag or saving a draft does not. Install the candidate with `npm install corebc@rc` or `npm install corebc@1.1.2-rc.1`. The npm `latest` tag stays unchanged.

Before the first automated release, a package owner must configure an npm trusted publisher for `CorePass/corebc.js`, workflow `publish-npm.yml`. This is an npm account setting, not a repository secret. See [npm trusted publishing](https://docs.npmjs.com/trusted-publishers/). Publishing a GitHub release triggers publication; CI on pull requests does not publish.
15 changes: 7 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,27 @@
},
"dependencies": {
"@noble/hashes": "2.4.0",
"@types/node": "26.4.1",
"@types/node": "26.6.5",
"aes-js": "3.1.2",
"bcrypto": "^5.5.2",
"bn.js": "^5.2.5",
"buffer": "^6.0.3",
"tslib": "2.8.1",
"utf8": "^3.0.0",
"ws": "8.21.3"
"ws": "8.22.0"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^29.0.0",
"@rollup/plugin-commonjs": "^29.0.3",
"@rollup/plugin-inject": "^5.0.5",
"@rollup/plugin-node-resolve": "16.0.3",
"@types/bn.js": "^5.2.0",
"@types/mocha": "10.0.10",
"@types/semver": "7.8.0",
"@types/utf8": "^3.0.3",
"c8": "12.0.0",
"mocha": "12.0.0",
"prettier": "^3.9.6",
"rollup": "4.63.1",
"mocha": "12.0.3",
"prettier": "^3.9.10",
"rollup": "4.65.0",
"semver": "7.8.5",
"typescript": "7.0.2",
"uglify-js": "3.19.3"
Expand Down Expand Up @@ -105,8 +105,7 @@
"main": "./lib.commonjs/index.js",
"module": "./lib.esm/index.js",
"publishConfig": {
"access": "public",
"tag": "latest"
"access": "public"
},
"scripts": {
"_build-dist": "rollup -c && uglifyjs ./dist/corebc.js -o ./dist/corebc.min.js && uglifyjs ./dist/corebc.umd.js -o ./dist/corebc.umd.min.js && uglifyjs ./dist/wordlists-extra.js -o ./dist/wordlists-extra.min.js",
Expand Down
Loading