tailwindcss/scripts/release-channel.js

21 lines
513 B
JavaScript
Raw Normal View History

Setup v4 releases (#15961) Now that Tailwind CSS v4 is released, we can setup a proper release workflow again. This setup mimics the workflow of how we did it in v3, but adjusted to make it work on the v4 codebase. Whenever a PR is merged into the `next` branch, we will publish an insiders release to npm using the following version number: `0.0.0-insiders.<commit-hash>`. Note: insiders releases will not have a GitHub release associated with them, therefore the `standalone-cli` won't be available as an insiders release. For the normal release procedure, the following steps are required: 1. Manually version the packages (e.g.: `pnpm run version-packages`) 2. Create a git tag for the version you want to release 3. Push the updated package.json files and the git tag to the repository Next, a GitHub action will kick in once a `tag` is being pushed. The GitHub action will run a build, and create a draft release on GitHub that will contain: 1. The CHANGELOG.md contents for the last version 2. The `standalone-cli` artifacts attached to the drafted release Once you are happy with the draft, you can publish the draft on GitHub. This in turn will trigger another GitHub action that will publish the packages to npm. Whenever an insiders release or a normal release completes, we will also trigger Tailwind Play, to update its dependencies to the latest version of Tailwind CSS. --- Note: some of the GitHub Action workflows still refer to the `next` branch instead of the `main` branch. If we later today want to get a new release out, we can merge `next` into `main` and update the workflows accordingly. --- This is hard to test, but I started from the existing release.yml file and adjusted things accordingly. The biggest change is related to the insiders version. If you look at this temporary [commit](https://github.com/tailwindlabs/tailwindcss/pull/15961/commits/572dddfc33ec95f87f7e31f57ef73ae7c7235510), you can see that the publishing (dry-run) seems to work as expected: <img width="1508" alt="image" src="https://github.com/user-attachments/assets/c075e788-dcbc-4200-aa32-2b9a3c54d629" />
2025-01-28 12:51:34 +01:00
// Given a version, figure out what the release channel is so that we can publish to the correct
// channel on npm.
//
// E.g.:
//
// 1.2.3 -> latest (default)
// 0.0.0-insiders.ffaa88 -> insiders
// 4.1.0-alpha.4 -> alpha
let version =
process.argv[2] ||
process.env.npm_package_version ||
require('../packages/tailwindcss/package.json').version
let match = /\d+\.\d+\.\d+-(.*)\.\d+/g.exec(version)
if (match) {
console.log(match[1])
} else {
console.log('latest')
}