@sentry/craft 2.14.1 → 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 +426 -183
  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.1",
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 = "114a419301b8f047629567f8cdf2c1d902581ce7";
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) {
@@ -158806,11 +158857,11 @@ async function getPRAndLabelsFromCommit(hashes) {
158806
158857
  })
158807
158858
  );
158808
158859
  }
158809
- 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;
158810
158861
  var init_changelog = __esm({
158811
158862
  "src/utils/changelog.ts"() {
158812
158863
  init_import_meta_url();
158813
- import_fs4 = require("fs");
158864
+ import_fs5 = require("fs");
158814
158865
  import_path7 = require("path");
158815
158866
  init_js_yaml();
158816
158867
  init_logger2();
@@ -158881,11 +158932,11 @@ function isLatestRelease(githubRelease, version2) {
158881
158932
  const versionToPublish = parseVersion(version2);
158882
158933
  return latestVersion && versionToPublish ? versionGreaterOrEqualThan(versionToPublish, latestVersion) : true;
158883
158934
  }
158884
- var import_fs5, import_path8, DEFAULT_CONTENT_TYPE, GitHubTarget;
158935
+ var import_fs6, import_path8, DEFAULT_CONTENT_TYPE, GitHubTarget;
158885
158936
  var init_github3 = __esm({
158886
158937
  "src/targets/github.ts"() {
158887
158938
  init_import_meta_url();
158888
- import_fs5 = require("fs");
158939
+ import_fs6 = require("fs");
158889
158940
  import_path8 = require("path");
158890
158941
  init_config2();
158891
158942
  init_project_config();
@@ -158918,7 +158969,8 @@ var init_github3 = __esm({
158918
158969
  changelog,
158919
158970
  previewReleases: this.config.previewReleases === void 0 || !!this.config.previewReleases,
158920
158971
  tagPrefix: this.config.tagPrefix || "",
158921
- tagOnly: !!this.config.tagOnly
158972
+ tagOnly: !!this.config.tagOnly,
158973
+ floatingTags: this.config.floatingTags || []
158922
158974
  };
158923
158975
  this.github = getGitHubClient();
158924
158976
  }
@@ -158961,7 +159013,7 @@ var init_github3 = __esm({
158961
159013
  async getChangelog(version2) {
158962
159014
  let changelog;
158963
159015
  try {
158964
- changelog = (await import_fs5.promises.readFile(this.githubConfig.changelog)).toString();
159016
+ changelog = (await import_fs6.promises.readFile(this.githubConfig.changelog)).toString();
158965
159017
  } catch (err) {
158966
159018
  logger.error("Cannot read changelog, moving on without one", err);
158967
159019
  }
@@ -159056,9 +159108,9 @@ var init_github3 = __esm({
159056
159108
  }
159057
159109
  async handleGitHubUpload(release3, path17, contentType, retries = 3) {
159058
159110
  const contentTypeProcessed = contentType || DEFAULT_CONTENT_TYPE;
159059
- const stats = (0, import_fs5.statSync)(path17);
159111
+ const stats = (0, import_fs6.statSync)(path17);
159060
159112
  const name = (0, import_path8.basename)(path17);
159061
- const file = (0, import_fs5.createReadStream)(path17);
159113
+ const file = (0, import_fs6.createReadStream)(path17);
159062
159114
  const params = {
159063
159115
  ...this.githubConfig,
159064
159116
  headers: {
@@ -159144,6 +159196,71 @@ var init_github3 = __esm({
159144
159196
  });
159145
159197
  }
159146
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
+ }
159147
159264
  /**
159148
159265
  * Creates a new GitHub release and publish all available artifacts.
159149
159266
  *
@@ -159157,7 +159274,9 @@ var init_github3 = __esm({
159157
159274
  this.logger.info(
159158
159275
  `Not creating a GitHub release because "tagOnly" flag was set.`
159159
159276
  );
159160
- return this.createGitTag(version2, revision);
159277
+ await this.createGitTag(version2, revision);
159278
+ await this.updateFloatingTags(version2, revision);
159279
+ return;
159161
159280
  }
159162
159281
  const config3 = getConfiguration();
159163
159282
  let changelog;
@@ -159199,6 +159318,7 @@ var init_github3 = __esm({
159199
159318
  )
159200
159319
  );
159201
159320
  await this.publishRelease(draftRelease, { makeLatest });
159321
+ await this.updateFloatingTags(version2, revision);
159202
159322
  }
159203
159323
  };
159204
159324
  }
@@ -163107,23 +163227,23 @@ var init_esm13 = __esm({
163107
163227
  });
163108
163228
 
163109
163229
  // node_modules/path-scurry/dist/esm/index.js
163110
- 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;
163111
163231
  var init_esm14 = __esm({
163112
163232
  "node_modules/path-scurry/dist/esm/index.js"() {
163113
163233
  init_import_meta_url();
163114
163234
  init_esm12();
163115
163235
  import_node_path6 = require("node:path");
163116
163236
  import_node_url = require("node:url");
163117
- import_fs6 = require("fs");
163237
+ import_fs7 = require("fs");
163118
163238
  actualFS = __toESM(require("node:fs"), 1);
163119
163239
  import_promises = require("node:fs/promises");
163120
163240
  init_esm13();
163121
- realpathSync = import_fs6.realpathSync.native;
163241
+ realpathSync = import_fs7.realpathSync.native;
163122
163242
  defaultFS = {
163123
- lstatSync: import_fs6.lstatSync,
163124
- readdir: import_fs6.readdir,
163125
- readdirSync: import_fs6.readdirSync,
163126
- readlinkSync: import_fs6.readlinkSync,
163243
+ lstatSync: import_fs7.lstatSync,
163244
+ readdir: import_fs7.readdir,
163245
+ readdirSync: import_fs7.readdirSync,
163246
+ readlinkSync: import_fs7.readlinkSync,
163127
163247
  realpathSync,
163128
163248
  promises: {
163129
163249
  lstat: import_promises.lstat,
@@ -165976,7 +166096,7 @@ function isNotFoundError(err) {
165976
166096
  function readPackageJson(packagePath) {
165977
166097
  const packageJsonPath = path9.join(packagePath, "package.json");
165978
166098
  try {
165979
- return JSON.parse((0, import_fs7.readFileSync)(packageJsonPath, "utf-8"));
166099
+ return JSON.parse((0, import_fs8.readFileSync)(packageJsonPath, "utf-8"));
165980
166100
  } catch (err) {
165981
166101
  if (!isNotFoundError(err)) {
165982
166102
  logger.warn(`Failed to parse ${packageJsonPath}:`, err);
@@ -166035,7 +166155,7 @@ async function resolveWorkspaceGlobs(rootDir, patterns) {
166035
166155
  }
166036
166156
  function fileExists(filePath) {
166037
166157
  try {
166038
- (0, import_fs7.readFileSync)(filePath);
166158
+ (0, import_fs8.readFileSync)(filePath);
166039
166159
  return true;
166040
166160
  } catch (err) {
166041
166161
  return false;
@@ -166061,7 +166181,7 @@ async function discoverPnpmWorkspaces(rootDir) {
166061
166181
  const pnpmWorkspacePath = path9.join(rootDir, "pnpm-workspace.yaml");
166062
166182
  let config3;
166063
166183
  try {
166064
- const content = (0, import_fs7.readFileSync)(pnpmWorkspacePath, "utf-8");
166184
+ const content = (0, import_fs8.readFileSync)(pnpmWorkspacePath, "utf-8");
166065
166185
  config3 = load(content);
166066
166186
  } catch (err) {
166067
166187
  if (!isNotFoundError(err)) {
@@ -166166,11 +166286,11 @@ function topologicalSortPackages(packages) {
166166
166286
  return depthA - depthB;
166167
166287
  });
166168
166288
  }
166169
- var import_fs7, path9;
166289
+ var import_fs8, path9;
166170
166290
  var init_workspaces = __esm({
166171
166291
  "src/utils/workspaces.ts"() {
166172
166292
  init_import_meta_url();
166173
- import_fs7 = require("fs");
166293
+ import_fs8 = require("fs");
166174
166294
  path9 = __toESM(require("path"));
166175
166295
  init_js_yaml();
166176
166296
  init_esm15();
@@ -166191,7 +166311,7 @@ async function getLatestVersion(packageName, npmConfig, otp) {
166191
166311
  }
166192
166312
  spawnOptions.env[NPM_TOKEN_ENV_VAR] = npmConfig.token;
166193
166313
  spawnOptions.env.npm_config_userconfig = filePath;
166194
- (0, import_fs8.writeFileSync)(
166314
+ (0, import_fs9.writeFileSync)(
166195
166315
  filePath,
166196
166316
  `//registry.npmjs.org/:_authToken=\${${NPM_TOKEN_ENV_VAR}}`
166197
166317
  );
@@ -166236,7 +166356,7 @@ async function getPublishTag(version2, checkPackageName, npmConfig, logger3, otp
166236
166356
  }
166237
166357
  return void 0;
166238
166358
  }
166239
- 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;
166240
166360
  var init_npm = __esm({
166241
166361
  "src/targets/npm.ts"() {
166242
166362
  init_import_meta_url();
@@ -166250,7 +166370,7 @@ var init_npm = __esm({
166250
166370
  init_workspaces();
166251
166371
  init_base5();
166252
166372
  init_files();
166253
- import_fs8 = require("fs");
166373
+ import_fs9 = require("fs");
166254
166374
  init_logger2();
166255
166375
  NPM_BIN = process.env.NPM_BIN || "npm";
166256
166376
  YARN_BIN = process.env.YARN_BIN || "yarn";
@@ -166459,7 +166579,7 @@ var init_npm = __esm({
166459
166579
  }
166460
166580
  spawnOptions.env[NPM_TOKEN_ENV_VAR] = this.npmConfig.token;
166461
166581
  spawnOptions.env.npm_config_userconfig = filePath;
166462
- (0, import_fs8.writeFileSync)(
166582
+ (0, import_fs9.writeFileSync)(
166463
166583
  filePath,
166464
166584
  `//registry.npmjs.org/:_authToken=\${${NPM_TOKEN_ENV_VAR}}`
166465
166585
  );
@@ -166628,11 +166748,11 @@ function uniquePackages(filenames) {
166628
166748
  });
166629
166749
  return [...new Set(versions)].sort();
166630
166750
  }
166631
- var import_fs9, import_path9, WHEEL_REGEX, SentryPypiTarget;
166751
+ var import_fs10, import_path9, WHEEL_REGEX, SentryPypiTarget;
166632
166752
  var init_sentryPypi = __esm({
166633
166753
  "src/targets/sentryPypi.ts"() {
166634
166754
  init_import_meta_url();
166635
- import_fs9 = __toESM(require("fs"));
166755
+ import_fs10 = __toESM(require("fs"));
166636
166756
  import_path9 = __toESM(require("path"));
166637
166757
  init_files();
166638
166758
  init_errors2();
@@ -166690,7 +166810,7 @@ var init_sentryPypi = __esm({
166690
166810
  { cwd: directory },
166691
166811
  { enableInDryRunMode: true }
166692
166812
  );
166693
- 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"), {
166694
166814
  encoding: "utf-8"
166695
166815
  });
166696
166816
  const tree2 = (await spawnProcess(
@@ -166997,7 +167117,7 @@ var init_packagePath = __esm({
166997
167117
  async function getPackageManifest(baseDir, type2, canonicalName, version2) {
166998
167118
  const packageDirPath = getPackageDirPath(type2, canonicalName);
166999
167119
  const versionFilePath = path13.join(baseDir, packageDirPath, `${version2}.json`);
167000
- if ((0, import_fs10.existsSync)(versionFilePath)) {
167120
+ if ((0, import_fs11.existsSync)(versionFilePath)) {
167001
167121
  reportError(`Version file for "${version2}" already exists. Aborting.`);
167002
167122
  }
167003
167123
  const packageManifestPath = path13.join(baseDir, packageDirPath, "latest.json");
@@ -167005,7 +167125,7 @@ async function getPackageManifest(baseDir, type2, canonicalName, version2) {
167005
167125
  return {
167006
167126
  versionFilePath,
167007
167127
  packageManifest: JSON.parse(
167008
- await import_fs10.promises.readFile(packageManifestPath, { encoding: "utf-8" })
167128
+ await import_fs11.promises.readFile(packageManifestPath, { encoding: "utf-8" })
167009
167129
  ) || {}
167010
167130
  };
167011
167131
  }
@@ -167013,14 +167133,14 @@ async function updateManifestSymlinks(updatedManifest, version2, versionFilePath
167013
167133
  const manifestString = JSON.stringify(updatedManifest, void 0, 2) + "\n";
167014
167134
  logger.trace("Updated manifest", manifestString);
167015
167135
  logger.debug(`Writing updated manifest to "${versionFilePath}"...`);
167016
- await import_fs10.promises.writeFile(versionFilePath, manifestString);
167136
+ await import_fs11.promises.writeFile(versionFilePath, manifestString);
167017
167137
  createSymlinks(versionFilePath, version2, previousVersion);
167018
167138
  }
167019
- var import_fs10, path13, DEFAULT_REGISTRY_REMOTE;
167139
+ var import_fs11, path13, DEFAULT_REGISTRY_REMOTE;
167020
167140
  var init_registry = __esm({
167021
167141
  "src/utils/registry.ts"() {
167022
167142
  init_import_meta_url();
167023
- import_fs10 = require("fs");
167143
+ import_fs11 = require("fs");
167024
167144
  path13 = __toESM(require("path"));
167025
167145
  init_logger2();
167026
167146
  init_symlink();
@@ -196177,29 +196297,29 @@ var init_upm = __esm({
196177
196297
  // src/utils/gpg.ts
196178
196298
  async function importGPGKey(privateKey) {
196179
196299
  const PRIVATE_KEY_FILE = path15.join((0, import_os.tmpdir)(), "private-key.asc");
196180
- await import_fs11.promises.writeFile(PRIVATE_KEY_FILE, privateKey);
196300
+ await import_fs12.promises.writeFile(PRIVATE_KEY_FILE, privateKey);
196181
196301
  await spawnProcess(`gpg`, ["--batch", "--import", PRIVATE_KEY_FILE]);
196182
- await import_fs11.promises.unlink(PRIVATE_KEY_FILE);
196302
+ await import_fs12.promises.unlink(PRIVATE_KEY_FILE);
196183
196303
  }
196184
- var import_os, import_fs11, path15;
196304
+ var import_os, import_fs12, path15;
196185
196305
  var init_gpg = __esm({
196186
196306
  "src/utils/gpg.ts"() {
196187
196307
  init_import_meta_url();
196188
196308
  import_os = require("os");
196189
- import_fs11 = require("fs");
196309
+ import_fs12 = require("fs");
196190
196310
  path15 = __toESM(require("path"));
196191
196311
  init_system();
196192
196312
  }
196193
196313
  });
196194
196314
 
196195
196315
  // src/targets/maven.ts
196196
- 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;
196197
196317
  var init_maven = __esm({
196198
196318
  "src/targets/maven.ts"() {
196199
196319
  init_import_meta_url();
196200
196320
  init_base5();
196201
196321
  import_path10 = require("path");
196202
- import_fs12 = require("fs");
196322
+ import_fs13 = require("fs");
196203
196323
  import_node_fetch5 = __toESM(require_lib10());
196204
196324
  init_system();
196205
196325
  init_async();
@@ -196427,7 +196547,7 @@ var init_maven = __esm({
196427
196547
  if (await this.isBomFile(pomFilepath)) {
196428
196548
  return pomFilepath;
196429
196549
  }
196430
- const filesInDir = await import_fs12.promises.readdir(distDir);
196550
+ const filesInDir = await import_fs13.promises.readdir(distDir);
196431
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));
196432
196552
  return potentialPoms.find((f3) => this.isBomFile(f3));
196433
196553
  }
@@ -196442,7 +196562,7 @@ var init_maven = __esm({
196442
196562
  */
196443
196563
  async isBomFile(pomFilepath) {
196444
196564
  try {
196445
- const fileContents = await import_fs12.promises.readFile(pomFilepath, {
196565
+ const fileContents = await import_fs13.promises.readFile(pomFilepath, {
196446
196566
  encoding: "utf8"
196447
196567
  });
196448
196568
  return BOM_FILE_KEY_REGEXP.test(fileContents);
@@ -196593,7 +196713,7 @@ Error:
196593
196713
  async getPomFileInDist(distDir) {
196594
196714
  const pomFilepath = (0, import_path10.join)(distDir, "pom-default.xml");
196595
196715
  try {
196596
- const stat = await import_fs12.promises.stat(pomFilepath);
196716
+ const stat = await import_fs13.promises.stat(pomFilepath);
196597
196717
  if (stat.isFile()) {
196598
196718
  return pomFilepath;
196599
196719
  }
@@ -196606,7 +196726,7 @@ Error:
196606
196726
  */
196607
196727
  async fileExists(filePath) {
196608
196728
  try {
196609
- const stat = await import_fs12.promises.stat(filePath);
196729
+ const stat = await import_fs13.promises.stat(filePath);
196610
196730
  if (stat.isFile()) {
196611
196731
  return true;
196612
196732
  }
@@ -196625,7 +196745,7 @@ Error:
196625
196745
  async fixModuleFileName(distDir, moduleFile) {
196626
196746
  const fallbackFile = (0, import_path10.join)(distDir, "module.json");
196627
196747
  if (!await this.fileExists(moduleFile) && await this.fileExists(fallbackFile)) {
196628
- await import_fs12.promises.rename(fallbackFile, moduleFile);
196748
+ await import_fs13.promises.rename(fallbackFile, moduleFile);
196629
196749
  }
196630
196750
  }
196631
196751
  async uploadPomDistribution(distDir) {
@@ -196701,7 +196821,7 @@ Error:
196701
196821
  );
196702
196822
  } else if (isAppleDistDir) {
196703
196823
  files["metadataFile"] = (0, import_path10.join)(distDir, `${moduleName}-metadata.jar`);
196704
- 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));
196705
196825
  files["klibFiles"] = cinteropFiles;
196706
196826
  } else if (isKlibDistDir) {
196707
196827
  files["klibFiles"] = [(0, import_path10.join)(distDir, `${moduleName}.klib`)];
@@ -196886,14 +197006,14 @@ Error:
196886
197006
  });
196887
197007
 
196888
197008
  // src/targets/symbolCollector.ts
196889
- 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;
196890
197010
  var init_symbolCollector = __esm({
196891
197011
  "src/targets/symbolCollector.ts"() {
196892
197012
  init_import_meta_url();
196893
197013
  init_errors2();
196894
197014
  init_base5();
196895
197015
  init_files();
196896
- import_fs13 = require("fs");
197016
+ import_fs14 = require("fs");
196897
197017
  init_system();
196898
197018
  import_path11 = require("path");
196899
197019
  DEFAULT_SYM_COLLECTOR_SERVER_ENDPOINT = "https://symbol-collector.services.sentry.io/";
@@ -196941,7 +197061,7 @@ var init_symbolCollector = __esm({
196941
197061
  await Promise.all(
196942
197062
  artifacts.map(async (artifact, index) => {
196943
197063
  const subdirPath = (0, import_path11.join)(dir, String(index));
196944
- await import_fs13.promises.mkdir(subdirPath);
197064
+ await import_fs14.promises.mkdir(subdirPath);
196945
197065
  await this.artifactProvider.downloadArtifact(artifact, subdirPath);
196946
197066
  })
196947
197067
  );
@@ -196971,11 +197091,11 @@ var init_symbolCollector = __esm({
196971
197091
  });
196972
197092
 
196973
197093
  // src/targets/pubDev.ts
196974
- var import_fs14, import_os2, import_path12, targetSecrets2, PubDevTarget;
197094
+ var import_fs15, import_os2, import_path12, targetSecrets2, PubDevTarget;
196975
197095
  var init_pubDev = __esm({
196976
197096
  "src/targets/pubDev.ts"() {
196977
197097
  init_import_meta_url();
196978
- import_fs14 = require("fs");
197098
+ import_fs15 = require("fs");
196979
197099
  import_os2 = require("os");
196980
197100
  import_path12 = require("path");
196981
197101
  init_js_yaml();
@@ -197080,11 +197200,11 @@ var init_pubDev = __esm({
197080
197200
  // Expiration date is required, but irrelevant
197081
197201
  };
197082
197202
  try {
197083
- await import_fs14.promises.access(credentialsFilePath, import_fs14.constants.F_OK);
197203
+ await import_fs15.promises.access(credentialsFilePath, import_fs15.constants.F_OK);
197084
197204
  this.logger.warn("Credentials file already exists. Skipping creation.");
197085
197205
  } catch {
197086
- await import_fs14.promises.mkdir((0, import_path12.dirname)(credentialsFilePath), { recursive: true });
197087
- 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));
197088
197208
  this.logger.info("Credentials file created.");
197089
197209
  }
197090
197210
  }
@@ -197156,10 +197276,10 @@ var init_pubDev = __esm({
197156
197276
  }
197157
197277
  async removeDependencyOverrides(directory, pkg) {
197158
197278
  const pubSpecPath = (0, import_path12.join)(directory, pkg, "pubspec.yaml");
197159
- const pubSpecContent = await import_fs14.promises.readFile(pubSpecPath, "utf8");
197279
+ const pubSpecContent = await import_fs15.promises.readFile(pubSpecPath, "utf8");
197160
197280
  const pubSpecYaml = load(pubSpecContent);
197161
197281
  delete pubSpecYaml.dependency_overrides;
197162
- await import_fs14.promises.writeFile(pubSpecPath, dump(pubSpecYaml));
197282
+ await import_fs15.promises.writeFile(pubSpecPath, dump(pubSpecYaml));
197163
197283
  }
197164
197284
  };
197165
197285
  }
@@ -197628,7 +197748,7 @@ function findConfigFile() {
197628
197748
  let currentDir = cwd;
197629
197749
  while (depth <= MAX_DEPTH) {
197630
197750
  const probePath = import_path14.default.join(currentDir, CONFIG_FILE_NAME);
197631
- 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()) {
197632
197752
  _configPathCache = probePath;
197633
197753
  return _configPathCache;
197634
197754
  }
@@ -197682,7 +197802,14 @@ function getConfiguration(clearCache = false) {
197682
197802
  }
197683
197803
  const configPath = getConfigFilePath();
197684
197804
  logger.debug("Configuration file found: ", configPath);
197685
- 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);
197686
197813
  _configCache = validateConfiguration(rawConfig);
197687
197814
  checkMinimalConfigVersion(_configCache);
197688
197815
  return _configCache;
@@ -197730,6 +197857,13 @@ function requiresMinVersion(requiredVersion) {
197730
197857
  }
197731
197858
  return versionGreaterOrEqualThan(configuredMinVersion, required);
197732
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
+ }
197733
197867
  async function getGlobalGitHubConfig(clearCache = false) {
197734
197868
  if (!clearCache && _globalGitHubConfigCache !== void 0) {
197735
197869
  if (_globalGitHubConfigCache === null) {
@@ -197866,11 +198000,11 @@ async function expandWorkspaceTargets(targets) {
197866
198000
  }
197867
198001
  return expandedTargets;
197868
198002
  }
197869
- 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;
197870
198004
  var init_config2 = __esm({
197871
198005
  "src/config.ts"() {
197872
198006
  init_import_meta_url();
197873
- import_fs15 = require("fs");
198007
+ import_fs16 = require("fs");
197874
198008
  import_path14 = __toESM(require("path"));
197875
198009
  import_ajv = __toESM(require_ajv());
197876
198010
  init_js_yaml();
@@ -197886,6 +198020,7 @@ var init_config2 = __esm({
197886
198020
  init_github2();
197887
198021
  CONFIG_FILE_NAME = ".craft.yml";
197888
198022
  DEFAULT_RELEASE_BRANCH_NAME = "release";
198023
+ AUTO_VERSION_MIN_VERSION = "2.14.0";
197889
198024
  DEFAULT_CHANGELOG_FILE_PATH = "CHANGELOG.md";
197890
198025
  }
197891
198026
  });
@@ -197916,7 +198051,7 @@ function checkFileIsPrivate(path17) {
197916
198051
  const FULL_MODE_MASK = 511;
197917
198052
  const GROUP_MODE_MASK = 56;
197918
198053
  const OTHER_MODE_MASK = 7;
197919
- const mode = (0, import_fs16.statSync)(path17).mode;
198054
+ const mode = (0, import_fs17.statSync)(path17).mode;
197920
198055
  if (mode & GROUP_MODE_MASK || mode & OTHER_MODE_MASK) {
197921
198056
  const perms = (mode & FULL_MODE_MASK).toString(8);
197922
198057
  logger.warn(
@@ -197929,7 +198064,7 @@ function checkFileIsPrivate(path17) {
197929
198064
  function readEnvironmentConfig(overwriteExisting = false) {
197930
198065
  let newEnv = {};
197931
198066
  const homedirEnvFile = (0, import_path15.join)(os4.homedir(), ENV_FILE_NAME);
197932
- if ((0, import_fs16.existsSync)(homedirEnvFile)) {
198067
+ if ((0, import_fs17.existsSync)(homedirEnvFile)) {
197933
198068
  logger.debug(
197934
198069
  "Found environment file in the home directory:",
197935
198070
  homedirEnvFile
@@ -197949,7 +198084,7 @@ function readEnvironmentConfig(overwriteExisting = false) {
197949
198084
  const configDirEnvFile = configFileDir && (0, import_path15.join)(configFileDir, ENV_FILE_NAME);
197950
198085
  if (!configDirEnvFile) {
197951
198086
  logger.debug("No configuration file found:", CONFIG_FILE_NAME);
197952
- } else if (configDirEnvFile && (0, import_fs16.existsSync)(configDirEnvFile)) {
198087
+ } else if (configDirEnvFile && (0, import_fs17.existsSync)(configDirEnvFile)) {
197953
198088
  logger.debug(
197954
198089
  "Found environment file in the configuration directory:",
197955
198090
  configDirEnvFile
@@ -197980,11 +198115,11 @@ function checkEnvForPrerequisite(...varList) {
197980
198115
  );
197981
198116
  }
197982
198117
  }
197983
- var import_fs16, import_path15, import_nvar, os4, ENV_FILE_NAME;
198118
+ var import_fs17, import_path15, import_nvar, os4, ENV_FILE_NAME;
197984
198119
  var init_env = __esm({
197985
198120
  "src/utils/env.ts"() {
197986
198121
  init_import_meta_url();
197987
- import_fs16 = require("fs");
198122
+ import_fs17 = require("fs");
197988
198123
  import_path15 = require("path");
197989
198124
  import_nvar = __toESM(require_lib2());
197990
198125
  init_config2();
@@ -198353,7 +198488,7 @@ var require_semver3 = __commonJS({
198353
198488
  var { safeRe: re2, t: t3 } = require_re();
198354
198489
  var parseOptions = require_parse_options();
198355
198490
  var { compareIdentifiers } = require_identifiers();
198356
- var SemVer2 = class _SemVer {
198491
+ var SemVer3 = class _SemVer {
198357
198492
  constructor(version2, options) {
198358
198493
  options = parseOptions(options);
198359
198494
  if (version2 instanceof _SemVer) {
@@ -198619,7 +198754,7 @@ var require_semver3 = __commonJS({
198619
198754
  return this;
198620
198755
  }
198621
198756
  };
198622
- module2.exports = SemVer2;
198757
+ module2.exports = SemVer3;
198623
198758
  }
198624
198759
  });
198625
198760
 
@@ -198628,13 +198763,13 @@ var require_parse3 = __commonJS({
198628
198763
  "node_modules/semver/functions/parse.js"(exports2, module2) {
198629
198764
  "use strict";
198630
198765
  init_import_meta_url();
198631
- var SemVer2 = require_semver3();
198766
+ var SemVer3 = require_semver3();
198632
198767
  var parse4 = (version2, options, throwErrors = false) => {
198633
- if (version2 instanceof SemVer2) {
198768
+ if (version2 instanceof SemVer3) {
198634
198769
  return version2;
198635
198770
  }
198636
198771
  try {
198637
- return new SemVer2(version2, options);
198772
+ return new SemVer3(version2, options);
198638
198773
  } catch (er) {
198639
198774
  if (!throwErrors) {
198640
198775
  return null;
@@ -198679,7 +198814,7 @@ var require_inc = __commonJS({
198679
198814
  "node_modules/semver/functions/inc.js"(exports2, module2) {
198680
198815
  "use strict";
198681
198816
  init_import_meta_url();
198682
- var SemVer2 = require_semver3();
198817
+ var SemVer3 = require_semver3();
198683
198818
  var inc2 = (version2, release3, options, identifier, identifierBase) => {
198684
198819
  if (typeof options === "string") {
198685
198820
  identifierBase = identifier;
@@ -198687,8 +198822,8 @@ var require_inc = __commonJS({
198687
198822
  options = void 0;
198688
198823
  }
198689
198824
  try {
198690
- return new SemVer2(
198691
- version2 instanceof SemVer2 ? version2.version : version2,
198825
+ return new SemVer3(
198826
+ version2 instanceof SemVer3 ? version2.version : version2,
198692
198827
  options
198693
198828
  ).inc(release3, identifier, identifierBase).version;
198694
198829
  } catch (er) {
@@ -198749,8 +198884,8 @@ var require_major = __commonJS({
198749
198884
  "node_modules/semver/functions/major.js"(exports2, module2) {
198750
198885
  "use strict";
198751
198886
  init_import_meta_url();
198752
- var SemVer2 = require_semver3();
198753
- var major2 = (a3, loose) => new SemVer2(a3, loose).major;
198887
+ var SemVer3 = require_semver3();
198888
+ var major2 = (a3, loose) => new SemVer3(a3, loose).major;
198754
198889
  module2.exports = major2;
198755
198890
  }
198756
198891
  });
@@ -198760,8 +198895,8 @@ var require_minor = __commonJS({
198760
198895
  "node_modules/semver/functions/minor.js"(exports2, module2) {
198761
198896
  "use strict";
198762
198897
  init_import_meta_url();
198763
- var SemVer2 = require_semver3();
198764
- var minor = (a3, loose) => new SemVer2(a3, loose).minor;
198898
+ var SemVer3 = require_semver3();
198899
+ var minor = (a3, loose) => new SemVer3(a3, loose).minor;
198765
198900
  module2.exports = minor;
198766
198901
  }
198767
198902
  });
@@ -198771,8 +198906,8 @@ var require_patch = __commonJS({
198771
198906
  "node_modules/semver/functions/patch.js"(exports2, module2) {
198772
198907
  "use strict";
198773
198908
  init_import_meta_url();
198774
- var SemVer2 = require_semver3();
198775
- var patch = (a3, loose) => new SemVer2(a3, loose).patch;
198909
+ var SemVer3 = require_semver3();
198910
+ var patch = (a3, loose) => new SemVer3(a3, loose).patch;
198776
198911
  module2.exports = patch;
198777
198912
  }
198778
198913
  });
@@ -198796,8 +198931,8 @@ var require_compare = __commonJS({
198796
198931
  "node_modules/semver/functions/compare.js"(exports2, module2) {
198797
198932
  "use strict";
198798
198933
  init_import_meta_url();
198799
- var SemVer2 = require_semver3();
198800
- 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));
198801
198936
  module2.exports = compare;
198802
198937
  }
198803
198938
  });
@@ -198829,10 +198964,10 @@ var require_compare_build = __commonJS({
198829
198964
  "node_modules/semver/functions/compare-build.js"(exports2, module2) {
198830
198965
  "use strict";
198831
198966
  init_import_meta_url();
198832
- var SemVer2 = require_semver3();
198967
+ var SemVer3 = require_semver3();
198833
198968
  var compareBuild = (a3, b3, loose) => {
198834
- const versionA = new SemVer2(a3, loose);
198835
- const versionB = new SemVer2(b3, loose);
198969
+ const versionA = new SemVer3(a3, loose);
198970
+ const versionB = new SemVer3(b3, loose);
198836
198971
  return versionA.compare(versionB) || versionA.compareBuild(versionB);
198837
198972
  };
198838
198973
  module2.exports = compareBuild;
@@ -198983,11 +199118,11 @@ var require_coerce = __commonJS({
198983
199118
  "node_modules/semver/functions/coerce.js"(exports2, module2) {
198984
199119
  "use strict";
198985
199120
  init_import_meta_url();
198986
- var SemVer2 = require_semver3();
199121
+ var SemVer3 = require_semver3();
198987
199122
  var parse4 = require_parse3();
198988
199123
  var { safeRe: re2, t: t3 } = require_re();
198989
199124
  var coerce = (version2, options) => {
198990
- if (version2 instanceof SemVer2) {
199125
+ if (version2 instanceof SemVer3) {
198991
199126
  return version2;
198992
199127
  }
198993
199128
  if (typeof version2 === "number") {
@@ -199195,7 +199330,7 @@ var require_range2 = __commonJS({
199195
199330
  }
199196
199331
  if (typeof version2 === "string") {
199197
199332
  try {
199198
- version2 = new SemVer2(version2, this.options);
199333
+ version2 = new SemVer3(version2, this.options);
199199
199334
  } catch (er) {
199200
199335
  return false;
199201
199336
  }
@@ -199214,7 +199349,7 @@ var require_range2 = __commonJS({
199214
199349
  var parseOptions = require_parse_options();
199215
199350
  var Comparator = require_comparator();
199216
199351
  var debug3 = require_debug();
199217
- var SemVer2 = require_semver3();
199352
+ var SemVer3 = require_semver3();
199218
199353
  var {
199219
199354
  safeRe: re2,
199220
199355
  t: t3,
@@ -199486,7 +199621,7 @@ var require_comparator = __commonJS({
199486
199621
  if (!m3[2]) {
199487
199622
  this.semver = ANY;
199488
199623
  } else {
199489
- this.semver = new SemVer2(m3[2], this.options.loose);
199624
+ this.semver = new SemVer3(m3[2], this.options.loose);
199490
199625
  }
199491
199626
  }
199492
199627
  toString() {
@@ -199499,7 +199634,7 @@ var require_comparator = __commonJS({
199499
199634
  }
199500
199635
  if (typeof version2 === "string") {
199501
199636
  try {
199502
- version2 = new SemVer2(version2, this.options);
199637
+ version2 = new SemVer3(version2, this.options);
199503
199638
  } catch (er) {
199504
199639
  return false;
199505
199640
  }
@@ -199551,7 +199686,7 @@ var require_comparator = __commonJS({
199551
199686
  var { safeRe: re2, t: t3 } = require_re();
199552
199687
  var cmp = require_cmp();
199553
199688
  var debug3 = require_debug();
199554
- var SemVer2 = require_semver3();
199689
+ var SemVer3 = require_semver3();
199555
199690
  var Range = require_range2();
199556
199691
  }
199557
199692
  });
@@ -199590,7 +199725,7 @@ var require_max_satisfying = __commonJS({
199590
199725
  "node_modules/semver/ranges/max-satisfying.js"(exports2, module2) {
199591
199726
  "use strict";
199592
199727
  init_import_meta_url();
199593
- var SemVer2 = require_semver3();
199728
+ var SemVer3 = require_semver3();
199594
199729
  var Range = require_range2();
199595
199730
  var maxSatisfying = (versions, range3, options) => {
199596
199731
  let max = null;
@@ -199605,7 +199740,7 @@ var require_max_satisfying = __commonJS({
199605
199740
  if (rangeObj.test(v6)) {
199606
199741
  if (!max || maxSV.compare(v6) === -1) {
199607
199742
  max = v6;
199608
- maxSV = new SemVer2(max, options);
199743
+ maxSV = new SemVer3(max, options);
199609
199744
  }
199610
199745
  }
199611
199746
  });
@@ -199620,7 +199755,7 @@ var require_min_satisfying = __commonJS({
199620
199755
  "node_modules/semver/ranges/min-satisfying.js"(exports2, module2) {
199621
199756
  "use strict";
199622
199757
  init_import_meta_url();
199623
- var SemVer2 = require_semver3();
199758
+ var SemVer3 = require_semver3();
199624
199759
  var Range = require_range2();
199625
199760
  var minSatisfying = (versions, range3, options) => {
199626
199761
  let min = null;
@@ -199635,7 +199770,7 @@ var require_min_satisfying = __commonJS({
199635
199770
  if (rangeObj.test(v6)) {
199636
199771
  if (!min || minSV.compare(v6) === 1) {
199637
199772
  min = v6;
199638
- minSV = new SemVer2(min, options);
199773
+ minSV = new SemVer3(min, options);
199639
199774
  }
199640
199775
  }
199641
199776
  });
@@ -199650,16 +199785,16 @@ var require_min_version = __commonJS({
199650
199785
  "node_modules/semver/ranges/min-version.js"(exports2, module2) {
199651
199786
  "use strict";
199652
199787
  init_import_meta_url();
199653
- var SemVer2 = require_semver3();
199788
+ var SemVer3 = require_semver3();
199654
199789
  var Range = require_range2();
199655
199790
  var gt = require_gt();
199656
199791
  var minVersion = (range3, loose) => {
199657
199792
  range3 = new Range(range3, loose);
199658
- let minver = new SemVer2("0.0.0");
199793
+ let minver = new SemVer3("0.0.0");
199659
199794
  if (range3.test(minver)) {
199660
199795
  return minver;
199661
199796
  }
199662
- minver = new SemVer2("0.0.0-0");
199797
+ minver = new SemVer3("0.0.0-0");
199663
199798
  if (range3.test(minver)) {
199664
199799
  return minver;
199665
199800
  }
@@ -199668,7 +199803,7 @@ var require_min_version = __commonJS({
199668
199803
  const comparators = range3.set[i3];
199669
199804
  let setMin = null;
199670
199805
  comparators.forEach((comparator) => {
199671
- const compver = new SemVer2(comparator.semver.version);
199806
+ const compver = new SemVer3(comparator.semver.version);
199672
199807
  switch (comparator.operator) {
199673
199808
  case ">":
199674
199809
  if (compver.prerelease.length === 0) {
@@ -199727,7 +199862,7 @@ var require_outside = __commonJS({
199727
199862
  "node_modules/semver/ranges/outside.js"(exports2, module2) {
199728
199863
  "use strict";
199729
199864
  init_import_meta_url();
199730
- var SemVer2 = require_semver3();
199865
+ var SemVer3 = require_semver3();
199731
199866
  var Comparator = require_comparator();
199732
199867
  var { ANY } = Comparator;
199733
199868
  var Range = require_range2();
@@ -199737,7 +199872,7 @@ var require_outside = __commonJS({
199737
199872
  var lte2 = require_lte();
199738
199873
  var gte2 = require_gte();
199739
199874
  var outside = (version2, range3, hilo, options) => {
199740
- version2 = new SemVer2(version2, options);
199875
+ version2 = new SemVer3(version2, options);
199741
199876
  range3 = new Range(range3, options);
199742
199877
  let gtfn, ltefn, ltfn, comp, ecomp;
199743
199878
  switch (hilo) {
@@ -200050,7 +200185,7 @@ var require_semver4 = __commonJS({
200050
200185
  init_import_meta_url();
200051
200186
  var internalRe = require_re();
200052
200187
  var constants3 = require_constants3();
200053
- var SemVer2 = require_semver3();
200188
+ var SemVer3 = require_semver3();
200054
200189
  var identifiers = require_identifiers();
200055
200190
  var parse4 = require_parse3();
200056
200191
  var valid = require_valid();
@@ -200127,7 +200262,7 @@ var require_semver4 = __commonJS({
200127
200262
  intersects,
200128
200263
  simplifyRange,
200129
200264
  subset,
200130
- SemVer: SemVer2,
200265
+ SemVer: SemVer3,
200131
200266
  re: internalRe.re,
200132
200267
  src: internalRe.src,
200133
200268
  tokens: internalRe.t,
@@ -205693,12 +205828,52 @@ __export(prepare_exports, {
205693
205828
  runPreReleaseCommand: () => runPreReleaseCommand
205694
205829
  });
205695
205830
  init_import_meta_url();
205696
- var import_fs18 = require("fs");
205831
+ var import_fs19 = require("fs");
205697
205832
  var import_path17 = require("path");
205698
205833
  var shellQuote2 = __toESM(require_shell_quote());
205699
205834
  init_config2();
205700
205835
  init_logger2();
205701
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
205702
205877
  init_async();
205703
205878
  init_changelog();
205704
205879
  init_errors2();
@@ -205763,7 +205938,7 @@ __export(publish_exports, {
205763
205938
  });
205764
205939
  init_import_meta_url();
205765
205940
  var import_chalk = __toESM(require_source());
205766
- var import_fs17 = require("fs");
205941
+ var import_fs18 = require("fs");
205767
205942
  var import_path16 = require("path");
205768
205943
  var import_shell_quote = __toESM(require_shell_quote());
205769
205944
  var import_string_length = __toESM(require_string_length());
@@ -206055,11 +206230,11 @@ async function publishMain(argv) {
206055
206230
  let targetConfigList = await expandWorkspaceTargets(config3.targets || []);
206056
206231
  logger.info(`Looking for publish state file for ${newVersion}...`);
206057
206232
  const publishStateFile = `.craft-publish-${newVersion}.json`;
206058
- const earlierStateExists = (0, import_fs17.existsSync)(publishStateFile);
206233
+ const earlierStateExists = (0, import_fs18.existsSync)(publishStateFile);
206059
206234
  let publishState;
206060
206235
  if (earlierStateExists) {
206061
206236
  logger.info(`Found publish state file, resuming from there...`);
206062
- publishState = JSON.parse((0, import_fs17.readFileSync)(publishStateFile).toString());
206237
+ publishState = JSON.parse((0, import_fs18.readFileSync)(publishStateFile).toString());
206063
206238
  targetsToPublish = new Set(targetConfigList.map(BaseTarget.getId));
206064
206239
  } else {
206065
206240
  publishState = { published: /* @__PURE__ */ Object.create(null) };
@@ -206091,7 +206266,7 @@ async function publishMain(argv) {
206091
206266
  await publishToTarget(target, newVersion, revision);
206092
206267
  publishState.published[BaseTarget.getId(target.config)] = true;
206093
206268
  if (!isDryRun()) {
206094
- (0, import_fs17.writeFileSync)(publishStateFile, JSON.stringify(publishState));
206269
+ (0, import_fs18.writeFileSync)(publishStateFile, JSON.stringify(publishState));
206095
206270
  }
206096
206271
  }
206097
206272
  if (argv.keepDownloads) {
@@ -206118,7 +206293,7 @@ async function publishMain(argv) {
206118
206293
  argv.keepBranch
206119
206294
  );
206120
206295
  if (!isDryRun()) {
206121
- import_fs17.promises.unlink(publishStateFile).catch(
206296
+ import_fs18.promises.unlink(publishStateFile).catch(
206122
206297
  (err) => logger.trace("Couldn't remove publish state file: ", err)
206123
206298
  );
206124
206299
  }
@@ -206148,9 +206323,9 @@ var command3 = ["prepare NEW-VERSION"];
206148
206323
  var aliases2 = ["p", "prerelease", "prepublish", "prepare", "release"];
206149
206324
  var description2 = "\u{1F6A2} Prepare a new release branch";
206150
206325
  var DEFAULT_BUMP_VERSION_PATH = (0, import_path17.join)("scripts", "bump-version.sh");
206151
- var AUTO_VERSION_MIN_VERSION = "2.14.0";
206326
+ var AUTO_VERSION_MIN_VERSION2 = "2.14.0";
206152
206327
  var builder2 = (yargs) => yargs.positional("NEW-VERSION", {
206153
- 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',
206154
206329
  type: "string"
206155
206330
  }).option("rev", {
206156
206331
  alias: "r",
@@ -206176,13 +206351,25 @@ var builder2 = (yargs) => yargs.positional("NEW-VERSION", {
206176
206351
  default: "origin",
206177
206352
  description: "The git remote to use when pushing",
206178
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"
206179
206360
  }).check(checkVersionOrPart);
206180
206361
  var SLEEP_BEFORE_PUBLISH_SECONDS = 30;
206181
206362
  function checkVersionOrPart(argv, _opt) {
206182
206363
  const version2 = argv.newVersion;
206364
+ if (!version2) {
206365
+ return true;
206366
+ }
206183
206367
  if (version2 === "auto") {
206184
206368
  return true;
206185
206369
  }
206370
+ if (version2 === "calver") {
206371
+ return true;
206372
+ }
206186
206373
  if (isBumpType(version2)) {
206187
206374
  return true;
206188
206375
  }
@@ -206321,7 +206508,7 @@ async function prepareChangelog(git, oldVersion, newVersion, changelogPolicy = "
206321
206508
  logger.debug(
206322
206509
  `Changelog policy is set to "${changelogPolicy}", nothing to do.`
206323
206510
  );
206324
- return;
206511
+ return void 0;
206325
206512
  }
206326
206513
  if (changelogPolicy !== "auto" /* Auto */ && changelogPolicy !== "simple" /* Simple */) {
206327
206514
  throw new ConfigurationError(
@@ -206335,12 +206522,12 @@ async function prepareChangelog(git, oldVersion, newVersion, changelogPolicy = "
206335
206522
  if (relativePath.startsWith(".")) {
206336
206523
  throw new ConfigurationError(`Invalid changelog path: "${changelogPath}"`);
206337
206524
  }
206338
- if (!(0, import_fs18.existsSync)(relativePath)) {
206525
+ if (!(0, import_fs19.existsSync)(relativePath)) {
206339
206526
  throw new ConfigurationError(
206340
206527
  `Changelog does not exist: "${changelogPath}"`
206341
206528
  );
206342
206529
  }
206343
- let changelogString = (await import_fs18.promises.readFile(relativePath)).toString();
206530
+ let changelogString = (await import_fs19.promises.readFile(relativePath)).toString();
206344
206531
  let changeset = findChangeset(
206345
206532
  changelogString,
206346
206533
  newVersion,
@@ -206369,7 +206556,7 @@ async function prepareChangelog(git, oldVersion, newVersion, changelogPolicy = "
206369
206556
  changelogString = prependChangeset(changelogString, changeset);
206370
206557
  }
206371
206558
  if (!isDryRun()) {
206372
- await import_fs18.promises.writeFile(relativePath, changelogString);
206559
+ await import_fs19.promises.writeFile(relativePath, changelogString);
206373
206560
  } else {
206374
206561
  logger.info("[dry-run] Not updating changelog file.");
206375
206562
  logger.trace(`New changelog:
@@ -206385,6 +206572,7 @@ ${changelogString}`);
206385
206572
  }
206386
206573
  logger.debug("Changelog entry found:", changeset.name);
206387
206574
  logger.trace(changeset.body);
206575
+ return changeset?.body;
206388
206576
  }
206389
206577
  async function switchToDefaultBranch(git, defaultBranch) {
206390
206578
  const repoStatus = await git.status();
@@ -206398,41 +206586,89 @@ async function switchToDefaultBranch(git, defaultBranch) {
206398
206586
  logger.info("[dry-run] Not switching branches.");
206399
206587
  }
206400
206588
  }
206401
- async function prepareMain(argv) {
206589
+ async function resolveVersion(git, options) {
206402
206590
  const config3 = getConfiguration();
206403
- const githubConfig = await getGlobalGitHubConfig();
206404
- let newVersion = argv.newVersion;
206405
- const git = await getGitClient();
206406
- const defaultBranch = await getDefaultBranch(git, argv.remote);
206407
- logger.debug(`Default branch for the repo:`, defaultBranch);
206408
- const repoStatus = await git.status();
206409
- const rev = argv.rev || repoStatus.current || defaultBranch;
206410
- if (argv.noGitChecks) {
206411
- logger.info("Not checking the status of the local repository");
206412
- } else {
206413
- 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;
206601
+ }
206602
+ if (version2 === "calver") {
206603
+ if (!requiresMinVersion(AUTO_VERSION_MIN_VERSION2)) {
206604
+ throw new ConfigurationError(
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
+ });
206414
206614
  }
206415
- const isVersionBumpType = isBumpType(newVersion);
206416
- if (newVersion === "auto" || isVersionBumpType) {
206417
- if (!requiresMinVersion(AUTO_VERSION_MIN_VERSION)) {
206418
- const featureName = isVersionBumpType ? "Version bump types" : "Auto-versioning";
206615
+ if (version2 === "auto" || isBumpType(version2)) {
206616
+ if (!requiresMinVersion(AUTO_VERSION_MIN_VERSION2)) {
206617
+ const featureName = isBumpType(version2) ? "Version bump types" : "Auto-versioning";
206419
206618
  throw new ConfigurationError(
206420
- `${featureName} requires minVersion >= ${AUTO_VERSION_MIN_VERSION} in .craft.yml. Please update your configuration or specify the version explicitly.`
206619
+ `${featureName} requires minVersion >= ${AUTO_VERSION_MIN_VERSION2} in .craft.yml. Please update your configuration or specify the version explicitly.`
206421
206620
  );
206422
206621
  }
206423
206622
  const latestTag = await getLatestTag(git);
206424
206623
  let bumpType;
206425
- if (newVersion === "auto") {
206624
+ if (version2 === "auto") {
206426
206625
  const changelogResult = await getChangelogWithBumpType(git, latestTag);
206427
206626
  validateBumpType(changelogResult);
206428
206627
  bumpType = changelogResult.bumpType;
206429
206628
  } else {
206430
- bumpType = newVersion;
206629
+ bumpType = version2;
206431
206630
  }
206432
206631
  const currentVersion = latestTag && latestTag.replace(/^v/, "").match(/^\d/) ? latestTag.replace(/^v/, "") : "0.0.0";
206433
- newVersion = calculateNextVersion(currentVersion, bumpType);
206434
- 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;
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);
206435
206666
  }
206667
+ const newVersion = await resolveVersion(git, {
206668
+ versionArg: argv.newVersion,
206669
+ calverOffset: argv.calverOffset
206670
+ });
206671
+ setGitHubActionsOutput("version", newVersion);
206436
206672
  logger.info(`Releasing version ${newVersion} from ${rev}`);
206437
206673
  if (!argv.rev && rev !== defaultBranch) {
206438
206674
  logger.warn("You're not on your default branch, so I have to ask...");
@@ -206449,7 +206685,7 @@ async function prepareMain(argv) {
206449
206685
  const oldVersion = await getLatestTag(git);
206450
206686
  const changelogPath = typeof config3.changelog === "string" ? config3.changelog : config3.changelog?.filePath;
206451
206687
  const changelogPolicy = typeof config3.changelog === "object" && config3.changelog?.policy ? config3.changelog.policy : config3.changelogPolicy;
206452
- await prepareChangelog(
206688
+ const changelogBody = await prepareChangelog(
206453
206689
  git,
206454
206690
  oldVersion,
206455
206691
  newVersion,
@@ -206467,6 +206703,13 @@ async function prepareMain(argv) {
206467
206703
  logger.debug("Not committing anything since preReleaseCommand is empty.");
206468
206704
  }
206469
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
+ }
206470
206713
  logger.info(
206471
206714
  `View diff at: https://github.com/${githubConfig.owner}/${githubConfig.repo}/compare/${branchName}`
206472
206715
  );
@@ -206559,7 +206802,7 @@ init_logger2();
206559
206802
  init_config2();
206560
206803
  init_errors2();
206561
206804
  var import_path18 = require("path");
206562
- var import_fs19 = require("fs");
206805
+ var import_fs20 = require("fs");
206563
206806
  init_none();
206564
206807
  var mkdirp = require_mkdirp();
206565
206808
  var command6 = ["download [NAME..]"];
@@ -206582,8 +206825,8 @@ var builder3 = (yargs) => yargs.positional("NAME", {
206582
206825
  async function prepareOutputDirectory(argv) {
206583
206826
  if (argv.directory) {
206584
206827
  const fullPath = (0, import_path18.resolve)(argv.directory);
206585
- if ((0, import_fs19.existsSync)(fullPath)) {
206586
- if ((0, import_fs19.lstatSync)(fullPath).isDirectory()) {
206828
+ if ((0, import_fs20.existsSync)(fullPath)) {
206829
+ if ((0, import_fs20.lstatSync)(fullPath).isDirectory()) {
206587
206830
  return fullPath;
206588
206831
  } else {
206589
206832
  throw new ConfigurationError(`Not a directory: ${fullPath}`);