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

Update release versioning for snapshot releases #8389

Merged

Conversation

tkajtoch
Copy link
Member

@tkajtoch tkajtoch commented Mar 5, 2025

Summary

This PR improves the way snapshot releases (yarn release snapshot) are versioned. Previously, both official and snapshot releases used the regular changelog-based new version calculation. It wasn't correct since snapshot releases are meant for testing, and they should not use the same versioning scheme, even if suffixed with -snapshot.

The updated code builds and publishes packages with a timestamp-based versioning, for example:

  • 99.4.0 -> 99.4.0-snapshot.1741123162416
  • 1.2.3-borealis.0 -> 1.2.3-snapshot.1741123163100

With this change, the updated package.json versions will not be committed. Keep in mind, though, that the file is still edited, and will be marked as modified by git. There's no reset logic to get them back to the original state yet but it may be implemented in near future.

QA

  1. Ensure you're logged out of the npmjs registry - npm logout and yarn npm logout
  2. Checkout this branch - gh pr checkout <id>
  3. Run Verdaccio in a separate tab - docker run -it --rm --name verdaccio -p 4873:4873 verdaccio/verdaccio and login as with yarn npm login (enter the same user/password pair as previously, e.g. test/test)
  4. Update and commit .yarnrc to use the custom local verdaccio registry
    npmRegistryServer: "http://localhost:4873"
    unsafeHttpWhitelist:
      - localhost
      - "localhost:4873"
  5. Install dependencies - yarn
  6. Build release scripts - yarn workspace @elastic/eui-release-cli run build (this will be automated soon)
  7. Run the release script from the monorepo root - yarn release run snapshot --allow-custom --workspaces @elastic/eui-theme-common @elastic/eui-theme-borealis @elastic/eui and follow its instructions
    • When asked for OTP click enter to skip; verdaccio doesn't need it
  8. Confirm the packages are published with snapshot tag and <version>-snapshot.<timestamp> versions on http://localhost:4873

tkajtoch added 4 commits March 5, 2025 11:20
…is dependency versions to `workspace:*` so they always point to exact versions needed
…imestamp-based preid increments (`1.2.3-snapshot.<timestamp>`) and skip committing the version changes
@tkajtoch tkajtoch requested a review from a team as a code owner March 5, 2025 10:37
@tkajtoch tkajtoch self-assigned this Mar 5, 2025
@@ -32,7 +32,7 @@
"@babel/preset-env": "^7.21.5",
"@babel/preset-react": "^7.18.6",
"@babel/preset-typescript": "^7.21.5",
"@elastic/eui-theme-common": "workspace:^",
"@elastic/eui-theme-common": "workspace:*",
Copy link
Member Author

Choose a reason for hiding this comment

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

This is needed so that yarn replaces it during packing to an exact version instead of compatible with (^) version

@@ -1,6 +1,6 @@
{
"name": "@elastic/eui-theme-common",
"version": "0.0.9",
"version": "0.0.11",
Copy link
Member Author

@tkajtoch tkajtoch Mar 5, 2025

Choose a reason for hiding this comment

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

The last eui-theme-common version update was not committed. I must've forgotten to include it when doing it manually.


for (const workspace of workspaces) {
logger.debug(`Calculating changes in ${workspace.name}`);

const workspaceDir = path.join(rootWorkspaceDir, workspace.location);
const currentVersion = await getWorkspacePackageVersion(workspaceDir);

const { changelogMap, changelog, hasChanges, processedChangelogFiles } =
await collateChangelogFiles(workspaceDir);
if (options.type === 'snapshot') {
Copy link
Member Author

Choose a reason for hiding this comment

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

This could be done better and moved to separate functions but we can clean it up later

Copy link
Contributor

@mgadewoll mgadewoll left a comment

Choose a reason for hiding this comment

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

Changes LGTM 👍
I tested the snapshot release locally and it worked like a charm 🪄

@kibanamachine
Copy link

Preview staging links for this PR:

@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

cc @tkajtoch

@tkajtoch tkajtoch merged commit 035255d into elastic:main Mar 5, 2025
7 of 8 checks passed
weronikaolejniczak pushed a commit to weronikaolejniczak/eui that referenced this pull request Mar 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants