From 9676e16a9c9b41011c974bdfffafcc4c1a4228ab Mon Sep 17 00:00:00 2001 From: "team-integrations-fnm[bot]" <107085870+team-integrations-fnm-bot@users.noreply.github.com> Date: Thu, 14 Dec 2023 14:26:36 +1000 Subject: [PATCH] chore(main): release 3.2.0 (#135) --- CHANGELOG.md | 7 + dist/index.js | 374 +++++++++++++++++++++++----------------------- package-lock.json | 4 +- package.json | 2 +- 4 files changed, 197 insertions(+), 190 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b39e1910..f825cc40 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [3.2.0](https://github.com/OctopusDeploy/push-build-information-action/compare/v3.1.0...v3.2.0) (2023-12-14) + + +### Features + +* Upgrade to node 20 ([#134](https://github.com/OctopusDeploy/push-build-information-action/issues/134)) ([fa6ab05](https://github.com/OctopusDeploy/push-build-information-action/commit/fa6ab05763b01d3224c6440fb0e42b9c03713495)) + ## [3.1.0](https://github.com/OctopusDeploy/push-build-information-action/compare/v3.0.3...v3.1.0) (2023-08-29) diff --git a/dist/index.js b/dist/index.js index b3dac908..585182b3 100644 --- a/dist/index.js +++ b/dist/index.js @@ -49093,95 +49093,95 @@ function wrappy (fn, cb) { /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; - -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -const core_1 = __nccwpck_require__(2186); -const github_1 = __nccwpck_require__(5438); -const inputs = __importStar(__nccwpck_require__(9519)); -const octopus = __importStar(__nccwpck_require__(3269)); -const api_client_1 = __nccwpck_require__(586); -const process_1 = __importDefault(__nccwpck_require__(7282)); -(() => __awaiter(void 0, void 0, void 0, function* () { - try { - const runId = github_1.context.runId; - if (runId === undefined) { - (0, core_1.setFailed)('GitHub run number is not defined'); - return; - } - const logger = { - debug: message => { - if ((0, core_1.isDebug)()) { - (0, core_1.debug)(message); - } - }, - info: message => (0, core_1.info)(message), - warn: message => (0, core_1.warning)(message), - error: (message, err) => { - if (err !== undefined) { - (0, core_1.error)(err.message); - } - else { - (0, core_1.error)(message); - } - } - }; - const inputParameters = inputs.get(parseInt(process_1.default.env['GITHUB_RUN_ATTEMPT'] || '0') > 1); - const config = { - userAgentApp: 'GitHubActions (build-information;push;v3)', - instanceURL: inputParameters.server, - apiKey: inputParameters.apiKey, - accessToken: inputParameters.accessToken, - logging: logger - }; - const client = yield api_client_1.Client.create(config); - if (client === undefined) - throw new Error('Client could not be constructed'); - yield octopus.pushBuildInformationFromInputs(client, runId, inputParameters); - } - catch (e) { - if (e instanceof Error) { - (0, core_1.setFailed)(e); - } - else { - (0, core_1.setFailed)(`Unknown error: ${e}`); - } - } -}))(); + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +const core_1 = __nccwpck_require__(2186); +const github_1 = __nccwpck_require__(5438); +const inputs = __importStar(__nccwpck_require__(9519)); +const octopus = __importStar(__nccwpck_require__(3269)); +const api_client_1 = __nccwpck_require__(586); +const process_1 = __importDefault(__nccwpck_require__(7282)); +(() => __awaiter(void 0, void 0, void 0, function* () { + try { + const runId = github_1.context.runId; + if (runId === undefined) { + (0, core_1.setFailed)('GitHub run number is not defined'); + return; + } + const logger = { + debug: message => { + if ((0, core_1.isDebug)()) { + (0, core_1.debug)(message); + } + }, + info: message => (0, core_1.info)(message), + warn: message => (0, core_1.warning)(message), + error: (message, err) => { + if (err !== undefined) { + (0, core_1.error)(err.message); + } + else { + (0, core_1.error)(message); + } + } + }; + const inputParameters = inputs.get(parseInt(process_1.default.env['GITHUB_RUN_ATTEMPT'] || '0') > 1); + const config = { + userAgentApp: 'GitHubActions (build-information;push;v3)', + instanceURL: inputParameters.server, + apiKey: inputParameters.apiKey, + accessToken: inputParameters.accessToken, + logging: logger + }; + const client = yield api_client_1.Client.create(config); + if (client === undefined) + throw new Error('Client could not be constructed'); + yield octopus.pushBuildInformationFromInputs(client, runId, inputParameters); + } + catch (e) { + if (e instanceof Error) { + (0, core_1.setFailed)(e); + } + else { + (0, core_1.setFailed)(`Unknown error: ${e}`); + } + } +}))(); /***/ }), @@ -49190,46 +49190,46 @@ const process_1 = __importDefault(__nccwpck_require__(7282)); /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; - -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.get = void 0; -const core_1 = __nccwpck_require__(2186); -const api_client_1 = __nccwpck_require__(586); -const EnvironmentVariables = { - URL: 'OCTOPUS_URL', - ApiKey: 'OCTOPUS_API_KEY', - AccessToken: 'OCTOPUS_ACCESS_TOKEN', - Space: 'OCTOPUS_SPACE' -}; -function get(isRetry) { - const overwriteMode = api_client_1.OverwriteMode[(0, core_1.getInput)('overwrite_mode')] || - (isRetry ? api_client_1.OverwriteMode.IgnoreIfExists : api_client_1.OverwriteMode.FailIfExists); - const parameters = { - server: (0, core_1.getInput)('server') || process.env[EnvironmentVariables.URL] || '', - apiKey: (0, core_1.getInput)('api_key') || process.env[EnvironmentVariables.ApiKey], - accessToken: process.env[EnvironmentVariables.AccessToken], - space: (0, core_1.getInput)('space') || process.env[EnvironmentVariables.Space] || '', - packages: (0, core_1.getMultilineInput)('packages', { required: true }), - version: (0, core_1.getInput)('version', { required: true }), - branch: (0, core_1.getInput)('branch') || undefined, - overwriteMode - }; - const errors = []; - if (!parameters.server) { - errors.push("The Octopus instance URL is required, please specify explicitly through the 'server' input or set the OCTOPUS_URL environment variable."); - } - if (!parameters.apiKey && !parameters.accessToken) { - errors.push("The Octopus API Key is required, please specify explicitly through the 'api_key' input or set the OCTOPUS_API_KEY environment variable."); - } - if (!parameters.space) { - errors.push("The Octopus space name is required, please specify explicitly through the 'space' input or set the OCTOPUS_SPACE environment variable."); - } - if (errors.length > 0) { - throw new Error(errors.join('\n')); - } - return parameters; -} -exports.get = get; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.get = void 0; +const core_1 = __nccwpck_require__(2186); +const api_client_1 = __nccwpck_require__(586); +const EnvironmentVariables = { + URL: 'OCTOPUS_URL', + ApiKey: 'OCTOPUS_API_KEY', + AccessToken: 'OCTOPUS_ACCESS_TOKEN', + Space: 'OCTOPUS_SPACE' +}; +function get(isRetry) { + const overwriteMode = api_client_1.OverwriteMode[(0, core_1.getInput)('overwrite_mode')] || + (isRetry ? api_client_1.OverwriteMode.IgnoreIfExists : api_client_1.OverwriteMode.FailIfExists); + const parameters = { + server: (0, core_1.getInput)('server') || process.env[EnvironmentVariables.URL] || '', + apiKey: (0, core_1.getInput)('api_key') || process.env[EnvironmentVariables.ApiKey], + accessToken: process.env[EnvironmentVariables.AccessToken], + space: (0, core_1.getInput)('space') || process.env[EnvironmentVariables.Space] || '', + packages: (0, core_1.getMultilineInput)('packages', { required: true }), + version: (0, core_1.getInput)('version', { required: true }), + branch: (0, core_1.getInput)('branch') || undefined, + overwriteMode + }; + const errors = []; + if (!parameters.server) { + errors.push("The Octopus instance URL is required, please specify explicitly through the 'server' input or set the OCTOPUS_URL environment variable."); + } + if (!parameters.apiKey && !parameters.accessToken) { + errors.push("The Octopus API Key is required, please specify explicitly through the 'api_key' input or set the OCTOPUS_API_KEY environment variable."); + } + if (!parameters.space) { + errors.push("The Octopus space name is required, please specify explicitly through the 'space' input or set the OCTOPUS_SPACE environment variable."); + } + if (errors.length > 0) { + throw new Error(errors.join('\n')); + } + return parameters; +} +exports.get = get; /***/ }), @@ -49238,64 +49238,64 @@ exports.get = get; /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; - -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.pushBuildInformationFromInputs = void 0; -const core_1 = __nccwpck_require__(2186); -const github_1 = __nccwpck_require__(5438); -const api_client_1 = __nccwpck_require__(586); -function pushBuildInformationFromInputs(client, runId, parameters) { - var _a; - return __awaiter(this, void 0, void 0, function* () { - let branch = parameters.branch || github_1.context.ref; - if (branch.startsWith('refs/heads/')) { - branch = branch.substring('refs/heads/'.length); - } - const repoUri = `${github_1.context.serverUrl}/${github_1.context.repo.owner}/${github_1.context.repo.repo}`; - const pushEvent = github_1.context.payload; - const commits = ((_a = pushEvent === null || pushEvent === void 0 ? void 0 : pushEvent.commits) === null || _a === void 0 ? void 0 : _a.map((commit) => { - return { - Id: commit.id, - Comment: commit.message - }; - })) || []; - const packages = []; - for (const packageId of parameters.packages) { - packages.push({ - Id: packageId, - Version: parameters.version - }); - } - const command = { - spaceName: parameters.space, - BuildEnvironment: 'GitHub Actions', - BuildNumber: github_1.context.runNumber.toString(), - BuildUrl: `${repoUri}/actions/runs/${runId}`, - Branch: branch, - VcsType: 'Git', - VcsRoot: `${repoUri}`, - VcsCommitNumber: github_1.context.sha, - Commits: commits, - Packages: packages - }; - if ((0, core_1.isDebug)()) { - client.info(`Build Information:\n${JSON.stringify(command, null, 2)}`); - } - const repository = new api_client_1.BuildInformationRepository(client, parameters.space); - yield repository.push(command, parameters.overwriteMode); - client.info('Successfully pushed build information to Octopus'); - }); -} -exports.pushBuildInformationFromInputs = pushBuildInformationFromInputs; + +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.pushBuildInformationFromInputs = void 0; +const core_1 = __nccwpck_require__(2186); +const github_1 = __nccwpck_require__(5438); +const api_client_1 = __nccwpck_require__(586); +function pushBuildInformationFromInputs(client, runId, parameters) { + var _a; + return __awaiter(this, void 0, void 0, function* () { + let branch = parameters.branch || github_1.context.ref; + if (branch.startsWith('refs/heads/')) { + branch = branch.substring('refs/heads/'.length); + } + const repoUri = `${github_1.context.serverUrl}/${github_1.context.repo.owner}/${github_1.context.repo.repo}`; + const pushEvent = github_1.context.payload; + const commits = ((_a = pushEvent === null || pushEvent === void 0 ? void 0 : pushEvent.commits) === null || _a === void 0 ? void 0 : _a.map((commit) => { + return { + Id: commit.id, + Comment: commit.message + }; + })) || []; + const packages = []; + for (const packageId of parameters.packages) { + packages.push({ + Id: packageId, + Version: parameters.version + }); + } + const command = { + spaceName: parameters.space, + BuildEnvironment: 'GitHub Actions', + BuildNumber: github_1.context.runNumber.toString(), + BuildUrl: `${repoUri}/actions/runs/${runId}`, + Branch: branch, + VcsType: 'Git', + VcsRoot: `${repoUri}`, + VcsCommitNumber: github_1.context.sha, + Commits: commits, + Packages: packages + }; + if ((0, core_1.isDebug)()) { + client.info(`Build Information:\n${JSON.stringify(command, null, 2)}`); + } + const repository = new api_client_1.BuildInformationRepository(client, parameters.space); + yield repository.push(command, parameters.overwriteMode); + client.info('Successfully pushed build information to Octopus'); + }); +} +exports.pushBuildInformationFromInputs = pushBuildInformationFromInputs; /***/ }), diff --git a/package-lock.json b/package-lock.json index 435527c7..f455b68e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "push-build-information-action", - "version": "3.1.0", + "version": "3.2.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "push-build-information-action", - "version": "3.1.0", + "version": "3.2.0", "license": "Apache-2.0", "dependencies": { "@actions/core": "^1.10.0", diff --git a/package.json b/package.json index 208afdb0..142454df 100644 --- a/package.json +++ b/package.json @@ -81,5 +81,5 @@ "postbuild": "ncc build out/index.js -o dist", "test": "jest --ci --reporters=default --reporters=jest-junit" }, - "version": "3.1.0" + "version": "3.2.0" }