@sentry/craft 2.14.0 → 2.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/craft +448 -195
  2. package/dist/craft.map +4 -4
  3. package/package.json +1 -1
package/dist/craft CHANGED
@@ -61744,10 +61744,30 @@ async function promptConfirmation() {
61744
61744
  function hasInput() {
61745
61745
  return !GLOBAL_FLAGS["no-input"];
61746
61746
  }
61747
- var import_prompts, FALSY_ENV_VALUES2, GLOBAL_FLAGS;
61747
+ function setGitHubActionsOutput(name, value) {
61748
+ const outputFile = process.env.GITHUB_OUTPUT;
61749
+ if (!outputFile) {
61750
+ return;
61751
+ }
61752
+ if (value.includes("\n")) {
61753
+ const delimiter2 = `EOF_${Date.now()}_${Math.random().toString(36).slice(2)}`;
61754
+ (0, import_fs4.appendFileSync)(
61755
+ outputFile,
61756
+ `${name}<<${delimiter2}
61757
+ ${value}
61758
+ ${delimiter2}
61759
+ `
61760
+ );
61761
+ } else {
61762
+ (0, import_fs4.appendFileSync)(outputFile, `${name}=${value}
61763
+ `);
61764
+ }
61765
+ }
61766
+ var import_fs4, import_prompts, FALSY_ENV_VALUES2, GLOBAL_FLAGS;
61748
61767
  var init_helpers = __esm({
61749
61768
  "src/utils/helpers.ts"() {
61750
61769
  init_import_meta_url();
61770
+ import_fs4 = require("fs");
61751
61771
  import_prompts = __toESM(require_prompts3());
61752
61772
  init_logger2();
61753
61773
  FALSY_ENV_VALUES2 = /* @__PURE__ */ new Set(["", "undefined", "null", "0", "false", "no"]);
@@ -61802,7 +61822,7 @@ var require_package = __commonJS({
61802
61822
  "package.json"(exports2, module2) {
61803
61823
  module2.exports = {
61804
61824
  name: "@sentry/craft",
61805
- version: "2.14.0",
61825
+ version: "2.15.0",
61806
61826
  description: "The universal sentry workflow CLI",
61807
61827
  main: "dist/craft",
61808
61828
  repository: "https://github.com/getsentry/craft",
@@ -61968,7 +61988,7 @@ function getPackage() {
61968
61988
  }
61969
61989
  function getPackageVersion() {
61970
61990
  const { version: version2 } = getPackage();
61971
- const buildInfo = "8c1d5d40c99e031f7e2340f71c2c7197d9cfdb31";
61991
+ const buildInfo = "204f7e3577e06c243423569497eeccfa5eb29da9";
61972
61992
  return buildInfo ? `${version2} (${buildInfo})` : version2;
61973
61993
  }
61974
61994
  function semVerToString(s3) {
@@ -138603,7 +138623,7 @@ var require_graceful_fs = __commonJS({
138603
138623
  var require_semver2 = __commonJS({
138604
138624
  "node_modules/make-dir/node_modules/semver/semver.js"(exports2, module2) {
138605
138625
  init_import_meta_url();
138606
- exports2 = module2.exports = SemVer2;
138626
+ exports2 = module2.exports = SemVer3;
138607
138627
  var debug3;
138608
138628
  if (typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG)) {
138609
138629
  debug3 = function() {
@@ -138745,7 +138765,7 @@ var require_semver2 = __commonJS({
138745
138765
  includePrerelease: false
138746
138766
  };
138747
138767
  }
138748
- if (version2 instanceof SemVer2) {
138768
+ if (version2 instanceof SemVer3) {
138749
138769
  return version2;
138750
138770
  }
138751
138771
  if (typeof version2 !== "string") {
@@ -138759,7 +138779,7 @@ var require_semver2 = __commonJS({
138759
138779
  return null;
138760
138780
  }
138761
138781
  try {
138762
- return new SemVer2(version2, options);
138782
+ return new SemVer3(version2, options);
138763
138783
  } catch (er) {
138764
138784
  return null;
138765
138785
  }
@@ -138774,15 +138794,15 @@ var require_semver2 = __commonJS({
138774
138794
  var s3 = parse4(version2.trim().replace(/^[=v]+/, ""), options);
138775
138795
  return s3 ? s3.version : null;
138776
138796
  }
138777
- exports2.SemVer = SemVer2;
138778
- function SemVer2(version2, options) {
138797
+ exports2.SemVer = SemVer3;
138798
+ function SemVer3(version2, options) {
138779
138799
  if (!options || typeof options !== "object") {
138780
138800
  options = {
138781
138801
  loose: !!options,
138782
138802
  includePrerelease: false
138783
138803
  };
138784
138804
  }
138785
- if (version2 instanceof SemVer2) {
138805
+ if (version2 instanceof SemVer3) {
138786
138806
  if (version2.loose === options.loose) {
138787
138807
  return version2;
138788
138808
  } else {
@@ -138794,8 +138814,8 @@ var require_semver2 = __commonJS({
138794
138814
  if (version2.length > MAX_LENGTH) {
138795
138815
  throw new TypeError("version is longer than " + MAX_LENGTH + " characters");
138796
138816
  }
138797
- if (!(this instanceof SemVer2)) {
138798
- return new SemVer2(version2, options);
138817
+ if (!(this instanceof SemVer3)) {
138818
+ return new SemVer3(version2, options);
138799
138819
  }
138800
138820
  debug3("SemVer", version2, options);
138801
138821
  this.options = options;
@@ -138833,32 +138853,32 @@ var require_semver2 = __commonJS({
138833
138853
  this.build = m3[5] ? m3[5].split(".") : [];
138834
138854
  this.format();
138835
138855
  }
138836
- SemVer2.prototype.format = function() {
138856
+ SemVer3.prototype.format = function() {
138837
138857
  this.version = this.major + "." + this.minor + "." + this.patch;
138838
138858
  if (this.prerelease.length) {
138839
138859
  this.version += "-" + this.prerelease.join(".");
138840
138860
  }
138841
138861
  return this.version;
138842
138862
  };
138843
- SemVer2.prototype.toString = function() {
138863
+ SemVer3.prototype.toString = function() {
138844
138864
  return this.version;
138845
138865
  };
138846
- SemVer2.prototype.compare = function(other) {
138866
+ SemVer3.prototype.compare = function(other) {
138847
138867
  debug3("SemVer.compare", this.version, this.options, other);
138848
- if (!(other instanceof SemVer2)) {
138849
- other = new SemVer2(other, this.options);
138868
+ if (!(other instanceof SemVer3)) {
138869
+ other = new SemVer3(other, this.options);
138850
138870
  }
138851
138871
  return this.compareMain(other) || this.comparePre(other);
138852
138872
  };
138853
- SemVer2.prototype.compareMain = function(other) {
138854
- if (!(other instanceof SemVer2)) {
138855
- other = new SemVer2(other, this.options);
138873
+ SemVer3.prototype.compareMain = function(other) {
138874
+ if (!(other instanceof SemVer3)) {
138875
+ other = new SemVer3(other, this.options);
138856
138876
  }
138857
138877
  return compareIdentifiers(this.major, other.major) || compareIdentifiers(this.minor, other.minor) || compareIdentifiers(this.patch, other.patch);
138858
138878
  };
138859
- SemVer2.prototype.comparePre = function(other) {
138860
- if (!(other instanceof SemVer2)) {
138861
- other = new SemVer2(other, this.options);
138879
+ SemVer3.prototype.comparePre = function(other) {
138880
+ if (!(other instanceof SemVer3)) {
138881
+ other = new SemVer3(other, this.options);
138862
138882
  }
138863
138883
  if (this.prerelease.length && !other.prerelease.length) {
138864
138884
  return -1;
@@ -138885,9 +138905,9 @@ var require_semver2 = __commonJS({
138885
138905
  }
138886
138906
  } while (++i4);
138887
138907
  };
138888
- SemVer2.prototype.compareBuild = function(other) {
138889
- if (!(other instanceof SemVer2)) {
138890
- other = new SemVer2(other, this.options);
138908
+ SemVer3.prototype.compareBuild = function(other) {
138909
+ if (!(other instanceof SemVer3)) {
138910
+ other = new SemVer3(other, this.options);
138891
138911
  }
138892
138912
  var i4 = 0;
138893
138913
  do {
@@ -138907,7 +138927,7 @@ var require_semver2 = __commonJS({
138907
138927
  }
138908
138928
  } while (++i4);
138909
138929
  };
138910
- SemVer2.prototype.inc = function(release3, identifier) {
138930
+ SemVer3.prototype.inc = function(release3, identifier) {
138911
138931
  switch (release3) {
138912
138932
  case "premajor":
138913
138933
  this.prerelease.length = 0;
@@ -138997,7 +139017,7 @@ var require_semver2 = __commonJS({
138997
139017
  loose = void 0;
138998
139018
  }
138999
139019
  try {
139000
- return new SemVer2(version2, loose).inc(release3, identifier).version;
139020
+ return new SemVer3(version2, loose).inc(release3, identifier).version;
139001
139021
  } catch (er) {
139002
139022
  return null;
139003
139023
  }
@@ -139041,19 +139061,19 @@ var require_semver2 = __commonJS({
139041
139061
  }
139042
139062
  exports2.major = major2;
139043
139063
  function major2(a3, loose) {
139044
- return new SemVer2(a3, loose).major;
139064
+ return new SemVer3(a3, loose).major;
139045
139065
  }
139046
139066
  exports2.minor = minor;
139047
139067
  function minor(a3, loose) {
139048
- return new SemVer2(a3, loose).minor;
139068
+ return new SemVer3(a3, loose).minor;
139049
139069
  }
139050
139070
  exports2.patch = patch;
139051
139071
  function patch(a3, loose) {
139052
- return new SemVer2(a3, loose).patch;
139072
+ return new SemVer3(a3, loose).patch;
139053
139073
  }
139054
139074
  exports2.compare = compare;
139055
139075
  function compare(a3, b3, loose) {
139056
- return new SemVer2(a3, loose).compare(new SemVer2(b3, loose));
139076
+ return new SemVer3(a3, loose).compare(new SemVer3(b3, loose));
139057
139077
  }
139058
139078
  exports2.compareLoose = compareLoose;
139059
139079
  function compareLoose(a3, b3) {
@@ -139061,8 +139081,8 @@ var require_semver2 = __commonJS({
139061
139081
  }
139062
139082
  exports2.compareBuild = compareBuild;
139063
139083
  function compareBuild(a3, b3, loose) {
139064
- var versionA = new SemVer2(a3, loose);
139065
- var versionB = new SemVer2(b3, loose);
139084
+ var versionA = new SemVer3(a3, loose);
139085
+ var versionB = new SemVer3(b3, loose);
139066
139086
  return versionA.compare(versionB) || versionA.compareBuild(versionB);
139067
139087
  }
139068
139088
  exports2.rcompare = rcompare;
@@ -139182,7 +139202,7 @@ var require_semver2 = __commonJS({
139182
139202
  if (!m3[2]) {
139183
139203
  this.semver = ANY;
139184
139204
  } else {
139185
- this.semver = new SemVer2(m3[2], this.options.loose);
139205
+ this.semver = new SemVer3(m3[2], this.options.loose);
139186
139206
  }
139187
139207
  };
139188
139208
  Comparator.prototype.toString = function() {
@@ -139195,7 +139215,7 @@ var require_semver2 = __commonJS({
139195
139215
  }
139196
139216
  if (typeof version2 === "string") {
139197
139217
  try {
139198
- version2 = new SemVer2(version2, this.options);
139218
+ version2 = new SemVer3(version2, this.options);
139199
139219
  } catch (er) {
139200
139220
  return false;
139201
139221
  }
@@ -139516,7 +139536,7 @@ var require_semver2 = __commonJS({
139516
139536
  }
139517
139537
  if (typeof version2 === "string") {
139518
139538
  try {
139519
- version2 = new SemVer2(version2, this.options);
139539
+ version2 = new SemVer3(version2, this.options);
139520
139540
  } catch (er) {
139521
139541
  return false;
139522
139542
  }
@@ -139573,7 +139593,7 @@ var require_semver2 = __commonJS({
139573
139593
  if (rangeObj.test(v6)) {
139574
139594
  if (!max || maxSV.compare(v6) === -1) {
139575
139595
  max = v6;
139576
- maxSV = new SemVer2(max, options);
139596
+ maxSV = new SemVer3(max, options);
139577
139597
  }
139578
139598
  }
139579
139599
  });
@@ -139592,7 +139612,7 @@ var require_semver2 = __commonJS({
139592
139612
  if (rangeObj.test(v6)) {
139593
139613
  if (!min || minSV.compare(v6) === 1) {
139594
139614
  min = v6;
139595
- minSV = new SemVer2(min, options);
139615
+ minSV = new SemVer3(min, options);
139596
139616
  }
139597
139617
  }
139598
139618
  });
@@ -139601,11 +139621,11 @@ var require_semver2 = __commonJS({
139601
139621
  exports2.minVersion = minVersion;
139602
139622
  function minVersion(range3, loose) {
139603
139623
  range3 = new Range(range3, loose);
139604
- var minver = new SemVer2("0.0.0");
139624
+ var minver = new SemVer3("0.0.0");
139605
139625
  if (range3.test(minver)) {
139606
139626
  return minver;
139607
139627
  }
139608
- minver = new SemVer2("0.0.0-0");
139628
+ minver = new SemVer3("0.0.0-0");
139609
139629
  if (range3.test(minver)) {
139610
139630
  return minver;
139611
139631
  }
@@ -139613,7 +139633,7 @@ var require_semver2 = __commonJS({
139613
139633
  for (var i4 = 0; i4 < range3.set.length; ++i4) {
139614
139634
  var comparators = range3.set[i4];
139615
139635
  comparators.forEach(function(comparator) {
139616
- var compver = new SemVer2(comparator.semver.version);
139636
+ var compver = new SemVer3(comparator.semver.version);
139617
139637
  switch (comparator.operator) {
139618
139638
  case ">":
139619
139639
  if (compver.prerelease.length === 0) {
@@ -139661,7 +139681,7 @@ var require_semver2 = __commonJS({
139661
139681
  }
139662
139682
  exports2.outside = outside;
139663
139683
  function outside(version2, range3, hilo, options) {
139664
- version2 = new SemVer2(version2, options);
139684
+ version2 = new SemVer3(version2, options);
139665
139685
  range3 = new Range(range3, options);
139666
139686
  var gtfn, ltefn, ltfn, comp, ecomp;
139667
139687
  switch (hilo) {
@@ -139725,7 +139745,7 @@ var require_semver2 = __commonJS({
139725
139745
  }
139726
139746
  exports2.coerce = coerce;
139727
139747
  function coerce(version2, options) {
139728
- if (version2 instanceof SemVer2) {
139748
+ if (version2 instanceof SemVer3) {
139729
139749
  return version2;
139730
139750
  }
139731
139751
  if (typeof version2 === "number") {
@@ -154861,6 +154881,37 @@ var require_projectConfig_schema = __commonJS({
154861
154881
  },
154862
154882
  additionalProperties: false,
154863
154883
  required: ["name"]
154884
+ },
154885
+ versioning: {
154886
+ title: "VersioningConfig",
154887
+ description: "Version resolution configuration",
154888
+ type: "object",
154889
+ properties: {
154890
+ policy: {
154891
+ title: "VersioningPolicy",
154892
+ description: "Default versioning policy when no version argument is provided. auto: analyze commits to determine bump type, manual: require explicit version, calver: use calendar versioning",
154893
+ type: "string",
154894
+ enum: ["auto", "manual", "calver"],
154895
+ tsEnumNames: ["Auto", "Manual", "CalVer"]
154896
+ },
154897
+ calver: {
154898
+ title: "CalVerConfig",
154899
+ description: "Calendar versioning configuration",
154900
+ type: "object",
154901
+ properties: {
154902
+ offset: {
154903
+ type: "number",
154904
+ description: "Days to go back for date calculation (default: 14)"
154905
+ },
154906
+ format: {
154907
+ type: "string",
154908
+ description: "strftime-like format for date part (default: %y.%-m). Supports: %y (2-digit year), %m (zero-padded month), %-m (month without padding)"
154909
+ }
154910
+ },
154911
+ additionalProperties: false
154912
+ }
154913
+ },
154914
+ additionalProperties: false
154864
154915
  }
154865
154916
  },
154866
154917
  additionalProperties: false,
@@ -158342,7 +158393,7 @@ function readReleaseConfig() {
158342
158393
  }
158343
158394
  const releaseConfigPath = (0, import_path7.join)(configFileDir, ".github", "release.yml");
158344
158395
  try {
158345
- const fileContents = (0, import_fs4.readFileSync)(releaseConfigPath, "utf8");
158396
+ const fileContents = (0, import_fs5.readFileSync)(releaseConfigPath, "utf8");
158346
158397
  const config3 = load(fileContents);
158347
158398
  return config3;
158348
158399
  } catch (error3) {
@@ -158564,7 +158615,7 @@ async function generateChangesetFromGitImpl(git, rev, maxLeftovers) {
158564
158615
  if (shouldExcludePR(labels, author, releaseConfig)) {
158565
158616
  continue;
158566
158617
  }
158567
- const titleForMatching = githubCommit?.prTitle ?? gitCommit.title;
158618
+ const titleForMatching = (githubCommit?.prTitle ?? gitCommit.title).trim();
158568
158619
  const matchedCategory = matchCommitToCategory(
158569
158620
  labels,
158570
158621
  author,
@@ -158610,7 +158661,7 @@ async function generateChangesetFromGitImpl(git, rev, maxLeftovers) {
158610
158661
  };
158611
158662
  categories.set(categoryTitle, category);
158612
158663
  }
158613
- const prTitle = commit.prTitle ?? commit.title;
158664
+ const prTitle = (commit.prTitle ?? commit.title).trim();
158614
158665
  const scope = extractScope(prTitle);
158615
158666
  let scopeGroup = category.scopeGroups.get(scope);
158616
158667
  if (!scopeGroup) {
@@ -158677,14 +158728,8 @@ async function generateChangesetFromGitImpl(git, rev, maxLeftovers) {
158677
158728
  const hasScopeHeaders = [...category.scopeGroups.entries()].some(
158678
158729
  ([s3, entries]) => s3 !== null && entries.length > 1
158679
158730
  );
158731
+ const entriesWithoutHeaders = [];
158680
158732
  for (const [scope, prs] of sortedScopes) {
158681
- if (scopeGroupingEnabled && scope !== null && prs.length > 1) {
158682
- changelogSections.push(
158683
- markdownHeader(SCOPE_HEADER_LEVEL, formatScopeTitle(scope))
158684
- );
158685
- } else if (scopeGroupingEnabled && scope === null && hasScopeHeaders) {
158686
- changelogSections.push(markdownHeader(SCOPE_HEADER_LEVEL, "Other"));
158687
- }
158688
158733
  const prEntries = prs.map(
158689
158734
  (pr) => formatChangelogEntry({
158690
158735
  title: pr.title,
@@ -158695,7 +158740,23 @@ async function generateChangesetFromGitImpl(git, rev, maxLeftovers) {
158695
158740
  repoUrl
158696
158741
  })
158697
158742
  );
158698
- changelogSections.push(prEntries.join("\n"));
158743
+ let scopeHeader = null;
158744
+ if (scopeGroupingEnabled) {
158745
+ if (scope !== null && prs.length > 1) {
158746
+ scopeHeader = formatScopeTitle(scope);
158747
+ } else if (scope === null && hasScopeHeaders) {
158748
+ scopeHeader = "Other";
158749
+ }
158750
+ }
158751
+ if (scopeHeader) {
158752
+ changelogSections.push(markdownHeader(SCOPE_HEADER_LEVEL, scopeHeader));
158753
+ changelogSections.push(prEntries.join("\n"));
158754
+ } else {
158755
+ entriesWithoutHeaders.push(...prEntries);
158756
+ }
158757
+ }
158758
+ if (entriesWithoutHeaders.length > 0) {
158759
+ changelogSections.push(entriesWithoutHeaders.join("\n"));
158699
158760
  }
158700
158761
  }
158701
158762
  const nLeftovers = leftovers.length;
@@ -158706,7 +158767,7 @@ async function generateChangesetFromGitImpl(git, rev, maxLeftovers) {
158706
158767
  changelogSections.push(
158707
158768
  leftovers.slice(0, maxLeftovers).map(
158708
158769
  (commit) => formatChangelogEntry({
158709
- title: commit.prTitle ?? commit.title,
158770
+ title: (commit.prTitle ?? commit.title).trim(),
158710
158771
  author: commit.author,
158711
158772
  prNumber: commit.pr ?? void 0,
158712
158773
  hash: commit.hash,
@@ -158796,11 +158857,11 @@ async function getPRAndLabelsFromCommit(hashes) {
158796
158857
  })
158797
158858
  );
158798
158859
  }
158799
- var import_fs4, import_path7, BUMP_TYPES, DEFAULT_CHANGELOG_PATH, DEFAULT_UNRELEASED_TITLE, SKIP_CHANGELOG_MAGIC_WORD, BODY_IN_CHANGELOG_MAGIC_WORD, DEFAULT_CHANGESET_BODY, VERSION_HEADER_LEVEL, SUBSECTION_HEADER_LEVEL, SCOPE_HEADER_LEVEL, MAX_COMMITS_PER_QUERY, MAX_LEFTOVERS, DEFAULT_RELEASE_CONFIG, SHORT_SHA_LENGTH, changesetCache;
158860
+ var import_fs5, import_path7, BUMP_TYPES, DEFAULT_CHANGELOG_PATH, DEFAULT_UNRELEASED_TITLE, SKIP_CHANGELOG_MAGIC_WORD, BODY_IN_CHANGELOG_MAGIC_WORD, DEFAULT_CHANGESET_BODY, VERSION_HEADER_LEVEL, SUBSECTION_HEADER_LEVEL, SCOPE_HEADER_LEVEL, MAX_COMMITS_PER_QUERY, MAX_LEFTOVERS, DEFAULT_RELEASE_CONFIG, SHORT_SHA_LENGTH, changesetCache;
158800
158861
  var init_changelog = __esm({
158801
158862
  "src/utils/changelog.ts"() {
158802
158863
  init_import_meta_url();
158803
- import_fs4 = require("fs");
158864
+ import_fs5 = require("fs");
158804
158865
  import_path7 = require("path");
158805
158866
  init_js_yaml();
158806
158867
  init_logger2();
@@ -158854,7 +158915,7 @@ var init_changelog = __esm({
158854
158915
  },
158855
158916
  {
158856
158917
  title: "Build / dependencies / internal \u{1F527}",
158857
- commit_patterns: ["^(?:build|refactor|meta|chore|ci)\\b"],
158918
+ commit_patterns: ["^(?:build|refactor|meta|chore|ci|ref|perf)\\b"],
158858
158919
  semver: "patch"
158859
158920
  }
158860
158921
  ]
@@ -158871,11 +158932,11 @@ function isLatestRelease(githubRelease, version2) {
158871
158932
  const versionToPublish = parseVersion(version2);
158872
158933
  return latestVersion && versionToPublish ? versionGreaterOrEqualThan(versionToPublish, latestVersion) : true;
158873
158934
  }
158874
- var import_fs5, import_path8, DEFAULT_CONTENT_TYPE, GitHubTarget;
158935
+ var import_fs6, import_path8, DEFAULT_CONTENT_TYPE, GitHubTarget;
158875
158936
  var init_github3 = __esm({
158876
158937
  "src/targets/github.ts"() {
158877
158938
  init_import_meta_url();
158878
- import_fs5 = require("fs");
158939
+ import_fs6 = require("fs");
158879
158940
  import_path8 = require("path");
158880
158941
  init_config2();
158881
158942
  init_project_config();
@@ -158908,7 +158969,8 @@ var init_github3 = __esm({
158908
158969
  changelog,
158909
158970
  previewReleases: this.config.previewReleases === void 0 || !!this.config.previewReleases,
158910
158971
  tagPrefix: this.config.tagPrefix || "",
158911
- tagOnly: !!this.config.tagOnly
158972
+ tagOnly: !!this.config.tagOnly,
158973
+ floatingTags: this.config.floatingTags || []
158912
158974
  };
158913
158975
  this.github = getGitHubClient();
158914
158976
  }
@@ -158951,7 +159013,7 @@ var init_github3 = __esm({
158951
159013
  async getChangelog(version2) {
158952
159014
  let changelog;
158953
159015
  try {
158954
- changelog = (await import_fs5.promises.readFile(this.githubConfig.changelog)).toString();
159016
+ changelog = (await import_fs6.promises.readFile(this.githubConfig.changelog)).toString();
158955
159017
  } catch (err) {
158956
159018
  logger.error("Cannot read changelog, moving on without one", err);
158957
159019
  }
@@ -159046,9 +159108,9 @@ var init_github3 = __esm({
159046
159108
  }
159047
159109
  async handleGitHubUpload(release3, path17, contentType, retries = 3) {
159048
159110
  const contentTypeProcessed = contentType || DEFAULT_CONTENT_TYPE;
159049
- const stats = (0, import_fs5.statSync)(path17);
159111
+ const stats = (0, import_fs6.statSync)(path17);
159050
159112
  const name = (0, import_path8.basename)(path17);
159051
- const file = (0, import_fs5.createReadStream)(path17);
159113
+ const file = (0, import_fs6.createReadStream)(path17);
159052
159114
  const params = {
159053
159115
  ...this.githubConfig,
159054
159116
  headers: {
@@ -159134,6 +159196,71 @@ var init_github3 = __esm({
159134
159196
  });
159135
159197
  }
159136
159198
  }
159199
+ /**
159200
+ * Resolves a floating tag pattern by replacing placeholders with version components.
159201
+ *
159202
+ * @param pattern The pattern string (e.g., "v{major}")
159203
+ * @param parsedVersion The parsed semantic version
159204
+ * @returns The resolved tag name (e.g., "v2")
159205
+ */
159206
+ resolveFloatingTag(pattern, parsedVersion) {
159207
+ return pattern.replace("{major}", String(parsedVersion.major)).replace("{minor}", String(parsedVersion.minor)).replace("{patch}", String(parsedVersion.patch));
159208
+ }
159209
+ /**
159210
+ * Creates or updates floating tags for the release.
159211
+ *
159212
+ * Floating tags (like "v2") point to the latest release in a major version line.
159213
+ * They are force-updated if they already exist.
159214
+ *
159215
+ * @param version The version being released
159216
+ * @param revision Git commit SHA to point the tags to
159217
+ */
159218
+ async updateFloatingTags(version2, revision) {
159219
+ const floatingTags = this.githubConfig.floatingTags;
159220
+ if (!floatingTags || floatingTags.length === 0) {
159221
+ return;
159222
+ }
159223
+ const parsedVersion = parseVersion(version2);
159224
+ if (!parsedVersion) {
159225
+ this.logger.warn(
159226
+ `Cannot parse version "${version2}" for floating tags, skipping`
159227
+ );
159228
+ return;
159229
+ }
159230
+ for (const pattern of floatingTags) {
159231
+ const tag2 = this.resolveFloatingTag(pattern, parsedVersion);
159232
+ const tagRef = `refs/tags/${tag2}`;
159233
+ if (isDryRun()) {
159234
+ this.logger.info(
159235
+ `[dry-run] Not updating floating tag: "${tag2}" (from pattern "${pattern}")`
159236
+ );
159237
+ continue;
159238
+ }
159239
+ this.logger.info(`Updating floating tag: "${tag2}"...`);
159240
+ try {
159241
+ await this.github.rest.git.updateRef({
159242
+ owner: this.githubConfig.owner,
159243
+ repo: this.githubConfig.repo,
159244
+ ref: `tags/${tag2}`,
159245
+ sha: revision,
159246
+ force: true
159247
+ });
159248
+ this.logger.debug(`Updated existing floating tag: "${tag2}"`);
159249
+ } catch (error3) {
159250
+ if (error3.status === 422) {
159251
+ await this.github.rest.git.createRef({
159252
+ owner: this.githubConfig.owner,
159253
+ repo: this.githubConfig.repo,
159254
+ ref: tagRef,
159255
+ sha: revision
159256
+ });
159257
+ this.logger.debug(`Created new floating tag: "${tag2}"`);
159258
+ } else {
159259
+ throw error3;
159260
+ }
159261
+ }
159262
+ }
159263
+ }
159137
159264
  /**
159138
159265
  * Creates a new GitHub release and publish all available artifacts.
159139
159266
  *
@@ -159147,7 +159274,9 @@ var init_github3 = __esm({
159147
159274
  this.logger.info(
159148
159275
  `Not creating a GitHub release because "tagOnly" flag was set.`
159149
159276
  );
159150
- return this.createGitTag(version2, revision);
159277
+ await this.createGitTag(version2, revision);
159278
+ await this.updateFloatingTags(version2, revision);
159279
+ return;
159151
159280
  }
159152
159281
  const config3 = getConfiguration();
159153
159282
  let changelog;
@@ -159189,6 +159318,7 @@ var init_github3 = __esm({
159189
159318
  )
159190
159319
  );
159191
159320
  await this.publishRelease(draftRelease, { makeLatest });
159321
+ await this.updateFloatingTags(version2, revision);
159192
159322
  }
159193
159323
  };
159194
159324
  }
@@ -163097,23 +163227,23 @@ var init_esm13 = __esm({
163097
163227
  });
163098
163228
 
163099
163229
  // node_modules/path-scurry/dist/esm/index.js
163100
- var import_node_path6, import_node_url, import_fs6, actualFS, import_promises, realpathSync, defaultFS, fsFromOption, uncDriveRegexp, uncToDrive, eitherSep, UNKNOWN, IFIFO, IFCHR, IFDIR, IFBLK, IFREG, IFLNK, IFSOCK, IFMT, IFMT_UNKNOWN, READDIR_CALLED, LSTAT_CALLED, ENOTDIR, ENOENT, ENOREADLINK, ENOREALPATH, ENOCHILD, TYPEMASK, entToType, normalizeCache, normalize4, normalizeNocaseCache, normalizeNocase, ResolveCache, ChildrenCache, setAsCwd, PathBase, PathWin32, PathPosix, PathScurryBase, PathScurryWin32, PathScurryPosix, PathScurryDarwin, Path, PathScurry;
163230
+ var import_node_path6, import_node_url, import_fs7, actualFS, import_promises, realpathSync, defaultFS, fsFromOption, uncDriveRegexp, uncToDrive, eitherSep, UNKNOWN, IFIFO, IFCHR, IFDIR, IFBLK, IFREG, IFLNK, IFSOCK, IFMT, IFMT_UNKNOWN, READDIR_CALLED, LSTAT_CALLED, ENOTDIR, ENOENT, ENOREADLINK, ENOREALPATH, ENOCHILD, TYPEMASK, entToType, normalizeCache, normalize4, normalizeNocaseCache, normalizeNocase, ResolveCache, ChildrenCache, setAsCwd, PathBase, PathWin32, PathPosix, PathScurryBase, PathScurryWin32, PathScurryPosix, PathScurryDarwin, Path, PathScurry;
163101
163231
  var init_esm14 = __esm({
163102
163232
  "node_modules/path-scurry/dist/esm/index.js"() {
163103
163233
  init_import_meta_url();
163104
163234
  init_esm12();
163105
163235
  import_node_path6 = require("node:path");
163106
163236
  import_node_url = require("node:url");
163107
- import_fs6 = require("fs");
163237
+ import_fs7 = require("fs");
163108
163238
  actualFS = __toESM(require("node:fs"), 1);
163109
163239
  import_promises = require("node:fs/promises");
163110
163240
  init_esm13();
163111
- realpathSync = import_fs6.realpathSync.native;
163241
+ realpathSync = import_fs7.realpathSync.native;
163112
163242
  defaultFS = {
163113
- lstatSync: import_fs6.lstatSync,
163114
- readdir: import_fs6.readdir,
163115
- readdirSync: import_fs6.readdirSync,
163116
- readlinkSync: import_fs6.readlinkSync,
163243
+ lstatSync: import_fs7.lstatSync,
163244
+ readdir: import_fs7.readdir,
163245
+ readdirSync: import_fs7.readdirSync,
163246
+ readlinkSync: import_fs7.readlinkSync,
163117
163247
  realpathSync,
163118
163248
  promises: {
163119
163249
  lstat: import_promises.lstat,
@@ -165966,7 +166096,7 @@ function isNotFoundError(err) {
165966
166096
  function readPackageJson(packagePath) {
165967
166097
  const packageJsonPath = path9.join(packagePath, "package.json");
165968
166098
  try {
165969
- return JSON.parse((0, import_fs7.readFileSync)(packageJsonPath, "utf-8"));
166099
+ return JSON.parse((0, import_fs8.readFileSync)(packageJsonPath, "utf-8"));
165970
166100
  } catch (err) {
165971
166101
  if (!isNotFoundError(err)) {
165972
166102
  logger.warn(`Failed to parse ${packageJsonPath}:`, err);
@@ -166025,7 +166155,7 @@ async function resolveWorkspaceGlobs(rootDir, patterns) {
166025
166155
  }
166026
166156
  function fileExists(filePath) {
166027
166157
  try {
166028
- (0, import_fs7.readFileSync)(filePath);
166158
+ (0, import_fs8.readFileSync)(filePath);
166029
166159
  return true;
166030
166160
  } catch (err) {
166031
166161
  return false;
@@ -166051,7 +166181,7 @@ async function discoverPnpmWorkspaces(rootDir) {
166051
166181
  const pnpmWorkspacePath = path9.join(rootDir, "pnpm-workspace.yaml");
166052
166182
  let config3;
166053
166183
  try {
166054
- const content = (0, import_fs7.readFileSync)(pnpmWorkspacePath, "utf-8");
166184
+ const content = (0, import_fs8.readFileSync)(pnpmWorkspacePath, "utf-8");
166055
166185
  config3 = load(content);
166056
166186
  } catch (err) {
166057
166187
  if (!isNotFoundError(err)) {
@@ -166156,11 +166286,11 @@ function topologicalSortPackages(packages) {
166156
166286
  return depthA - depthB;
166157
166287
  });
166158
166288
  }
166159
- var import_fs7, path9;
166289
+ var import_fs8, path9;
166160
166290
  var init_workspaces = __esm({
166161
166291
  "src/utils/workspaces.ts"() {
166162
166292
  init_import_meta_url();
166163
- import_fs7 = require("fs");
166293
+ import_fs8 = require("fs");
166164
166294
  path9 = __toESM(require("path"));
166165
166295
  init_js_yaml();
166166
166296
  init_esm15();
@@ -166181,7 +166311,7 @@ async function getLatestVersion(packageName, npmConfig, otp) {
166181
166311
  }
166182
166312
  spawnOptions.env[NPM_TOKEN_ENV_VAR] = npmConfig.token;
166183
166313
  spawnOptions.env.npm_config_userconfig = filePath;
166184
- (0, import_fs8.writeFileSync)(
166314
+ (0, import_fs9.writeFileSync)(
166185
166315
  filePath,
166186
166316
  `//registry.npmjs.org/:_authToken=\${${NPM_TOKEN_ENV_VAR}}`
166187
166317
  );
@@ -166226,7 +166356,7 @@ async function getPublishTag(version2, checkPackageName, npmConfig, logger3, otp
166226
166356
  }
166227
166357
  return void 0;
166228
166358
  }
166229
- var import_child_process3, import_prompts2, import_fs8, NPM_BIN, YARN_BIN, NPM_MIN_MAJOR, NPM_MIN_MINOR, NPM_TOKEN_ENV_VAR, DEFAULT_PACKAGE_REGEX, NpmPackageAccess, NpmTarget;
166359
+ var import_child_process3, import_prompts2, import_fs9, NPM_BIN, YARN_BIN, NPM_MIN_MAJOR, NPM_MIN_MINOR, NPM_TOKEN_ENV_VAR, DEFAULT_PACKAGE_REGEX, NpmPackageAccess, NpmTarget;
166230
166360
  var init_npm = __esm({
166231
166361
  "src/targets/npm.ts"() {
166232
166362
  init_import_meta_url();
@@ -166240,7 +166370,7 @@ var init_npm = __esm({
166240
166370
  init_workspaces();
166241
166371
  init_base5();
166242
166372
  init_files();
166243
- import_fs8 = require("fs");
166373
+ import_fs9 = require("fs");
166244
166374
  init_logger2();
166245
166375
  NPM_BIN = process.env.NPM_BIN || "npm";
166246
166376
  YARN_BIN = process.env.YARN_BIN || "yarn";
@@ -166449,7 +166579,7 @@ var init_npm = __esm({
166449
166579
  }
166450
166580
  spawnOptions.env[NPM_TOKEN_ENV_VAR] = this.npmConfig.token;
166451
166581
  spawnOptions.env.npm_config_userconfig = filePath;
166452
- (0, import_fs8.writeFileSync)(
166582
+ (0, import_fs9.writeFileSync)(
166453
166583
  filePath,
166454
166584
  `//registry.npmjs.org/:_authToken=\${${NPM_TOKEN_ENV_VAR}}`
166455
166585
  );
@@ -166618,11 +166748,11 @@ function uniquePackages(filenames) {
166618
166748
  });
166619
166749
  return [...new Set(versions)].sort();
166620
166750
  }
166621
- var import_fs9, import_path9, WHEEL_REGEX, SentryPypiTarget;
166751
+ var import_fs10, import_path9, WHEEL_REGEX, SentryPypiTarget;
166622
166752
  var init_sentryPypi = __esm({
166623
166753
  "src/targets/sentryPypi.ts"() {
166624
166754
  init_import_meta_url();
166625
- import_fs9 = __toESM(require("fs"));
166755
+ import_fs10 = __toESM(require("fs"));
166626
166756
  import_path9 = __toESM(require("path"));
166627
166757
  init_files();
166628
166758
  init_errors2();
@@ -166680,7 +166810,7 @@ var init_sentryPypi = __esm({
166680
166810
  { cwd: directory },
166681
166811
  { enableInDryRunMode: true }
166682
166812
  );
166683
- const contents2 = import_fs9.default.readFileSync(import_path9.default.join(directory, "packages.ini"), {
166813
+ const contents2 = import_fs10.default.readFileSync(import_path9.default.join(directory, "packages.ini"), {
166684
166814
  encoding: "utf-8"
166685
166815
  });
166686
166816
  const tree2 = (await spawnProcess(
@@ -166987,7 +167117,7 @@ var init_packagePath = __esm({
166987
167117
  async function getPackageManifest(baseDir, type2, canonicalName, version2) {
166988
167118
  const packageDirPath = getPackageDirPath(type2, canonicalName);
166989
167119
  const versionFilePath = path13.join(baseDir, packageDirPath, `${version2}.json`);
166990
- if ((0, import_fs10.existsSync)(versionFilePath)) {
167120
+ if ((0, import_fs11.existsSync)(versionFilePath)) {
166991
167121
  reportError(`Version file for "${version2}" already exists. Aborting.`);
166992
167122
  }
166993
167123
  const packageManifestPath = path13.join(baseDir, packageDirPath, "latest.json");
@@ -166995,7 +167125,7 @@ async function getPackageManifest(baseDir, type2, canonicalName, version2) {
166995
167125
  return {
166996
167126
  versionFilePath,
166997
167127
  packageManifest: JSON.parse(
166998
- await import_fs10.promises.readFile(packageManifestPath, { encoding: "utf-8" })
167128
+ await import_fs11.promises.readFile(packageManifestPath, { encoding: "utf-8" })
166999
167129
  ) || {}
167000
167130
  };
167001
167131
  }
@@ -167003,14 +167133,14 @@ async function updateManifestSymlinks(updatedManifest, version2, versionFilePath
167003
167133
  const manifestString = JSON.stringify(updatedManifest, void 0, 2) + "\n";
167004
167134
  logger.trace("Updated manifest", manifestString);
167005
167135
  logger.debug(`Writing updated manifest to "${versionFilePath}"...`);
167006
- await import_fs10.promises.writeFile(versionFilePath, manifestString);
167136
+ await import_fs11.promises.writeFile(versionFilePath, manifestString);
167007
167137
  createSymlinks(versionFilePath, version2, previousVersion);
167008
167138
  }
167009
- var import_fs10, path13, DEFAULT_REGISTRY_REMOTE;
167139
+ var import_fs11, path13, DEFAULT_REGISTRY_REMOTE;
167010
167140
  var init_registry = __esm({
167011
167141
  "src/utils/registry.ts"() {
167012
167142
  init_import_meta_url();
167013
- import_fs10 = require("fs");
167143
+ import_fs11 = require("fs");
167014
167144
  path13 = __toESM(require("path"));
167015
167145
  init_logger2();
167016
167146
  init_symlink();
@@ -196167,29 +196297,29 @@ var init_upm = __esm({
196167
196297
  // src/utils/gpg.ts
196168
196298
  async function importGPGKey(privateKey) {
196169
196299
  const PRIVATE_KEY_FILE = path15.join((0, import_os.tmpdir)(), "private-key.asc");
196170
- await import_fs11.promises.writeFile(PRIVATE_KEY_FILE, privateKey);
196300
+ await import_fs12.promises.writeFile(PRIVATE_KEY_FILE, privateKey);
196171
196301
  await spawnProcess(`gpg`, ["--batch", "--import", PRIVATE_KEY_FILE]);
196172
- await import_fs11.promises.unlink(PRIVATE_KEY_FILE);
196302
+ await import_fs12.promises.unlink(PRIVATE_KEY_FILE);
196173
196303
  }
196174
- var import_os, import_fs11, path15;
196304
+ var import_os, import_fs12, path15;
196175
196305
  var init_gpg = __esm({
196176
196306
  "src/utils/gpg.ts"() {
196177
196307
  init_import_meta_url();
196178
196308
  import_os = require("os");
196179
- import_fs11 = require("fs");
196309
+ import_fs12 = require("fs");
196180
196310
  path15 = __toESM(require("path"));
196181
196311
  init_system();
196182
196312
  }
196183
196313
  });
196184
196314
 
196185
196315
  // src/targets/maven.ts
196186
- var import_path10, import_fs12, import_node_fetch5, POM_DEFAULT_FILENAME, POM_FILE_EXT, BOM_FILE_KEY_REGEXP, NEXUS_API_BASE_URL, CENTRAL_API_BASE_URL, NEXUS_RETRY_DELAY, SONATYPE_RETRY_DEADLINE, CENTRAL_RETRY_DELAY, targetSecrets, targetOptions, MavenTarget;
196316
+ var import_path10, import_fs13, import_node_fetch5, POM_DEFAULT_FILENAME, POM_FILE_EXT, BOM_FILE_KEY_REGEXP, NEXUS_API_BASE_URL, CENTRAL_API_BASE_URL, NEXUS_RETRY_DELAY, SONATYPE_RETRY_DEADLINE, CENTRAL_RETRY_DELAY, targetSecrets, targetOptions, MavenTarget;
196187
196317
  var init_maven = __esm({
196188
196318
  "src/targets/maven.ts"() {
196189
196319
  init_import_meta_url();
196190
196320
  init_base5();
196191
196321
  import_path10 = require("path");
196192
- import_fs12 = require("fs");
196322
+ import_fs13 = require("fs");
196193
196323
  import_node_fetch5 = __toESM(require_lib10());
196194
196324
  init_system();
196195
196325
  init_async();
@@ -196417,7 +196547,7 @@ var init_maven = __esm({
196417
196547
  if (await this.isBomFile(pomFilepath)) {
196418
196548
  return pomFilepath;
196419
196549
  }
196420
- const filesInDir = await import_fs12.promises.readdir(distDir);
196550
+ const filesInDir = await import_fs13.promises.readdir(distDir);
196421
196551
  const potentialPoms = filesInDir.filter((f3) => f3 !== POM_DEFAULT_FILENAME && (0, import_path10.extname)(f3) === POM_FILE_EXT).map((f3) => (0, import_path10.join)(distDir, f3));
196422
196552
  return potentialPoms.find((f3) => this.isBomFile(f3));
196423
196553
  }
@@ -196432,7 +196562,7 @@ var init_maven = __esm({
196432
196562
  */
196433
196563
  async isBomFile(pomFilepath) {
196434
196564
  try {
196435
- const fileContents = await import_fs12.promises.readFile(pomFilepath, {
196565
+ const fileContents = await import_fs13.promises.readFile(pomFilepath, {
196436
196566
  encoding: "utf8"
196437
196567
  });
196438
196568
  return BOM_FILE_KEY_REGEXP.test(fileContents);
@@ -196583,7 +196713,7 @@ Error:
196583
196713
  async getPomFileInDist(distDir) {
196584
196714
  const pomFilepath = (0, import_path10.join)(distDir, "pom-default.xml");
196585
196715
  try {
196586
- const stat = await import_fs12.promises.stat(pomFilepath);
196716
+ const stat = await import_fs13.promises.stat(pomFilepath);
196587
196717
  if (stat.isFile()) {
196588
196718
  return pomFilepath;
196589
196719
  }
@@ -196596,7 +196726,7 @@ Error:
196596
196726
  */
196597
196727
  async fileExists(filePath) {
196598
196728
  try {
196599
- const stat = await import_fs12.promises.stat(filePath);
196729
+ const stat = await import_fs13.promises.stat(filePath);
196600
196730
  if (stat.isFile()) {
196601
196731
  return true;
196602
196732
  }
@@ -196615,7 +196745,7 @@ Error:
196615
196745
  async fixModuleFileName(distDir, moduleFile) {
196616
196746
  const fallbackFile = (0, import_path10.join)(distDir, "module.json");
196617
196747
  if (!await this.fileExists(moduleFile) && await this.fileExists(fallbackFile)) {
196618
- await import_fs12.promises.rename(fallbackFile, moduleFile);
196748
+ await import_fs13.promises.rename(fallbackFile, moduleFile);
196619
196749
  }
196620
196750
  }
196621
196751
  async uploadPomDistribution(distDir) {
@@ -196691,7 +196821,7 @@ Error:
196691
196821
  );
196692
196822
  } else if (isAppleDistDir) {
196693
196823
  files["metadataFile"] = (0, import_path10.join)(distDir, `${moduleName}-metadata.jar`);
196694
- const cinteropFiles = (await import_fs12.promises.readdir(distDir)).filter((file) => file.includes("cinterop")).map((file) => (0, import_path10.join)(distDir, file));
196824
+ const cinteropFiles = (await import_fs13.promises.readdir(distDir)).filter((file) => file.includes("cinterop")).map((file) => (0, import_path10.join)(distDir, file));
196695
196825
  files["klibFiles"] = cinteropFiles;
196696
196826
  } else if (isKlibDistDir) {
196697
196827
  files["klibFiles"] = [(0, import_path10.join)(distDir, `${moduleName}.klib`)];
@@ -196876,14 +197006,14 @@ Error:
196876
197006
  });
196877
197007
 
196878
197008
  // src/targets/symbolCollector.ts
196879
- var import_fs13, import_path11, DEFAULT_SYM_COLLECTOR_SERVER_ENDPOINT, SYM_COLLECTOR_BIN_NAME, SymbolCollector;
197009
+ var import_fs14, import_path11, DEFAULT_SYM_COLLECTOR_SERVER_ENDPOINT, SYM_COLLECTOR_BIN_NAME, SymbolCollector;
196880
197010
  var init_symbolCollector = __esm({
196881
197011
  "src/targets/symbolCollector.ts"() {
196882
197012
  init_import_meta_url();
196883
197013
  init_errors2();
196884
197014
  init_base5();
196885
197015
  init_files();
196886
- import_fs13 = require("fs");
197016
+ import_fs14 = require("fs");
196887
197017
  init_system();
196888
197018
  import_path11 = require("path");
196889
197019
  DEFAULT_SYM_COLLECTOR_SERVER_ENDPOINT = "https://symbol-collector.services.sentry.io/";
@@ -196931,7 +197061,7 @@ var init_symbolCollector = __esm({
196931
197061
  await Promise.all(
196932
197062
  artifacts.map(async (artifact, index) => {
196933
197063
  const subdirPath = (0, import_path11.join)(dir, String(index));
196934
- await import_fs13.promises.mkdir(subdirPath);
197064
+ await import_fs14.promises.mkdir(subdirPath);
196935
197065
  await this.artifactProvider.downloadArtifact(artifact, subdirPath);
196936
197066
  })
196937
197067
  );
@@ -196961,11 +197091,11 @@ var init_symbolCollector = __esm({
196961
197091
  });
196962
197092
 
196963
197093
  // src/targets/pubDev.ts
196964
- var import_fs14, import_os2, import_path12, targetSecrets2, PubDevTarget;
197094
+ var import_fs15, import_os2, import_path12, targetSecrets2, PubDevTarget;
196965
197095
  var init_pubDev = __esm({
196966
197096
  "src/targets/pubDev.ts"() {
196967
197097
  init_import_meta_url();
196968
- import_fs14 = require("fs");
197098
+ import_fs15 = require("fs");
196969
197099
  import_os2 = require("os");
196970
197100
  import_path12 = require("path");
196971
197101
  init_js_yaml();
@@ -197070,11 +197200,11 @@ var init_pubDev = __esm({
197070
197200
  // Expiration date is required, but irrelevant
197071
197201
  };
197072
197202
  try {
197073
- await import_fs14.promises.access(credentialsFilePath, import_fs14.constants.F_OK);
197203
+ await import_fs15.promises.access(credentialsFilePath, import_fs15.constants.F_OK);
197074
197204
  this.logger.warn("Credentials file already exists. Skipping creation.");
197075
197205
  } catch {
197076
- await import_fs14.promises.mkdir((0, import_path12.dirname)(credentialsFilePath), { recursive: true });
197077
- await import_fs14.promises.writeFile(credentialsFilePath, JSON.stringify(content));
197206
+ await import_fs15.promises.mkdir((0, import_path12.dirname)(credentialsFilePath), { recursive: true });
197207
+ await import_fs15.promises.writeFile(credentialsFilePath, JSON.stringify(content));
197078
197208
  this.logger.info("Credentials file created.");
197079
197209
  }
197080
197210
  }
@@ -197146,10 +197276,10 @@ var init_pubDev = __esm({
197146
197276
  }
197147
197277
  async removeDependencyOverrides(directory, pkg) {
197148
197278
  const pubSpecPath = (0, import_path12.join)(directory, pkg, "pubspec.yaml");
197149
- const pubSpecContent = await import_fs14.promises.readFile(pubSpecPath, "utf8");
197279
+ const pubSpecContent = await import_fs15.promises.readFile(pubSpecPath, "utf8");
197150
197280
  const pubSpecYaml = load(pubSpecContent);
197151
197281
  delete pubSpecYaml.dependency_overrides;
197152
- await import_fs14.promises.writeFile(pubSpecPath, dump(pubSpecYaml));
197282
+ await import_fs15.promises.writeFile(pubSpecPath, dump(pubSpecYaml));
197153
197283
  }
197154
197284
  };
197155
197285
  }
@@ -197618,7 +197748,7 @@ function findConfigFile() {
197618
197748
  let currentDir = cwd;
197619
197749
  while (depth <= MAX_DEPTH) {
197620
197750
  const probePath = import_path14.default.join(currentDir, CONFIG_FILE_NAME);
197621
- if ((0, import_fs15.existsSync)(probePath) && (0, import_fs15.lstatSync)(probePath).isFile()) {
197751
+ if ((0, import_fs16.existsSync)(probePath) && (0, import_fs16.lstatSync)(probePath).isFile()) {
197622
197752
  _configPathCache = probePath;
197623
197753
  return _configPathCache;
197624
197754
  }
@@ -197672,7 +197802,14 @@ function getConfiguration(clearCache = false) {
197672
197802
  }
197673
197803
  const configPath = getConfigFilePath();
197674
197804
  logger.debug("Configuration file found: ", configPath);
197675
- const rawConfig = load((0, import_fs15.readFileSync)(configPath, "utf-8"));
197805
+ const rawConfig = load((0, import_fs16.readFileSync)(configPath, "utf-8"));
197806
+ _configCache = validateConfiguration(rawConfig);
197807
+ checkMinimalConfigVersion(_configCache);
197808
+ return _configCache;
197809
+ }
197810
+ function loadConfigurationFromString(configContent) {
197811
+ logger.debug("Loading configuration from provided content...");
197812
+ const rawConfig = load(configContent);
197676
197813
  _configCache = validateConfiguration(rawConfig);
197677
197814
  checkMinimalConfigVersion(_configCache);
197678
197815
  return _configCache;
@@ -197720,6 +197857,13 @@ function requiresMinVersion(requiredVersion) {
197720
197857
  }
197721
197858
  return versionGreaterOrEqualThan(configuredMinVersion, required);
197722
197859
  }
197860
+ function getVersioningPolicy() {
197861
+ const config3 = getConfiguration();
197862
+ if (config3.versioning?.policy) {
197863
+ return config3.versioning.policy;
197864
+ }
197865
+ return requiresMinVersion(AUTO_VERSION_MIN_VERSION) ? "auto" /* Auto */ : "manual" /* Manual */;
197866
+ }
197723
197867
  async function getGlobalGitHubConfig(clearCache = false) {
197724
197868
  if (!clearCache && _globalGitHubConfigCache !== void 0) {
197725
197869
  if (_globalGitHubConfigCache === null) {
@@ -197856,11 +198000,11 @@ async function expandWorkspaceTargets(targets) {
197856
198000
  }
197857
198001
  return expandedTargets;
197858
198002
  }
197859
- var import_fs15, import_path14, import_ajv, import_git_url_parse, CONFIG_FILE_NAME, DEFAULT_RELEASE_BRANCH_NAME, _configPathCache, _configCache, _globalGitHubConfigCache, DEFAULT_CHANGELOG_FILE_PATH;
198003
+ var import_fs16, import_path14, import_ajv, import_git_url_parse, CONFIG_FILE_NAME, DEFAULT_RELEASE_BRANCH_NAME, _configPathCache, _configCache, AUTO_VERSION_MIN_VERSION, _globalGitHubConfigCache, DEFAULT_CHANGELOG_FILE_PATH;
197860
198004
  var init_config2 = __esm({
197861
198005
  "src/config.ts"() {
197862
198006
  init_import_meta_url();
197863
- import_fs15 = require("fs");
198007
+ import_fs16 = require("fs");
197864
198008
  import_path14 = __toESM(require("path"));
197865
198009
  import_ajv = __toESM(require_ajv());
197866
198010
  init_js_yaml();
@@ -197876,6 +198020,7 @@ var init_config2 = __esm({
197876
198020
  init_github2();
197877
198021
  CONFIG_FILE_NAME = ".craft.yml";
197878
198022
  DEFAULT_RELEASE_BRANCH_NAME = "release";
198023
+ AUTO_VERSION_MIN_VERSION = "2.14.0";
197879
198024
  DEFAULT_CHANGELOG_FILE_PATH = "CHANGELOG.md";
197880
198025
  }
197881
198026
  });
@@ -197906,7 +198051,7 @@ function checkFileIsPrivate(path17) {
197906
198051
  const FULL_MODE_MASK = 511;
197907
198052
  const GROUP_MODE_MASK = 56;
197908
198053
  const OTHER_MODE_MASK = 7;
197909
- const mode = (0, import_fs16.statSync)(path17).mode;
198054
+ const mode = (0, import_fs17.statSync)(path17).mode;
197910
198055
  if (mode & GROUP_MODE_MASK || mode & OTHER_MODE_MASK) {
197911
198056
  const perms = (mode & FULL_MODE_MASK).toString(8);
197912
198057
  logger.warn(
@@ -197919,7 +198064,7 @@ function checkFileIsPrivate(path17) {
197919
198064
  function readEnvironmentConfig(overwriteExisting = false) {
197920
198065
  let newEnv = {};
197921
198066
  const homedirEnvFile = (0, import_path15.join)(os4.homedir(), ENV_FILE_NAME);
197922
- if ((0, import_fs16.existsSync)(homedirEnvFile)) {
198067
+ if ((0, import_fs17.existsSync)(homedirEnvFile)) {
197923
198068
  logger.debug(
197924
198069
  "Found environment file in the home directory:",
197925
198070
  homedirEnvFile
@@ -197939,7 +198084,7 @@ function readEnvironmentConfig(overwriteExisting = false) {
197939
198084
  const configDirEnvFile = configFileDir && (0, import_path15.join)(configFileDir, ENV_FILE_NAME);
197940
198085
  if (!configDirEnvFile) {
197941
198086
  logger.debug("No configuration file found:", CONFIG_FILE_NAME);
197942
- } else if (configDirEnvFile && (0, import_fs16.existsSync)(configDirEnvFile)) {
198087
+ } else if (configDirEnvFile && (0, import_fs17.existsSync)(configDirEnvFile)) {
197943
198088
  logger.debug(
197944
198089
  "Found environment file in the configuration directory:",
197945
198090
  configDirEnvFile
@@ -197970,11 +198115,11 @@ function checkEnvForPrerequisite(...varList) {
197970
198115
  );
197971
198116
  }
197972
198117
  }
197973
- var import_fs16, import_path15, import_nvar, os4, ENV_FILE_NAME;
198118
+ var import_fs17, import_path15, import_nvar, os4, ENV_FILE_NAME;
197974
198119
  var init_env = __esm({
197975
198120
  "src/utils/env.ts"() {
197976
198121
  init_import_meta_url();
197977
- import_fs16 = require("fs");
198122
+ import_fs17 = require("fs");
197978
198123
  import_path15 = require("path");
197979
198124
  import_nvar = __toESM(require_lib2());
197980
198125
  init_config2();
@@ -198343,7 +198488,7 @@ var require_semver3 = __commonJS({
198343
198488
  var { safeRe: re2, t: t3 } = require_re();
198344
198489
  var parseOptions = require_parse_options();
198345
198490
  var { compareIdentifiers } = require_identifiers();
198346
- var SemVer2 = class _SemVer {
198491
+ var SemVer3 = class _SemVer {
198347
198492
  constructor(version2, options) {
198348
198493
  options = parseOptions(options);
198349
198494
  if (version2 instanceof _SemVer) {
@@ -198609,7 +198754,7 @@ var require_semver3 = __commonJS({
198609
198754
  return this;
198610
198755
  }
198611
198756
  };
198612
- module2.exports = SemVer2;
198757
+ module2.exports = SemVer3;
198613
198758
  }
198614
198759
  });
198615
198760
 
@@ -198618,13 +198763,13 @@ var require_parse3 = __commonJS({
198618
198763
  "node_modules/semver/functions/parse.js"(exports2, module2) {
198619
198764
  "use strict";
198620
198765
  init_import_meta_url();
198621
- var SemVer2 = require_semver3();
198766
+ var SemVer3 = require_semver3();
198622
198767
  var parse4 = (version2, options, throwErrors = false) => {
198623
- if (version2 instanceof SemVer2) {
198768
+ if (version2 instanceof SemVer3) {
198624
198769
  return version2;
198625
198770
  }
198626
198771
  try {
198627
- return new SemVer2(version2, options);
198772
+ return new SemVer3(version2, options);
198628
198773
  } catch (er) {
198629
198774
  if (!throwErrors) {
198630
198775
  return null;
@@ -198669,7 +198814,7 @@ var require_inc = __commonJS({
198669
198814
  "node_modules/semver/functions/inc.js"(exports2, module2) {
198670
198815
  "use strict";
198671
198816
  init_import_meta_url();
198672
- var SemVer2 = require_semver3();
198817
+ var SemVer3 = require_semver3();
198673
198818
  var inc2 = (version2, release3, options, identifier, identifierBase) => {
198674
198819
  if (typeof options === "string") {
198675
198820
  identifierBase = identifier;
@@ -198677,8 +198822,8 @@ var require_inc = __commonJS({
198677
198822
  options = void 0;
198678
198823
  }
198679
198824
  try {
198680
- return new SemVer2(
198681
- version2 instanceof SemVer2 ? version2.version : version2,
198825
+ return new SemVer3(
198826
+ version2 instanceof SemVer3 ? version2.version : version2,
198682
198827
  options
198683
198828
  ).inc(release3, identifier, identifierBase).version;
198684
198829
  } catch (er) {
@@ -198739,8 +198884,8 @@ var require_major = __commonJS({
198739
198884
  "node_modules/semver/functions/major.js"(exports2, module2) {
198740
198885
  "use strict";
198741
198886
  init_import_meta_url();
198742
- var SemVer2 = require_semver3();
198743
- var major2 = (a3, loose) => new SemVer2(a3, loose).major;
198887
+ var SemVer3 = require_semver3();
198888
+ var major2 = (a3, loose) => new SemVer3(a3, loose).major;
198744
198889
  module2.exports = major2;
198745
198890
  }
198746
198891
  });
@@ -198750,8 +198895,8 @@ var require_minor = __commonJS({
198750
198895
  "node_modules/semver/functions/minor.js"(exports2, module2) {
198751
198896
  "use strict";
198752
198897
  init_import_meta_url();
198753
- var SemVer2 = require_semver3();
198754
- var minor = (a3, loose) => new SemVer2(a3, loose).minor;
198898
+ var SemVer3 = require_semver3();
198899
+ var minor = (a3, loose) => new SemVer3(a3, loose).minor;
198755
198900
  module2.exports = minor;
198756
198901
  }
198757
198902
  });
@@ -198761,8 +198906,8 @@ var require_patch = __commonJS({
198761
198906
  "node_modules/semver/functions/patch.js"(exports2, module2) {
198762
198907
  "use strict";
198763
198908
  init_import_meta_url();
198764
- var SemVer2 = require_semver3();
198765
- var patch = (a3, loose) => new SemVer2(a3, loose).patch;
198909
+ var SemVer3 = require_semver3();
198910
+ var patch = (a3, loose) => new SemVer3(a3, loose).patch;
198766
198911
  module2.exports = patch;
198767
198912
  }
198768
198913
  });
@@ -198786,8 +198931,8 @@ var require_compare = __commonJS({
198786
198931
  "node_modules/semver/functions/compare.js"(exports2, module2) {
198787
198932
  "use strict";
198788
198933
  init_import_meta_url();
198789
- var SemVer2 = require_semver3();
198790
- var compare = (a3, b3, loose) => new SemVer2(a3, loose).compare(new SemVer2(b3, loose));
198934
+ var SemVer3 = require_semver3();
198935
+ var compare = (a3, b3, loose) => new SemVer3(a3, loose).compare(new SemVer3(b3, loose));
198791
198936
  module2.exports = compare;
198792
198937
  }
198793
198938
  });
@@ -198819,10 +198964,10 @@ var require_compare_build = __commonJS({
198819
198964
  "node_modules/semver/functions/compare-build.js"(exports2, module2) {
198820
198965
  "use strict";
198821
198966
  init_import_meta_url();
198822
- var SemVer2 = require_semver3();
198967
+ var SemVer3 = require_semver3();
198823
198968
  var compareBuild = (a3, b3, loose) => {
198824
- const versionA = new SemVer2(a3, loose);
198825
- const versionB = new SemVer2(b3, loose);
198969
+ const versionA = new SemVer3(a3, loose);
198970
+ const versionB = new SemVer3(b3, loose);
198826
198971
  return versionA.compare(versionB) || versionA.compareBuild(versionB);
198827
198972
  };
198828
198973
  module2.exports = compareBuild;
@@ -198973,11 +199118,11 @@ var require_coerce = __commonJS({
198973
199118
  "node_modules/semver/functions/coerce.js"(exports2, module2) {
198974
199119
  "use strict";
198975
199120
  init_import_meta_url();
198976
- var SemVer2 = require_semver3();
199121
+ var SemVer3 = require_semver3();
198977
199122
  var parse4 = require_parse3();
198978
199123
  var { safeRe: re2, t: t3 } = require_re();
198979
199124
  var coerce = (version2, options) => {
198980
- if (version2 instanceof SemVer2) {
199125
+ if (version2 instanceof SemVer3) {
198981
199126
  return version2;
198982
199127
  }
198983
199128
  if (typeof version2 === "number") {
@@ -199185,7 +199330,7 @@ var require_range2 = __commonJS({
199185
199330
  }
199186
199331
  if (typeof version2 === "string") {
199187
199332
  try {
199188
- version2 = new SemVer2(version2, this.options);
199333
+ version2 = new SemVer3(version2, this.options);
199189
199334
  } catch (er) {
199190
199335
  return false;
199191
199336
  }
@@ -199204,7 +199349,7 @@ var require_range2 = __commonJS({
199204
199349
  var parseOptions = require_parse_options();
199205
199350
  var Comparator = require_comparator();
199206
199351
  var debug3 = require_debug();
199207
- var SemVer2 = require_semver3();
199352
+ var SemVer3 = require_semver3();
199208
199353
  var {
199209
199354
  safeRe: re2,
199210
199355
  t: t3,
@@ -199476,7 +199621,7 @@ var require_comparator = __commonJS({
199476
199621
  if (!m3[2]) {
199477
199622
  this.semver = ANY;
199478
199623
  } else {
199479
- this.semver = new SemVer2(m3[2], this.options.loose);
199624
+ this.semver = new SemVer3(m3[2], this.options.loose);
199480
199625
  }
199481
199626
  }
199482
199627
  toString() {
@@ -199489,7 +199634,7 @@ var require_comparator = __commonJS({
199489
199634
  }
199490
199635
  if (typeof version2 === "string") {
199491
199636
  try {
199492
- version2 = new SemVer2(version2, this.options);
199637
+ version2 = new SemVer3(version2, this.options);
199493
199638
  } catch (er) {
199494
199639
  return false;
199495
199640
  }
@@ -199541,7 +199686,7 @@ var require_comparator = __commonJS({
199541
199686
  var { safeRe: re2, t: t3 } = require_re();
199542
199687
  var cmp = require_cmp();
199543
199688
  var debug3 = require_debug();
199544
- var SemVer2 = require_semver3();
199689
+ var SemVer3 = require_semver3();
199545
199690
  var Range = require_range2();
199546
199691
  }
199547
199692
  });
@@ -199580,7 +199725,7 @@ var require_max_satisfying = __commonJS({
199580
199725
  "node_modules/semver/ranges/max-satisfying.js"(exports2, module2) {
199581
199726
  "use strict";
199582
199727
  init_import_meta_url();
199583
- var SemVer2 = require_semver3();
199728
+ var SemVer3 = require_semver3();
199584
199729
  var Range = require_range2();
199585
199730
  var maxSatisfying = (versions, range3, options) => {
199586
199731
  let max = null;
@@ -199595,7 +199740,7 @@ var require_max_satisfying = __commonJS({
199595
199740
  if (rangeObj.test(v6)) {
199596
199741
  if (!max || maxSV.compare(v6) === -1) {
199597
199742
  max = v6;
199598
- maxSV = new SemVer2(max, options);
199743
+ maxSV = new SemVer3(max, options);
199599
199744
  }
199600
199745
  }
199601
199746
  });
@@ -199610,7 +199755,7 @@ var require_min_satisfying = __commonJS({
199610
199755
  "node_modules/semver/ranges/min-satisfying.js"(exports2, module2) {
199611
199756
  "use strict";
199612
199757
  init_import_meta_url();
199613
- var SemVer2 = require_semver3();
199758
+ var SemVer3 = require_semver3();
199614
199759
  var Range = require_range2();
199615
199760
  var minSatisfying = (versions, range3, options) => {
199616
199761
  let min = null;
@@ -199625,7 +199770,7 @@ var require_min_satisfying = __commonJS({
199625
199770
  if (rangeObj.test(v6)) {
199626
199771
  if (!min || minSV.compare(v6) === 1) {
199627
199772
  min = v6;
199628
- minSV = new SemVer2(min, options);
199773
+ minSV = new SemVer3(min, options);
199629
199774
  }
199630
199775
  }
199631
199776
  });
@@ -199640,16 +199785,16 @@ var require_min_version = __commonJS({
199640
199785
  "node_modules/semver/ranges/min-version.js"(exports2, module2) {
199641
199786
  "use strict";
199642
199787
  init_import_meta_url();
199643
- var SemVer2 = require_semver3();
199788
+ var SemVer3 = require_semver3();
199644
199789
  var Range = require_range2();
199645
199790
  var gt = require_gt();
199646
199791
  var minVersion = (range3, loose) => {
199647
199792
  range3 = new Range(range3, loose);
199648
- let minver = new SemVer2("0.0.0");
199793
+ let minver = new SemVer3("0.0.0");
199649
199794
  if (range3.test(minver)) {
199650
199795
  return minver;
199651
199796
  }
199652
- minver = new SemVer2("0.0.0-0");
199797
+ minver = new SemVer3("0.0.0-0");
199653
199798
  if (range3.test(minver)) {
199654
199799
  return minver;
199655
199800
  }
@@ -199658,7 +199803,7 @@ var require_min_version = __commonJS({
199658
199803
  const comparators = range3.set[i3];
199659
199804
  let setMin = null;
199660
199805
  comparators.forEach((comparator) => {
199661
- const compver = new SemVer2(comparator.semver.version);
199806
+ const compver = new SemVer3(comparator.semver.version);
199662
199807
  switch (comparator.operator) {
199663
199808
  case ">":
199664
199809
  if (compver.prerelease.length === 0) {
@@ -199717,7 +199862,7 @@ var require_outside = __commonJS({
199717
199862
  "node_modules/semver/ranges/outside.js"(exports2, module2) {
199718
199863
  "use strict";
199719
199864
  init_import_meta_url();
199720
- var SemVer2 = require_semver3();
199865
+ var SemVer3 = require_semver3();
199721
199866
  var Comparator = require_comparator();
199722
199867
  var { ANY } = Comparator;
199723
199868
  var Range = require_range2();
@@ -199727,7 +199872,7 @@ var require_outside = __commonJS({
199727
199872
  var lte2 = require_lte();
199728
199873
  var gte2 = require_gte();
199729
199874
  var outside = (version2, range3, hilo, options) => {
199730
- version2 = new SemVer2(version2, options);
199875
+ version2 = new SemVer3(version2, options);
199731
199876
  range3 = new Range(range3, options);
199732
199877
  let gtfn, ltefn, ltfn, comp, ecomp;
199733
199878
  switch (hilo) {
@@ -200040,7 +200185,7 @@ var require_semver4 = __commonJS({
200040
200185
  init_import_meta_url();
200041
200186
  var internalRe = require_re();
200042
200187
  var constants3 = require_constants3();
200043
- var SemVer2 = require_semver3();
200188
+ var SemVer3 = require_semver3();
200044
200189
  var identifiers = require_identifiers();
200045
200190
  var parse4 = require_parse3();
200046
200191
  var valid = require_valid();
@@ -200117,7 +200262,7 @@ var require_semver4 = __commonJS({
200117
200262
  intersects,
200118
200263
  simplifyRange,
200119
200264
  subset,
200120
- SemVer: SemVer2,
200265
+ SemVer: SemVer3,
200121
200266
  re: internalRe.re,
200122
200267
  src: internalRe.src,
200123
200268
  tokens: internalRe.t,
@@ -205683,12 +205828,52 @@ __export(prepare_exports, {
205683
205828
  runPreReleaseCommand: () => runPreReleaseCommand
205684
205829
  });
205685
205830
  init_import_meta_url();
205686
- var import_fs18 = require("fs");
205831
+ var import_fs19 = require("fs");
205687
205832
  var import_path17 = require("path");
205688
205833
  var shellQuote2 = __toESM(require_shell_quote());
205689
205834
  init_config2();
205690
205835
  init_logger2();
205691
205836
  init_project_config();
205837
+
205838
+ // src/utils/calver.ts
205839
+ init_import_meta_url();
205840
+ init_config2();
205841
+ init_logger2();
205842
+ var DEFAULT_CALVER_CONFIG = {
205843
+ offset: 14,
205844
+ format: "%y.%-m"
205845
+ };
205846
+ function formatCalVerDate(date2, format5) {
205847
+ const year2 = date2.getFullYear();
205848
+ const month = date2.getMonth() + 1;
205849
+ const day = date2.getDate();
205850
+ return format5.replace("%Y", String(year2)).replace("%y", String(year2).slice(-2)).replace("%-m", String(month)).replace("%m", String(month).padStart(2, "0")).replace("%-d", String(day)).replace("%d", String(day).padStart(2, "0"));
205851
+ }
205852
+ async function calculateCalVer(git, config3) {
205853
+ const date2 = /* @__PURE__ */ new Date();
205854
+ date2.setDate(date2.getDate() - config3.offset);
205855
+ const datePart = formatCalVerDate(date2, config3.format);
205856
+ logger.debug(`CalVer: using date ${date2.toISOString()}, date part: ${datePart}`);
205857
+ const gitTagPrefix = getGitTagPrefix();
205858
+ const searchPrefix = `${gitTagPrefix}${datePart}.`;
205859
+ logger.debug(`CalVer: searching for tags with prefix: ${searchPrefix}`);
205860
+ const tags = await git.tags();
205861
+ let patch = 0;
205862
+ for (const tag2 of tags.all) {
205863
+ if (tag2.startsWith(searchPrefix)) {
205864
+ const patchStr = tag2.slice(searchPrefix.length);
205865
+ const patchNum = parseInt(patchStr, 10);
205866
+ if (!isNaN(patchNum) && patchNum >= patch) {
205867
+ patch = patchNum + 1;
205868
+ }
205869
+ }
205870
+ }
205871
+ const version2 = `${datePart}.${patch}`;
205872
+ logger.info(`CalVer: determined version ${version2}`);
205873
+ return version2;
205874
+ }
205875
+
205876
+ // src/commands/prepare.ts
205692
205877
  init_async();
205693
205878
  init_changelog();
205694
205879
  init_errors2();
@@ -205753,7 +205938,7 @@ __export(publish_exports, {
205753
205938
  });
205754
205939
  init_import_meta_url();
205755
205940
  var import_chalk = __toESM(require_source());
205756
- var import_fs17 = require("fs");
205941
+ var import_fs18 = require("fs");
205757
205942
  var import_path16 = require("path");
205758
205943
  var import_shell_quote = __toESM(require_shell_quote());
205759
205944
  var import_string_length = __toESM(require_string_length());
@@ -206045,11 +206230,11 @@ async function publishMain(argv) {
206045
206230
  let targetConfigList = await expandWorkspaceTargets(config3.targets || []);
206046
206231
  logger.info(`Looking for publish state file for ${newVersion}...`);
206047
206232
  const publishStateFile = `.craft-publish-${newVersion}.json`;
206048
- const earlierStateExists = (0, import_fs17.existsSync)(publishStateFile);
206233
+ const earlierStateExists = (0, import_fs18.existsSync)(publishStateFile);
206049
206234
  let publishState;
206050
206235
  if (earlierStateExists) {
206051
206236
  logger.info(`Found publish state file, resuming from there...`);
206052
- publishState = JSON.parse((0, import_fs17.readFileSync)(publishStateFile).toString());
206237
+ publishState = JSON.parse((0, import_fs18.readFileSync)(publishStateFile).toString());
206053
206238
  targetsToPublish = new Set(targetConfigList.map(BaseTarget.getId));
206054
206239
  } else {
206055
206240
  publishState = { published: /* @__PURE__ */ Object.create(null) };
@@ -206081,7 +206266,7 @@ async function publishMain(argv) {
206081
206266
  await publishToTarget(target, newVersion, revision);
206082
206267
  publishState.published[BaseTarget.getId(target.config)] = true;
206083
206268
  if (!isDryRun()) {
206084
- (0, import_fs17.writeFileSync)(publishStateFile, JSON.stringify(publishState));
206269
+ (0, import_fs18.writeFileSync)(publishStateFile, JSON.stringify(publishState));
206085
206270
  }
206086
206271
  }
206087
206272
  if (argv.keepDownloads) {
@@ -206108,7 +206293,7 @@ async function publishMain(argv) {
206108
206293
  argv.keepBranch
206109
206294
  );
206110
206295
  if (!isDryRun()) {
206111
- import_fs17.promises.unlink(publishStateFile).catch(
206296
+ import_fs18.promises.unlink(publishStateFile).catch(
206112
206297
  (err) => logger.trace("Couldn't remove publish state file: ", err)
206113
206298
  );
206114
206299
  }
@@ -206138,9 +206323,9 @@ var command3 = ["prepare NEW-VERSION"];
206138
206323
  var aliases2 = ["p", "prerelease", "prepublish", "prepare", "release"];
206139
206324
  var description2 = "\u{1F6A2} Prepare a new release branch";
206140
206325
  var DEFAULT_BUMP_VERSION_PATH = (0, import_path17.join)("scripts", "bump-version.sh");
206141
- var AUTO_VERSION_MIN_VERSION = "2.14.0";
206326
+ var AUTO_VERSION_MIN_VERSION2 = "2.14.0";
206142
206327
  var builder2 = (yargs) => yargs.positional("NEW-VERSION", {
206143
- description: 'The new version to release. Can be: a semver string (e.g., "1.2.3"), a bump type ("major", "minor", or "patch"), or "auto" to determine automatically from conventional commits. Bump types and "auto" require minVersion >= 2.14.0 in .craft.yml',
206328
+ description: 'The new version to release. Can be: a semver string (e.g., "1.2.3"), a bump type ("major", "minor", or "patch"), "auto" to determine automatically from conventional commits, or "calver" for calendar versioning. If omitted, uses the versioning.policy from .craft.yml',
206144
206329
  type: "string"
206145
206330
  }).option("rev", {
206146
206331
  alias: "r",
@@ -206166,13 +206351,25 @@ var builder2 = (yargs) => yargs.positional("NEW-VERSION", {
206166
206351
  default: "origin",
206167
206352
  description: "The git remote to use when pushing",
206168
206353
  type: "string"
206354
+ }).option("config-from", {
206355
+ description: "Load .craft.yml from the specified remote branch instead of local file",
206356
+ type: "string"
206357
+ }).option("calver-offset", {
206358
+ description: "Days to go back for CalVer date calculation (overrides config)",
206359
+ type: "number"
206169
206360
  }).check(checkVersionOrPart);
206170
206361
  var SLEEP_BEFORE_PUBLISH_SECONDS = 30;
206171
206362
  function checkVersionOrPart(argv, _opt) {
206172
206363
  const version2 = argv.newVersion;
206364
+ if (!version2) {
206365
+ return true;
206366
+ }
206173
206367
  if (version2 === "auto") {
206174
206368
  return true;
206175
206369
  }
206370
+ if (version2 === "calver") {
206371
+ return true;
206372
+ }
206176
206373
  if (isBumpType(version2)) {
206177
206374
  return true;
206178
206375
  }
@@ -206311,7 +206508,7 @@ async function prepareChangelog(git, oldVersion, newVersion, changelogPolicy = "
206311
206508
  logger.debug(
206312
206509
  `Changelog policy is set to "${changelogPolicy}", nothing to do.`
206313
206510
  );
206314
- return;
206511
+ return void 0;
206315
206512
  }
206316
206513
  if (changelogPolicy !== "auto" /* Auto */ && changelogPolicy !== "simple" /* Simple */) {
206317
206514
  throw new ConfigurationError(
@@ -206325,12 +206522,12 @@ async function prepareChangelog(git, oldVersion, newVersion, changelogPolicy = "
206325
206522
  if (relativePath.startsWith(".")) {
206326
206523
  throw new ConfigurationError(`Invalid changelog path: "${changelogPath}"`);
206327
206524
  }
206328
- if (!(0, import_fs18.existsSync)(relativePath)) {
206525
+ if (!(0, import_fs19.existsSync)(relativePath)) {
206329
206526
  throw new ConfigurationError(
206330
206527
  `Changelog does not exist: "${changelogPath}"`
206331
206528
  );
206332
206529
  }
206333
- let changelogString = (await import_fs18.promises.readFile(relativePath)).toString();
206530
+ let changelogString = (await import_fs19.promises.readFile(relativePath)).toString();
206334
206531
  let changeset = findChangeset(
206335
206532
  changelogString,
206336
206533
  newVersion,
@@ -206359,7 +206556,7 @@ async function prepareChangelog(git, oldVersion, newVersion, changelogPolicy = "
206359
206556
  changelogString = prependChangeset(changelogString, changeset);
206360
206557
  }
206361
206558
  if (!isDryRun()) {
206362
- await import_fs18.promises.writeFile(relativePath, changelogString);
206559
+ await import_fs19.promises.writeFile(relativePath, changelogString);
206363
206560
  } else {
206364
206561
  logger.info("[dry-run] Not updating changelog file.");
206365
206562
  logger.trace(`New changelog:
@@ -206375,6 +206572,7 @@ ${changelogString}`);
206375
206572
  }
206376
206573
  logger.debug("Changelog entry found:", changeset.name);
206377
206574
  logger.trace(changeset.body);
206575
+ return changeset?.body;
206378
206576
  }
206379
206577
  async function switchToDefaultBranch(git, defaultBranch) {
206380
206578
  const repoStatus = await git.status();
@@ -206388,41 +206586,89 @@ async function switchToDefaultBranch(git, defaultBranch) {
206388
206586
  logger.info("[dry-run] Not switching branches.");
206389
206587
  }
206390
206588
  }
206391
- async function prepareMain(argv) {
206589
+ async function resolveVersion(git, options) {
206392
206590
  const config3 = getConfiguration();
206393
- const githubConfig = await getGlobalGitHubConfig();
206394
- let newVersion = argv.newVersion;
206395
- const git = await getGitClient();
206396
- const defaultBranch = await getDefaultBranch(git, argv.remote);
206397
- logger.debug(`Default branch for the repo:`, defaultBranch);
206398
- const repoStatus = await git.status();
206399
- const rev = argv.rev || repoStatus.current || defaultBranch;
206400
- if (argv.noGitChecks) {
206401
- logger.info("Not checking the status of the local repository");
206402
- } else {
206403
- checkGitStatus(repoStatus, rev);
206591
+ let version2 = options.versionArg;
206592
+ if (!version2) {
206593
+ const policy = getVersioningPolicy();
206594
+ logger.debug(`No version specified, using versioning policy: ${policy}`);
206595
+ if (policy === "manual" /* Manual */) {
206596
+ throw new ConfigurationError(
206597
+ 'Version is required. Either specify a version argument or set versioning.policy to "auto" or "calver" in .craft.yml'
206598
+ );
206599
+ }
206600
+ version2 = policy;
206404
206601
  }
206405
- const isVersionBumpType = isBumpType(newVersion);
206406
- if (newVersion === "auto" || isVersionBumpType) {
206407
- if (!requiresMinVersion(AUTO_VERSION_MIN_VERSION)) {
206408
- const featureName = isVersionBumpType ? "Version bump types" : "Auto-versioning";
206602
+ if (version2 === "calver") {
206603
+ if (!requiresMinVersion(AUTO_VERSION_MIN_VERSION2)) {
206409
206604
  throw new ConfigurationError(
206410
- `${featureName} requires minVersion >= ${AUTO_VERSION_MIN_VERSION} in .craft.yml. Please update your configuration or specify the version explicitly.`
206605
+ `CalVer versioning requires minVersion >= ${AUTO_VERSION_MIN_VERSION2} in .craft.yml. Please update your configuration or specify the version explicitly.`
206606
+ );
206607
+ }
206608
+ const calverOffset = options.calverOffset ?? (process.env.CRAFT_CALVER_OFFSET ? parseInt(process.env.CRAFT_CALVER_OFFSET, 10) : void 0) ?? config3.versioning?.calver?.offset ?? DEFAULT_CALVER_CONFIG.offset;
206609
+ const calverFormat = config3.versioning?.calver?.format ?? DEFAULT_CALVER_CONFIG.format;
206610
+ return calculateCalVer(git, {
206611
+ offset: calverOffset,
206612
+ format: calverFormat
206613
+ });
206614
+ }
206615
+ if (version2 === "auto" || isBumpType(version2)) {
206616
+ if (!requiresMinVersion(AUTO_VERSION_MIN_VERSION2)) {
206617
+ const featureName = isBumpType(version2) ? "Version bump types" : "Auto-versioning";
206618
+ throw new ConfigurationError(
206619
+ `${featureName} requires minVersion >= ${AUTO_VERSION_MIN_VERSION2} in .craft.yml. Please update your configuration or specify the version explicitly.`
206411
206620
  );
206412
206621
  }
206413
206622
  const latestTag = await getLatestTag(git);
206414
206623
  let bumpType;
206415
- if (newVersion === "auto") {
206624
+ if (version2 === "auto") {
206416
206625
  const changelogResult = await getChangelogWithBumpType(git, latestTag);
206417
206626
  validateBumpType(changelogResult);
206418
206627
  bumpType = changelogResult.bumpType;
206419
206628
  } else {
206420
- bumpType = newVersion;
206629
+ bumpType = version2;
206421
206630
  }
206422
206631
  const currentVersion = latestTag && latestTag.replace(/^v/, "").match(/^\d/) ? latestTag.replace(/^v/, "") : "0.0.0";
206423
- newVersion = calculateNextVersion(currentVersion, bumpType);
206424
- logger.info(`Version bump: ${currentVersion} -> ${newVersion} (${bumpType} bump)`);
206632
+ const newVersion = calculateNextVersion(currentVersion, bumpType);
206633
+ logger.info(
206634
+ `Version bump: ${currentVersion} -> ${newVersion} (${bumpType} bump)`
206635
+ );
206636
+ return newVersion;
206425
206637
  }
206638
+ return version2;
206639
+ }
206640
+ async function prepareMain(argv) {
206641
+ const git = await getGitClient();
206642
+ if (argv.configFrom) {
206643
+ logger.info(`Loading configuration from remote branch: ${argv.configFrom}`);
206644
+ try {
206645
+ await git.fetch([argv.remote, argv.configFrom]);
206646
+ const configContent = await git.show([
206647
+ `${argv.remote}/${argv.configFrom}:${CONFIG_FILE_NAME}`
206648
+ ]);
206649
+ loadConfigurationFromString(configContent);
206650
+ } catch (error3) {
206651
+ throw new ConfigurationError(
206652
+ `Failed to load ${CONFIG_FILE_NAME} from branch "${argv.configFrom}": ${error3.message}`
206653
+ );
206654
+ }
206655
+ }
206656
+ const config3 = getConfiguration();
206657
+ const githubConfig = await getGlobalGitHubConfig();
206658
+ const defaultBranch = await getDefaultBranch(git, argv.remote);
206659
+ logger.debug(`Default branch for the repo:`, defaultBranch);
206660
+ const repoStatus = await git.status();
206661
+ const rev = argv.rev || repoStatus.current || defaultBranch;
206662
+ if (argv.noGitChecks) {
206663
+ logger.info("Not checking the status of the local repository");
206664
+ } else {
206665
+ checkGitStatus(repoStatus, rev);
206666
+ }
206667
+ const newVersion = await resolveVersion(git, {
206668
+ versionArg: argv.newVersion,
206669
+ calverOffset: argv.calverOffset
206670
+ });
206671
+ setGitHubActionsOutput("version", newVersion);
206426
206672
  logger.info(`Releasing version ${newVersion} from ${rev}`);
206427
206673
  if (!argv.rev && rev !== defaultBranch) {
206428
206674
  logger.warn("You're not on your default branch, so I have to ask...");
@@ -206439,7 +206685,7 @@ async function prepareMain(argv) {
206439
206685
  const oldVersion = await getLatestTag(git);
206440
206686
  const changelogPath = typeof config3.changelog === "string" ? config3.changelog : config3.changelog?.filePath;
206441
206687
  const changelogPolicy = typeof config3.changelog === "object" && config3.changelog?.policy ? config3.changelog.policy : config3.changelogPolicy;
206442
- await prepareChangelog(
206688
+ const changelogBody = await prepareChangelog(
206443
206689
  git,
206444
206690
  oldVersion,
206445
206691
  newVersion,
@@ -206457,6 +206703,13 @@ async function prepareMain(argv) {
206457
206703
  logger.debug("Not committing anything since preReleaseCommand is empty.");
206458
206704
  }
206459
206705
  await pushReleaseBranch(git, branchName, argv.remote, !argv.noPush);
206706
+ const releaseSha = await git.revparse(["HEAD"]);
206707
+ setGitHubActionsOutput("branch", branchName);
206708
+ setGitHubActionsOutput("sha", releaseSha);
206709
+ setGitHubActionsOutput("previous_tag", oldVersion || "");
206710
+ if (changelogBody) {
206711
+ setGitHubActionsOutput("changelog", changelogBody);
206712
+ }
206460
206713
  logger.info(
206461
206714
  `View diff at: https://github.com/${githubConfig.owner}/${githubConfig.repo}/compare/${branchName}`
206462
206715
  );
@@ -206549,7 +206802,7 @@ init_logger2();
206549
206802
  init_config2();
206550
206803
  init_errors2();
206551
206804
  var import_path18 = require("path");
206552
- var import_fs19 = require("fs");
206805
+ var import_fs20 = require("fs");
206553
206806
  init_none();
206554
206807
  var mkdirp = require_mkdirp();
206555
206808
  var command6 = ["download [NAME..]"];
@@ -206572,8 +206825,8 @@ var builder3 = (yargs) => yargs.positional("NAME", {
206572
206825
  async function prepareOutputDirectory(argv) {
206573
206826
  if (argv.directory) {
206574
206827
  const fullPath = (0, import_path18.resolve)(argv.directory);
206575
- if ((0, import_fs19.existsSync)(fullPath)) {
206576
- if ((0, import_fs19.lstatSync)(fullPath).isDirectory()) {
206828
+ if ((0, import_fs20.existsSync)(fullPath)) {
206829
+ if ((0, import_fs20.lstatSync)(fullPath).isDirectory()) {
206577
206830
  return fullPath;
206578
206831
  } else {
206579
206832
  throw new ConfigurationError(`Not a directory: ${fullPath}`);