-
Notifications
You must be signed in to change notification settings - Fork 678
build: automate release packaging and version bumps with changesets #2483
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
87118a6
aaab8b4
5601453
d85e8ce
3fdec0e
0a444a5
37fe12b
b08d490
cb8fa87
381af9c
17724b5
6476161
1180916
51199df
4c4959a
f360a20
e645853
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| # Changesets | ||
|
|
||
| This directory contains [**Changesets**](https://github.com/changesets/changesets) which are markdown files that describe package changes for the next release. | ||
|
|
||
| For guidance on when and how to add changesets, checkout the [Maintainer's Guide](../.github/maintainers_guide.md#-updating-changesets). |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| { | ||
| "$schema": "https://unpkg.com/@changesets/config@3.1.2/schema.json", | ||
| "changelog": "@changesets/cli/changelog", | ||
| "commit": false, | ||
| "fixed": [], | ||
| "linked": [], | ||
| "access": "public", | ||
| "baseBranch": "main", | ||
| "updateInternalDependencies": "patch", | ||
| "ignore": [] | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -62,86 +62,51 @@ npm run docs --workspace packages/web-api | |
|
|
||
| The script places the reference markdown files in `/docs/english/reference/package-name`. | ||
|
|
||
| ### 🚀 Releases | ||
|
|
||
| _For beta releases, see [**Beta Releases**](https://github.com/slackapi/node-slack-sdk/blob/main/.github/maintainers_guide.md#-beta-releases) section below_ | ||
|
|
||
| Releasing can feel intimidating at first, but rest assured: if you make a mistake, don't fret! npm allows you to unpublish a release within the first 72 hours of publishing (you just won’t be able to use the same version number again). Venture on! | ||
|
|
||
| 1. Check the status of the package's GitHub Milestone for issues that should be shipped with the release. | ||
| - If all issues have been closed, continue with the release. | ||
|
|
||
| - If issues are still open, discuss with the team about whether the open issues should be moved to a future release or if the release should be held off until the issues are resolved. | ||
|
|
||
| - Take a look at all issues under the Milestone to make sure that the type of issues included aligns with the Milestone name based on [semantic versioning](https://semver.org/). If the issues do not align with the naming of the Milestone (ex: if the issues are all bug fixes, but the Milestone is labeled as a minor release), then you can tweak the Milestone name to reflect the correct versioning. | ||
|
|
||
| 2. Make sure your local `main` branch has the latest changes (i.e. `git checkout main && git pull --tags origin main`). Then, open a new branch off of your local `main` branch for the release (i.e. `git checkout -b <package>-<release>`). | ||
|
|
||
| 3. For each package to be released, run `npm test --workspace packages/<package-name>` to verify that tests are passing. | ||
|
|
||
| 4. On our new branch, bump the version(s) in `package.json` (see [Versioning and Tags](https://github.com/slackapi/node-slack-sdk/blob/main/.github/maintainers_guide.md#-versioning-and-tags)) | ||
| - Generate the reference docs for that package by running `npm run docs --workspace packages/<package-name>`. | ||
|
|
||
| - Make a single commit for the version(s) bump, following the format in: ([Example](https://github.com/slackapi/node-slack-sdk/commit/ff03f7812c678bdc5cea5eace75db34631a88dda)) | ||
| ### 🎁 Updating Changesets | ||
|
|
||
| - Create a pull request for the version change ([Example](https://github.com/slackapi/node-slack-sdk/pull/2402)) | ||
| This project uses [Changesets](https://github.com/changesets/changesets) to track changes and automate releases. | ||
|
|
||
| - Add appropriate labels on the PR, including `release`, `pkg:*`, and `semver:*` | ||
| Each changeset describes a change to a package and its [semver](https://semver.org/) impact, and a new changeset should be added when updating a published package with some change that affects consumers of the package: | ||
|
|
||
| - Add appropriate milestone on the PR | ||
|
|
||
| 5. Once the PR has been approved and tests have passed, merge it into the main repository. | ||
| - Check out your local `main` branch and update it to get the latest changes: `git checkout main && git pull origin main` | ||
|
|
||
| - Add a version tag (ie, `git tag @slack/web-api@5.6.0`) | ||
|
|
||
| - Push the new tag up to origin: `git push origin @slack/web-api@5.6.0` | ||
|
|
||
| 6. Publish the release to npm | ||
| - To publish, you need to be a member of the `slack Org` on npm and set up 2-Factor Auth with your password generator of choice. Before you can publish with npm, you must run `npm login` from the command line. | ||
|
|
||
| - As the final validation, run `rm -rf packages/types/dist && npm test --workspace packages/types && npm pack --workspace packages/types` and confirm if there are `*.js`, `*.d.ts` files under the `dist` directory. | ||
|
|
||
| - Run `npm publish --workspace packages/types --otp YOUR_OTP_CODE`. To generate an OTP (One Time Password), use your password generator of choice (Duo, 1Password) | ||
| ```sh | ||
| npm run changeset | ||
| ``` | ||
|
|
||
| 7. Close GitHub Milestone | ||
| - Close the relevant GitHub Milestone for the release | ||
| Updates to documentation, tests, or CI might not require new entries. | ||
|
|
||
| - Check the existing GitHub Milestones to see if the next minor version exists. If it doesn't, then create a GitHub Milestone for new issues to live in. Typically, you'll create a new minor version - however, if there are any bugs that need to be carried over from the current GitHub Milestone, you could make a Milestone for a patch version to reflect those issues | ||
| When a PR containing changesets is merged to `main`, a different PR is opened or updating using [changesets/action](https://github.com/changesets/action) which consumes the pending changesets, bumps relevant package versions, and updates various `CHANGELOG` files in preparation to release. | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📚 note: The
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. question: How does
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The We only expose the |
||
|
|
||
| - Move any unfinished, open issues to the next GitHub Milestone | ||
| ### 🚀 Releases | ||
|
|
||
| 8. Create GitHub Release with release notes | ||
| - From the repository, navigate to the **Releases** section and select [Draft a new release](https://github.com/slackapi/node-slack-sdk/releases/new) | ||
| Releasing can feel intimidating at first, but don't fret! If you make a mistake, npm allows you to unpublish within the first 72 hours. The one catch is that you can't reuse the same version number. Venture on! | ||
|
|
||
| - When creating the release notes, select the tag you generated earlier for your release and title the release the same name as the tag | ||
| > For beta releases, read the [**Beta Releases**](#-beta-releases) section below. | ||
|
|
||
| - To see a list of changes between the last tag for the specific package, you can use this `git` command: `git log --oneline --full-history @slack/types@2.8.0..@slack/types@2.9.0 -- packages/types`. Sub in the correct tags and the last argument should be the path to the sub-package you are releasing (in order to filter commits just to the specific path). | ||
| New official package versions are published when the release PR created from changesets is merged and the publish workflow is approved. Follow these steps to build confidence: | ||
|
|
||
| - Release notes should mention contributors, issues, PRs, milestone, and link to npm package ([Example](https://github.com/slackapi/node-slack-sdk/releases/tag/%40slack%2Ftypes%402.17.0)) | ||
| 1. **Check GitHub Milestones**: Before merging the release PR please check the relevant [Milestones](https://github.com/slackapi/node-slack-sdk/milestones). If issues or pull requests are still open either decide to postpone the release or save those changes for a future update. | ||
|
|
||
| - Once the release notes are ready, click the "Publish Release" button to make them public | ||
| 2. **Review the release PR**: Verify that version bumps match expectations, `CHANGELOG` entries are clear, and CI checks pass. | ||
|
|
||
| 9. Communicate the release (as appropriate) | ||
| - **Internal** | ||
| - Include a brief description and link to the GitHub release | ||
| 3. **Merge and approve**: Merge the release PR, then approve the publish workflow to release packages to npm. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👌🏻 |
||
|
|
||
| - **External** | ||
| - **Slack Community Hangout** (`community.slack.com/`) in **#lang-javascript**. Include a link to the package on `npmjs.com/package/@slack/` as well as the release notes. ([Example](https://community.slack.com/archives/CHF1FKX4J/p1657293144932579)) | ||
| 4. **Update Milestones**: Close the relevant [Milestones](https://github.com/slackapi/node-slack-sdk/milestones) and rename these to match the released package versions. Open a new Milestone for the next version, e.g. `@slack/web-api@next`. | ||
|
|
||
| - **Twitter**: Primarily for major updates. Coordinate with Developer Marketing. | ||
| 5. **Communicate the release**: | ||
| - **Internal**: Post a brief description and link to the GitHub release. | ||
| - **External**: Post in **#lang-javascript** on [Slack Community](https://community.slack.com/). Include a link to the package on `npmjs.com/package/@slack/` as well as the release notes. | ||
|
|
||
| ### 🚧 Beta Releases | ||
|
|
||
| 1. Make sure your local `main` branch has the latest changes | ||
| - Run `git rebase main` from your feature branch (this will rebase your feature branch from `main`). You can opt for `git merge main` if you are not comfortable with rebasing. | ||
| 1. Make sure your local `main` branch has the latest changes | ||
| - Run `git rebase main` from your feature branch (this will rebase your feature branch from `main`). You can opt for `git merge main` if you are not comfortable with rebasing. | ||
|
|
||
| - If you do not have a feature branch, you can also use generic release candidate branch name like `<next-version>rc`, i.e. `2.5.0rc`. | ||
|
|
||
| 2. For each package to be released, run `npm test --workspace packages/<package-name>` to verify that tests are passing. | ||
|
|
||
| 3. Bump the version(s) in `package.json` | ||
| - The version must be in the format of `Major.Minor.Patch-BetaNamespace.BetaVersion` (ex: `5.10.0-workflowStepsBeta.1`, `2.5.0-rc.1`) | ||
| - The version must be in the format of `Major.Minor.Patch-BetaNamespace.BetaVersion` (ex: `5.10.0-workflowStepsBeta.1`, `2.5.0-rc.1`) | ||
|
|
||
| - Make a single commit for the version bump ([Example](https://github.com/slackapi/node-slack-sdk/commit/1503609d79abf035e9e21bad7360e124e4211594)) | ||
|
|
||
|
|
@@ -170,7 +135,7 @@ Releasing can feel intimidating at first, but rest assured: if you make a mistak | |
|
|
||
| - Release notes should mention the beta feature (if applicable), contributors, issues and PRs ([Example](https://github.com/slackapi/node-slack-sdk/releases/tag/%40slack%2Ftypes%401.8.0-workflowStepsBeta.2)) | ||
|
|
||
| - Select the **This is a pre-release** checkbox | ||
| - Select the **This is a pre-release** checkbox | ||
|
|
||
| ## 📥 Workflow | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| name: Release | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| workflow_dispatch: | ||
|
|
||
| concurrency: ${{ github.workflow }}-${{ github.ref }} | ||
|
|
||
| jobs: | ||
| release: | ||
| name: Release | ||
| runs-on: ubuntu-latest | ||
| environment: publish | ||
| permissions: | ||
| contents: write | ||
| id-token: write # OIDC: https://docs.npmjs.com/trusted-publishers | ||
| pull-requests: write | ||
| steps: | ||
| - name: Checkout Repo | ||
| uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | ||
| with: | ||
| persist-credentials: true | ||
|
|
||
| - name: Setup Node | ||
| uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0 | ||
| with: | ||
| node-version: 24 | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📺 note: We're using
|
||
| registry-url: "https://registry.npmjs.org" | ||
|
|
||
| - name: Install dependencies | ||
| run: npm install | ||
|
|
||
| - name: Gather changesets | ||
| uses: changesets/action@c48e67d110a68bc90ccf1098e9646092baacaa87 # v1.6.0 | ||
| with: | ||
| createGithubReleases: true | ||
| commit: "chore: release" | ||
| title: "chore: release" | ||
| publish: npm run changeset -- publish | ||
| version: npm run changeset -- version | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. question: Do we need a
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @mwbrooks AFAICT OIDC is a replacement for the
🔗 https://github.blog/changelog/2025-07-31-npm-trusted-publishing-with-oidc-is-generally-available/ |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,10 +19,12 @@ | |
| "packages/webhook" | ||
| ], | ||
| "scripts": { | ||
| "changeset": "npx @changesets/cli", | ||
| "lint": "npx @biomejs/biome check packages", | ||
| "lint:fix": "npx @biomejs/biome check --write packages" | ||
| }, | ||
| "devDependencies": { | ||
| "@biomejs/biome": "^2.0.5" | ||
| "@biomejs/biome": "^2.0.5", | ||
| "@changesets/cli": "^2.29.8" | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. question: Do we need
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @mwbrooks I understand having this listed with dev dependencies guarantees a certain version will be used for the command: While |
||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,7 @@ | ||
| { | ||
| "name": "@slack/client", | ||
| "version": "5.0.2", | ||
| "private": true, | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👁️🗨️ note: These package are EOL and shouldn't be published so the
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. question: Should we add
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @mwbrooks I'm curious about this too, but perhaps we add this to discussion in #2359? IIRC classic apps might still use this but I agree that since it's deprecated we might also mark this package as EOL. 📚 https://docs.slack.dev/changelog/2024-09-legacy-custom-bots-classic-apps-deprecation/ |
||
| "description": "Legacy wrapper for official Slack Platform's Web API, RTM API, and Incoming Webhook libraries. Use @slack/web-api, @slack/rtm-api, or @slack/webhook instead.", | ||
| "author": "Slack Technologies, LLC", | ||
| "license": "MIT", | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: Should we explicitly ignore our legacy packages? I know we currently use
private: truein each legacy package to prevent publishing, so ignoring may not be necessary.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mwbrooks This is recommended against and instead
ignoreis meant to be used for stopgap times when we might want to not publish certain packages in the next release:🔗 https://github.com/changesets/changesets/blob/main/docs/config-file-options.md#ignore-array-of-packages