From 8695b99920ff337a94a9b4dc273eb7dfc28e7c1b Mon Sep 17 00:00:00 2001 From: Yanzhu Li Date: Fri, 16 Oct 2026 14:18:33 +0200 Subject: [PATCH] New release workflow --- .github/workflows/npm-release.yml | 17 +++++++++++++++++ CONTRIBUTING.md | 24 +++++++++++++----------- 2 files changed, 30 insertions(+), 11 deletions(-) create mode 100644 .github/workflows/npm-release.yml diff --git a/.github/workflows/npm-release.yml b/.github/workflows/npm-release.yml new file mode 100644 index 00000000..d876f8e2 --- /dev/null +++ b/.github/workflows/npm-release.yml @@ -0,0 +1,17 @@ +name: Publish +on: + push: + tags: ['v*'] +permissions: + id-token: write +jobs: + publish: + runs-on: ubuntu-latest + environment: npm-release + steps: + - uses: actions/checkout@v7 + - uses: actions/setup-node@v7 + with: + node-version: 24 + - run: npm ci + - run: npm publish --access public diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ced4c328..0ebf092b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -25,21 +25,23 @@ Follow this deploy process after all changes for the release are merged into mai ## Release checklist 1. Create a branch off `main` and a pull request with the following changes. Copy this checklist in the comment of the pull request. - - [ ] Update the [CHANGELOG.md](https://github.com/mapbox/mapbox-gl-geocoder/blob/main/CHANGELOG.md) by comparing the last release and what is on `main`. In the changelog, replace the `HEAD` heading with the to-be-released stable version. + - [ ] Update the [CHANGELOG.md](https://github.com/mapbox/mapbox-gl-geocoder/blob/main/CHANGELOG.md) by comparing the last release and what is on `main`. In the changelog, add the to-be-released stable version heading below `HEAD`. - [ ] Update the version number in `package.json` and `package-lock.json`. -3. Request a PR review and then merge it into `main`. -4. Tag the release and start the build. - - [ ] Make sure you've pulled in all changes to `main` locally. - - [ ] Build the release with `npm run prepublish && npm run docs` - - [ ] Commit and push with commit message `vX.X.X` - - [ ] Create the git tag for the release with `git tag -a vX.X.X -m 'vX.X.X'` - - [ ] Push the tags with `git push --tags` - - [ ] Run `mbx npm publish` + - [ ] Run `npm run docs` and commit any changes to `API.md`. +2. Request a PR review and then merge it into `main`. +3. Tag the merge commit and publish. + - [ ] Create the git tag with `git tag -a vX.X.X -m 'vX.X.X'` on the merged commit + - [ ] Push it with `git push origin vX.X.X`. This starts the `Publish` workflow, which publishes to npm once the `npm-release` environment is approved. + - [ ] Create a GitHub release for the tag with the changelog entry. ## Post-release checklist -Update version number in GL JS examples at [https://github.com/mapbox/mapbox-gl-js-docs](https://github.com/mapbox/mapbox-gl-js-docs): +Upload to the CDN (make sure you are authenticated for AWS): - sed -i '' 's/mapbox-gl-geocoder\/v[^\/]*\//mapbox-gl-geocoder\/vX.X.X\//g' docs/pages/example/*.html + git checkout vX.X.X + npm ci + aws s3 cp --recursive --acl public-read dist s3://mapbox-gl-js/plugins/mapbox-gl-geocoder/vX.X.X + +Update the geocoder version in `src/components/example/helpers.js` of [mapbox-gl-js-docs](https://github.com/mapbox/mapbox-gl-js-docs). ```