diff --git a/.changeset/README.md b/.changeset/README.md new file mode 100644 index 000000000..54ce920e7 --- /dev/null +++ b/.changeset/README.md @@ -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). diff --git a/.changeset/config.json b/.changeset/config.json new file mode 100644 index 000000000..b8213321c --- /dev/null +++ b/.changeset/config.json @@ -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": [] +} diff --git a/.github/maintainers_guide.md b/.github/maintainers_guide.md index 446a50341..adcdc256c 100644 --- a/.github/maintainers_guide.md +++ b/.github/maintainers_guide.md @@ -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 -`). - -3. For each package to be released, run `npm test --workspace packages/` 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/`. - - - 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. - - 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. - - **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 `rc`, i.e. `2.5.0rc`. 2. For each package to be released, run `npm test --workspace packages/` 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 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..553d5539f --- /dev/null +++ b/.github/workflows/release.yml @@ -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 + 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 }} diff --git a/package.json b/package.json index 56f3c87da..1fb88edbe 100644 --- a/package.json +++ b/package.json @@ -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" } } diff --git a/packages/client/package.json b/packages/client/package.json index fe7e9be84..711ce04ff 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,7 @@ { "name": "@slack/client", "version": "5.0.2", + "private": true, "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", diff --git a/packages/events-api/package.json b/packages/events-api/package.json index 89f2357d8..23c4a7714 100644 --- a/packages/events-api/package.json +++ b/packages/events-api/package.json @@ -1,6 +1,7 @@ { "name": "@slack/events-api", "version": "3.0.1", + "private": true, "description": "Official library for using the Slack Platform's Web API", "author": "Slack Technologies, LLC", "license": "MIT", diff --git a/packages/interactive-messages/package.json b/packages/interactive-messages/package.json index 25fa07118..a8a87dd1c 100644 --- a/packages/interactive-messages/package.json +++ b/packages/interactive-messages/package.json @@ -1,6 +1,7 @@ { "name": "@slack/interactive-messages", "version": "2.0.2", + "private": true, "description": "Official library for using the Slack Platform's Interactive Buttons, Menus, Dialogs, Actions, and Block Actions", "author": "Slack Technologies, LLC", "license": "MIT",