mirror of
https://github.com/discourse/discourse.git
synced 2026-08-05 18:57:20 -05:00
DEV: Drop leading zeros from version number (#37010)
We originally intended to format our new calendar-based version numbers with leading zeros in the 'minor' (/month) segment. However, leading zeros are actually invalid semver, and these version numbers will fail to parse in some version-number libraries (e.g. npm's `semver` lib). This commit switches the currently-in-development version from `2026.01` to `2026.1`. No released versions are affected, because they were `.11` and `.12`.
This commit is contained in:
@@ -225,11 +225,11 @@ namespace :release do
|
||||
if Gem::Version.new(target_version_number) <= Gem::Version.new(current_version)
|
||||
puts "Target version #{current_version} is already >= #{target_version_number}. Incrementing instead."
|
||||
major, minor, patch_and_pre = current_version.split(".")
|
||||
minor = (minor.to_i + 1).to_s.rjust(2, "0")
|
||||
minor = (minor.to_i + 1).to_s
|
||||
|
||||
if minor.to_i > 12 && Time.now.month == 12
|
||||
major = (major.to_i + 1).to_s
|
||||
minor = "01"
|
||||
minor = "1"
|
||||
end
|
||||
|
||||
target_version_number = "#{major}.#{minor}.#{patch_and_pre}"
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ module Discourse
|
||||
unless defined?(::Discourse::VERSION)
|
||||
module VERSION #:nodoc:
|
||||
# Use the `version_bump:*` rake tasks to update this value
|
||||
STRING = "2026.01.0-latest"
|
||||
STRING = "2026.1.0-latest"
|
||||
|
||||
PARTS = STRING.split(".")
|
||||
private_constant :PARTS
|
||||
|
||||
@@ -258,7 +258,7 @@ RSpec.describe "tasks/version_bump" do
|
||||
run "git", "reset", "--hard"
|
||||
run "git", "checkout", "version-bump/main"
|
||||
version_rb_content = File.read("lib/version.rb")
|
||||
expect(version_rb_content).to include('STRING = "2026.01.0-latest"')
|
||||
expect(version_rb_content).to include('STRING = "2026.1.0-latest"')
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user