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

fix dev versions #903

Merged
merged 16 commits into from
Feb 13, 2025
Merged

fix dev versions #903

merged 16 commits into from
Feb 13, 2025

Conversation

bcotrim
Copy link
Contributor

@bcotrim bcotrim commented Feb 6, 2025

Related issues

The reported issue is caused by an error while parsing the commit hash in the dev builds.
This PR suggest a change that makes dev builds follow a correct versioning convention by using -dev${number} format.
We currently already follow that convention on other builds, for example, -beta1, -beta2, etc...
By using the commit count since the latest release we maintain the ability to track which commit generated that version.

Notes:

  • The approval of this PR requires changes in the studio-app/updates endpoint.
  • After releasing a version (e.g., 1.3.3), we should immediately update package.json to the next intended version (e.g., 1.3.4). This ensures dev builds are correctly labeled with the version they're working towards (e.g., 1.3.4-dev1) rather than appearing as development builds of the just-released version.

Proposed Changes

  • Changed development version format from -dev.HASH to -devN (where N is commit count since last release)
  • Updated version counting to use latest release tag (excluding pre-release tags) instead of latest tag
  • Added backward compatibility to handle both -dev.HASH and -devN formats
  • Updated version handling in build scripts and runtime checks
  • Modified artifact naming to use new version format

New dev version on macOS:
image

New dev version on Windows:
image

Testing Instructions

  1. Test the version generation:
node scripts/prepare-dev-build-version.mjs
  1. Check the generated version in package.json:
cat package.json | grep version
  1. Test the releases manifest generation:
IS_DEV_BUILD=true node scripts/generate-releases-manifest.mjs
  1. Check the releases manifest
cat out/releases.json | jq
  1. Test the fastlane distribution (in dry-run mode):
DRY_RUN=true BUILDKITE_BUILD_NUMBER=test-build bundle exec fastlane distribute_dev_build

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?

@bcotrim bcotrim requested a review from a team February 6, 2025 15:12
Copy link
Contributor

@fredrikekelund fredrikekelund left a comment

Choose a reason for hiding this comment

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

LGTM 👍

To quickly recap why we need to do make this change: while the Mac installer will simply install whatever app our API returns, the Windows Squirrel installer compares the installed version with the new version provided by the API. The new bundle is only installed if the provided version is higher according to some NuGet logic (presumably covered by these docs). Version numbers derived from git hashes cannot be reliably compared, whereas this approach can.

The one thing I take issue with (I've already discussed this with @bcotrim), is this part:

After releasing a version (e.g., 1.3.3), we should immediately update package.json to the next intended version (e.g., 1.3.4). This ensures dev builds are correctly labeled with the version they're working towards (e.g., 1.3.4-dev1) rather than appearing as development builds of the just-released version.

Committing a new version number in package.json currently triggers a release build on CI. Changing that seems overly cumbersome for this purpose, so I suggest we accept the quirk that v1.3.3-dev24 is newer than v1.3.3. This is in fact a "problem" we already have with our existing dev version format, so we can tackle that separately (if needed)

src/updates.ts Outdated
process.env.NODE_ENV === 'production' && app.isPackaged && ! app.getVersion().includes( '-dev.' );
process.env.NODE_ENV === 'production' &&
app.isPackaged &&
! /(-dev\.|-dev\d+)/.test( app.getVersion() );
Copy link
Contributor

Choose a reason for hiding this comment

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

Not entirely necessary, but it might be nice to add an isDevRelease utility function for checking a version string. Could be used here and in src/lib/sentry-release.ts

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes a lot of sense, added! 👍

Comment on lines 57 to 93
puts "\n=== Starting notarization process ==="

Dir[File.join(BUILDS_FOLDER, '**', 'Studio.app')].each do |path|
puts "\nChecking app bundle at: #{path}"

# Check Info.plist contents
info_plist_path = File.join(path, 'Contents', 'Info.plist')
puts "\nInfo.plist path: #{info_plist_path}"

if File.exist?(info_plist_path)
puts "\nInfo.plist contents:"
puts "CFBundleVersion: #{`/usr/libexec/PlistBuddy -c 'Print CFBundleVersion' "#{info_plist_path}" 2>&1`.strip}"
puts "CFBundleShortVersionString: #{`/usr/libexec/PlistBuddy -c 'Print CFBundleShortVersionString' "#{info_plist_path}" 2>&1`.strip}"
puts "CFBundleIdentifier: #{`/usr/libexec/PlistBuddy -c 'Print CFBundleIdentifier' "#{info_plist_path}" 2>&1`.strip}"
else
puts "Warning: Info.plist not found at #{info_plist_path}"
end

puts "\nAttempting to notarize app bundle..."
notarize(
package: path,
api_key_path: APPLE_API_KEY_PATH
)
puts "Notarization completed for app bundle"
end

Dir[File.join(BUILDS_FOLDER, '**', 'Studio-*.dmg')].each do |path|
puts "\nAttempting to notarize DMG at: #{path}"
notarize(
bundle_id: APPLE_BUNDLE_IDENTIFIER,
package: path,
api_key_path: APPLE_API_KEY_PATH
)
puts "Notarization completed for DMG"
end

puts "\n=== Notarization process completed ==="
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need these changes? Seems like it's all just logging calls

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for catching this. I was getting some errors and added those lines as debug.
I cleaned up now.

@bcotrim bcotrim merged commit 48c6da4 into trunk Feb 13, 2025
7 checks passed
@bcotrim bcotrim deleted the fix/dev_versions branch February 13, 2025 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants