From 326dd1d1c49ccbe668a32c88e07be725823936c2 Mon Sep 17 00:00:00 2001 From: Haseeb Ahmad Date: Wed, 24 Jun 2026 12:27:40 +0200 Subject: [PATCH] CLOUDPLAT-3162: add npm OIDC publish workflow https://mapbox.atlassian.net/browse/CLOUDPLAT-3162 --- .github/workflows/npm-release.yml | 15 +++++++++++++++ CONTRIBUTING.md | 24 ++++++++++++++++++++++++ package.json | 5 ++++- 3 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/npm-release.yml create mode 100644 CONTRIBUTING.md diff --git a/.github/workflows/npm-release.yml b/.github/workflows/npm-release.yml new file mode 100644 index 0000000..ba2ea44 --- /dev/null +++ b/.github/workflows/npm-release.yml @@ -0,0 +1,15 @@ +name: NPM release + +on: + workflow_dispatch: + +jobs: + npm-release: + uses: mapbox/gha-public/.github/workflows/workflow-npm-oidc-publish.yml@main + permissions: + id-token: write + contents: write + with: + create-github-release: true + environment: npm-release + run-tests: false diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..d90dda1 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,24 @@ +# Contributing to to-color + +## Development + +```bash +npm ci +npm test +``` + +## Releasing a new version + +Releases are published to npm via GitHub Actions. + +### Steps + +1. **Bump the version** in `package.json` (follow [semver](https://semver.org)) +2. **Update `CHANGELOG.md`** with a summary of what changed +3. **Open a PR**, get it reviewed and merged to `publisher-production` +4. **Trigger the release** from the [Actions tab](../../actions/workflows/npm-release.yml): + - Select **NPM release** → **Run workflow** → run from `publisher-production` + +The workflow will publish to npm and create a GitHub release with auto-generated notes. + +> **Note:** Only Mapbox maintainers with write access to this repository can trigger the release workflow. External contributors can open and contribute to PRs, but releases are always cut by the owning team. diff --git a/package.json b/package.json index d8eaad7..1ee5753 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@mapbox/to-color", - "version": "2.3.0", + "version": "2.3.1", "description": "Procedurally generate a deterministic, perceptually distributed color palette.", "main": "dist/to-color.js", "scripts": { @@ -71,5 +71,8 @@ "dependencies": { "d3-color": "^3.1.0", "hsluv": "^1.0.1" + }, + "publishConfig": { + "access": "public" } }