|
1 | 1 | /** |
2 | | - * universal-version-bump v0.10.1 |
| 2 | + * universal-version-bump v0.10.3 |
3 | 3 | * Universal Version Bump |
4 | 4 | * |
5 | 5 | * Description: A GitHub Action to automatically bump versions across any app (Node, Python, PHP, Docker, etc.) |
6 | 6 | |
7 | 7 | * Homepage: https://github.com/taj54/universal-version-bump#readme |
8 | 8 | * License: MIT |
9 | | - * Generated on Wed, 27 Aug 2025 10:24:47 GMT |
| 9 | + * Generated on Fri, 29 Aug 2025 12:57:13 GMT |
10 | 10 | */ |
11 | 11 | require('./sourcemap-register.js');/******/ (() => { // webpackBootstrap |
12 | 12 | /******/ var __webpack_modules__ = ({ |
@@ -32667,12 +32667,13 @@ var __importStar = (this && this.__importStar) || (function () { |
32667 | 32667 | }; |
32668 | 32668 | })(); |
32669 | 32669 | Object.defineProperty(exports, "__esModule", ({ value: true })); |
32670 | | -exports.TARGET_PATH = exports.GIT_TAG = exports.TARGET_PLATFORM = exports.RELEASE_TYPE = void 0; |
| 32670 | +exports.BUMP_TARGETS = exports.TARGET_PATH = exports.GIT_TAG = exports.TARGET_PLATFORM = exports.RELEASE_TYPE = void 0; |
32671 | 32671 | const core = __importStar(__nccwpck_require__(9999)); |
32672 | 32672 | exports.RELEASE_TYPE = (core.getInput('release_type') || 'patch'); |
32673 | 32673 | exports.TARGET_PLATFORM = core.getInput('target_platform'); |
32674 | 32674 | exports.GIT_TAG = core.getInput('git_tag') === 'true'; |
32675 | 32675 | exports.TARGET_PATH = core.getInput('target_path') || '.'; |
| 32676 | +exports.BUMP_TARGETS = JSON.parse(core.getInput('bump_targets') || '[]'); |
32676 | 32677 |
|
32677 | 32678 |
|
32678 | 32679 | /***/ }), |
@@ -32801,7 +32802,8 @@ async function run() { |
32801 | 32802 | const { updaterService, gitService, changelogService } = await initializeServices(); |
32802 | 32803 | const platform = updaterService.getPlatform(targetPlatform); |
32803 | 32804 | core.info(`Detected platform: ${platform}`); |
32804 | | - const version = updaterService.updateVersion(platform, releaseType); |
| 32805 | + const bumpTargets = JSON.parse(config_1.BUMP_TARGETS); |
| 32806 | + const version = updaterService.updateVersion(platform, releaseType, bumpTargets); |
32805 | 32807 | core.setOutput('new_version', version); |
32806 | 32808 | // Generate and update changelog |
32807 | 32809 | const latestTag = await gitService.getLatestTag(); |
@@ -33266,6 +33268,7 @@ __exportStar(__nccwpck_require__(5417), exports); |
33266 | 33268 | Object.defineProperty(exports, "__esModule", ({ value: true })); |
33267 | 33269 | exports.UpdaterService = void 0; |
33268 | 33270 | const errors_1 = __nccwpck_require__(4830); |
| 33271 | +const customUpdater_1 = __nccwpck_require__(5432); |
33269 | 33272 | /** |
33270 | 33273 | * Service for managing version updates. |
33271 | 33274 | */ |
@@ -33302,17 +33305,124 @@ class UpdaterService { |
33302 | 33305 | * @param releaseType The type of release (major, minor, patch). |
33303 | 33306 | * @returns The new version string. |
33304 | 33307 | */ |
33305 | | - updateVersion(platform, releaseType) { |
33306 | | - const updater = this.updaterRegistry.getUpdater(platform); |
33307 | | - if (!updater) { |
33308 | | - throw new errors_1.VersionBumpError(`No updater found for platform: ${platform}`); |
| 33308 | + updateVersion(platform, releaseType, bumpTargets = []) { |
| 33309 | + if (platform === 'custom') { |
| 33310 | + if (bumpTargets.length === 0) { |
| 33311 | + throw new errors_1.VersionBumpError('No bump_targets provided for custom platform.'); |
| 33312 | + } |
| 33313 | + let lastBumpedVersion = ''; |
| 33314 | + for (const target of bumpTargets) { |
| 33315 | + const customUpdater = new customUpdater_1.CustomUpdater(target.path, target.variable); |
| 33316 | + lastBumpedVersion = customUpdater.bumpVersion(releaseType); |
| 33317 | + } |
| 33318 | + return lastBumpedVersion; |
| 33319 | + } |
| 33320 | + else { |
| 33321 | + const updater = this.updaterRegistry.getUpdater(platform); |
| 33322 | + if (!updater) { |
| 33323 | + throw new errors_1.VersionBumpError(`No updater found for platform: ${platform}`); |
| 33324 | + } |
| 33325 | + return updater.bumpVersion(releaseType); |
33309 | 33326 | } |
33310 | | - return updater.bumpVersion(releaseType); |
33311 | 33327 | } |
33312 | 33328 | } |
33313 | 33329 | exports.UpdaterService = UpdaterService; |
33314 | 33330 |
|
33315 | 33331 |
|
| 33332 | +/***/ }), |
| 33333 | + |
| 33334 | +/***/ 5432: |
| 33335 | +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { |
| 33336 | + |
| 33337 | +"use strict"; |
| 33338 | + |
| 33339 | +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { |
| 33340 | + if (k2 === undefined) k2 = k; |
| 33341 | + var desc = Object.getOwnPropertyDescriptor(m, k); |
| 33342 | + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { |
| 33343 | + desc = { enumerable: true, get: function() { return m[k]; } }; |
| 33344 | + } |
| 33345 | + Object.defineProperty(o, k2, desc); |
| 33346 | +}) : (function(o, m, k, k2) { |
| 33347 | + if (k2 === undefined) k2 = k; |
| 33348 | + o[k2] = m[k]; |
| 33349 | +})); |
| 33350 | +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { |
| 33351 | + Object.defineProperty(o, "default", { enumerable: true, value: v }); |
| 33352 | +}) : function(o, v) { |
| 33353 | + o["default"] = v; |
| 33354 | +}); |
| 33355 | +var __importStar = (this && this.__importStar) || (function () { |
| 33356 | + var ownKeys = function(o) { |
| 33357 | + ownKeys = Object.getOwnPropertyNames || function (o) { |
| 33358 | + var ar = []; |
| 33359 | + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; |
| 33360 | + return ar; |
| 33361 | + }; |
| 33362 | + return ownKeys(o); |
| 33363 | + }; |
| 33364 | + return function (mod) { |
| 33365 | + if (mod && mod.__esModule) return mod; |
| 33366 | + var result = {}; |
| 33367 | + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); |
| 33368 | + __setModuleDefault(result, mod); |
| 33369 | + return result; |
| 33370 | + }; |
| 33371 | +})(); |
| 33372 | +Object.defineProperty(exports, "__esModule", ({ value: true })); |
| 33373 | +exports.CustomUpdater = void 0; |
| 33374 | +const core = __importStar(__nccwpck_require__(9999)); |
| 33375 | +const versionUtil_1 = __nccwpck_require__(2431); |
| 33376 | +const fileHandler_1 = __nccwpck_require__(1013); |
| 33377 | +const manifestParser_1 = __nccwpck_require__(2521); |
| 33378 | +class CustomUpdater { |
| 33379 | + constructor(filePath, variableName) { |
| 33380 | + this.platform = 'custom'; |
| 33381 | + this.currentVersion = null; |
| 33382 | + this.filePath = filePath; |
| 33383 | + this.variableName = variableName; |
| 33384 | + this.fileHandler = new fileHandler_1.FileHandler(); |
| 33385 | + this.manifestParser = new manifestParser_1.ManifestParser(this.fileHandler); |
| 33386 | + } |
| 33387 | + canHandle() { |
| 33388 | + // This updater is explicitly called, so it can always handle if constructed. |
| 33389 | + return true; |
| 33390 | + } |
| 33391 | + getCurrentVersion() { |
| 33392 | + if (this.currentVersion) { |
| 33393 | + return this.currentVersion; |
| 33394 | + } |
| 33395 | + try { |
| 33396 | + // eslint-disable-next-line no-useless-escape |
| 33397 | + const regex = new RegExp(`(${this.variableName}\s*=\s*['"]?)([\\d.]+)(['"]?)`); |
| 33398 | + this.currentVersion = this.manifestParser.getVersion(this.filePath, 'regex', { |
| 33399 | + regex: regex, |
| 33400 | + }); |
| 33401 | + return this.currentVersion; |
| 33402 | + } |
| 33403 | + catch (error) { |
| 33404 | + core.debug(`Could not read or parse version from ${this.filePath}: ${error}`); |
| 33405 | + } |
| 33406 | + return null; |
| 33407 | + } |
| 33408 | + bumpVersion(releaseType) { |
| 33409 | + const oldVersion = this.getCurrentVersion(); |
| 33410 | + if (!oldVersion) { |
| 33411 | + throw new Error(`Could not find current version for variable '${this.variableName}' in file '${this.filePath}'`); |
| 33412 | + } |
| 33413 | + const newVersion = (0, versionUtil_1.calculateNextVersion)(oldVersion, releaseType); |
| 33414 | + // eslint-disable-next-line no-useless-escape |
| 33415 | + const regexReplace = new RegExp(`(${this.variableName}\s*=\s*['"]?)${oldVersion}(['"]?)`); |
| 33416 | + this.manifestParser.updateVersion(this.filePath, newVersion, 'regex', { |
| 33417 | + regexReplace: regexReplace, |
| 33418 | + }); |
| 33419 | + core.info(`Bumped ${this.variableName} in ${this.filePath} from ${oldVersion} to ${newVersion}`); |
| 33420 | + return newVersion; |
| 33421 | + } |
| 33422 | +} |
| 33423 | +exports.CustomUpdater = CustomUpdater; |
| 33424 | + |
| 33425 | + |
33316 | 33426 | /***/ }), |
33317 | 33427 |
|
33318 | 33428 | /***/ 553: |
|
0 commit comments