Skip to content
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

[⚠️ DANGER ⚠️] Prepare make commands and GH actions for Babel 8 pre-releases #15574

Merged
merged 14 commits into from
May 2, 2023

Conversation

nicolo-ribaudo
Copy link
Member

@nicolo-ribaudo nicolo-ribaudo commented Apr 19, 2023

Q                       A
License MIT

⚠️ I don't really know how to test this without actually publishing a release


This PR adds the various utilities to actually publish Babel 8 prereleases.

The workflow will be this:

  1. Locally checkout the main branch
  2. Run make new-babel-8-version, which will:
    • Compute the new prerelease version, by adding 1 to the prerelease number in package.json#version_babel8
    • Update package.json#version_babel8, and commit it to main
    • Create a new release/${version} branch
    • Run yarn release-tool version ${version} --all in that branch, to update the version of every package to the new pre-release
  3. Push main, release/${version} and the new v${release} tag to babel/babel

Then, the release GH workflow will start running on the new tag. check-release-type checks if we are doing a Babel 7 release or a Babel 8 pre-release, and if we are doing a Babel 8 pre-release:

  • We set the BABEL_8_BREAKING and USE_ESM env variables to true in make prepublish (for building) and yarn release-tool publish (to set the correct package.json fields)
  • We don't generate the changelog. Ideally we should do it, but it's quite hard because Babel 8 commits will be scattered across multiple Babel 8 releases. We can figure out a solution when we are closer to a RC release, but for now we could just manually write GitHub release changelogs.

I didn't adapt the "just trigger manually the release workflow" publishing strategy, I will do it once I see that this works.

The most testing I think we can do is by releasing a Babel 7 release, so that it only triggers the new check-release-type paths and worst case I have to manually generate the changelog if it's broken.

Copilot

🤖 Generated by Copilot at 861dc8e

Summary

🚀🛠️🏷️

This pull request adds the necessary logic and configuration to prepare and publish Babel 8 as a prerelease version. It modifies the .github/workflows/release.yml file, the Makefile, the Makefile.source.mjs file, and the package.json file to handle Babel 8 differently from regular releases.

We are the masters of the code, we shape the future with our tools
We unleash the power of Babel 8, we break the rules and make them cool
We use semver and makejs, we automate the release flow
We publish to a different tag, we let the world know what we know

Walkthrough

  • Add a new job check-release-type to the release workflow to determine if the release is a Babel 8 release (link)
  • Pass BABEL_8_BREAKING and USE_ESM environment variables to the build and test steps of the npm-release job to enable different features and configurations for the Babel 8 release (link, link)
  • Modify the publish command in the Makefile to use a different tag next for the Babel 8 release (link)
  • Replace make with makejs in the Makefile and add a new command new-babel-8-version to create and publish a new prerelease version of Babel 8 (link)
  • Import the semver module and define two new tasks new-babel-8-version-prepare and new-babel-8-version in Makefile.source.mjs to update the version_babel8 property in package.json and run the release-tool script with a different flag (link, link)
  • Add a new property version_babel8 to package.json to store the current prerelease version of Babel 8 (link)

@babel-bot
Copy link
Collaborator

babel-bot commented Apr 19, 2023

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/54365/

@@ -1,6 +1,7 @@
{
"name": "babel",
"version": "7.21.4",
"version_babel8": "8.0.0-alpha",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When semver increments this, it will generate 8.0.0-alpha.0

.github/workflows/release.yml Outdated Show resolved Hide resolved
.github/workflows/release.yml Outdated Show resolved Hide resolved
Makefile Outdated Show resolved Hide resolved
Makefile.source.mjs Outdated Show resolved Hide resolved
@nicolo-ribaudo
Copy link
Member Author

TODO: Bump all the peer dependency versions :)

@nicolo-ribaudo
Copy link
Member Author

I tried this locally, and found some bugs. I think I tested as much as possible, and now the only way to be sure is to merge 😅

@nicolo-ribaudo
Copy link
Member Author

Yolo :shipit:

@nicolo-ribaudo nicolo-ribaudo merged commit 3935131 into babel:main May 2, 2023
51 checks passed
@nicolo-ribaudo nicolo-ribaudo deleted the main2 branch May 2, 2023 14:37
@github-actions github-actions bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Aug 2, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated A closed issue/PR that is archived due to age. Recommended to make a new issue repo automation 🤖
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants