diff --git a/dist/channel/index.js b/dist/channel/index.js index c53bc4a5..68961dfb 100644 --- a/dist/channel/index.js +++ b/dist/channel/index.js @@ -42604,29 +42604,6 @@ __exportStar(__nccwpck_require__(6366), exports); "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) { @@ -42638,20 +42615,23 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.Bundle = void 0; -const core = __importStar(__nccwpck_require__(2186)); -const exec = __importStar(__nccwpck_require__(1514)); +const core_1 = __nccwpck_require__(2186); +const exec_1 = __nccwpck_require__(1514); class Bundle { publish(path, channel) { return __awaiter(this, void 0, void 0, function* () { - core.exportVariable('CHARMCRAFT_AUTH', core.getInput('credentials')); + (0, core_1.exportVariable)('CHARMCRAFT_AUTH', (0, core_1.getInput)('credentials')); process.chdir(path); - yield exec.exec('juju-bundle', [ - 'publish', - '--destructive-mode', - '--serial', - '--release', - channel, - ]); + const result = yield (0, exec_1.getExecOutput)('charmcraft', ['pack']); + if (result.exitCode !== 0) { + throw new Error(`charmcraft pack ran unsuccessfully with exit code ${result.exitCode}.`); + } + const lastLine = result.stderr.trim().split('\n').pop(); + if (!lastLine) { + throw new Error('Failed to extract the bundle name from the output of charmcraft pack.'); + } + const bundleName = lastLine.split(' ')[1]; + yield (0, exec_1.exec)('charmcraft', ['upload', bundleName, '--release', channel]); }); } } diff --git a/dist/check-libraries/index.js b/dist/check-libraries/index.js index 7224aa8e..6260d262 100644 --- a/dist/check-libraries/index.js +++ b/dist/check-libraries/index.js @@ -42799,29 +42799,6 @@ __exportStar(__nccwpck_require__(6366), exports); "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) { @@ -42833,20 +42810,23 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.Bundle = void 0; -const core = __importStar(__nccwpck_require__(2186)); -const exec = __importStar(__nccwpck_require__(1514)); +const core_1 = __nccwpck_require__(2186); +const exec_1 = __nccwpck_require__(1514); class Bundle { publish(path, channel) { return __awaiter(this, void 0, void 0, function* () { - core.exportVariable('CHARMCRAFT_AUTH', core.getInput('credentials')); + (0, core_1.exportVariable)('CHARMCRAFT_AUTH', (0, core_1.getInput)('credentials')); process.chdir(path); - yield exec.exec('juju-bundle', [ - 'publish', - '--destructive-mode', - '--serial', - '--release', - channel, - ]); + const result = yield (0, exec_1.getExecOutput)('charmcraft', ['pack']); + if (result.exitCode !== 0) { + throw new Error(`charmcraft pack ran unsuccessfully with exit code ${result.exitCode}.`); + } + const lastLine = result.stderr.trim().split('\n').pop(); + if (!lastLine) { + throw new Error('Failed to extract the bundle name from the output of charmcraft pack.'); + } + const bundleName = lastLine.split(' ')[1]; + yield (0, exec_1.exec)('charmcraft', ['upload', bundleName, '--release', channel]); }); } } diff --git a/dist/promote-charm/index.js b/dist/promote-charm/index.js index 5d53442f..6aeb6b7a 100644 --- a/dist/promote-charm/index.js +++ b/dist/promote-charm/index.js @@ -42683,29 +42683,6 @@ __exportStar(__nccwpck_require__(6366), exports); "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) { @@ -42717,20 +42694,23 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.Bundle = void 0; -const core = __importStar(__nccwpck_require__(2186)); -const exec = __importStar(__nccwpck_require__(1514)); +const core_1 = __nccwpck_require__(2186); +const exec_1 = __nccwpck_require__(1514); class Bundle { publish(path, channel) { return __awaiter(this, void 0, void 0, function* () { - core.exportVariable('CHARMCRAFT_AUTH', core.getInput('credentials')); + (0, core_1.exportVariable)('CHARMCRAFT_AUTH', (0, core_1.getInput)('credentials')); process.chdir(path); - yield exec.exec('juju-bundle', [ - 'publish', - '--destructive-mode', - '--serial', - '--release', - channel, - ]); + const result = yield (0, exec_1.getExecOutput)('charmcraft', ['pack']); + if (result.exitCode !== 0) { + throw new Error(`charmcraft pack ran unsuccessfully with exit code ${result.exitCode}.`); + } + const lastLine = result.stderr.trim().split('\n').pop(); + if (!lastLine) { + throw new Error('Failed to extract the bundle name from the output of charmcraft pack.'); + } + const bundleName = lastLine.split(' ')[1]; + yield (0, exec_1.exec)('charmcraft', ['upload', bundleName, '--release', channel]); }); } } diff --git a/dist/release-charm/index.js b/dist/release-charm/index.js index 862a9606..9ada5a20 100644 --- a/dist/release-charm/index.js +++ b/dist/release-charm/index.js @@ -42695,29 +42695,6 @@ __exportStar(__nccwpck_require__(6366), exports); "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) { @@ -42729,20 +42706,23 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.Bundle = void 0; -const core = __importStar(__nccwpck_require__(2186)); -const exec = __importStar(__nccwpck_require__(1514)); +const core_1 = __nccwpck_require__(2186); +const exec_1 = __nccwpck_require__(1514); class Bundle { publish(path, channel) { return __awaiter(this, void 0, void 0, function* () { - core.exportVariable('CHARMCRAFT_AUTH', core.getInput('credentials')); + (0, core_1.exportVariable)('CHARMCRAFT_AUTH', (0, core_1.getInput)('credentials')); process.chdir(path); - yield exec.exec('juju-bundle', [ - 'publish', - '--destructive-mode', - '--serial', - '--release', - channel, - ]); + const result = yield (0, exec_1.getExecOutput)('charmcraft', ['pack']); + if (result.exitCode !== 0) { + throw new Error(`charmcraft pack ran unsuccessfully with exit code ${result.exitCode}.`); + } + const lastLine = result.stderr.trim().split('\n').pop(); + if (!lastLine) { + throw new Error('Failed to extract the bundle name from the output of charmcraft pack.'); + } + const bundleName = lastLine.split(' ')[1]; + yield (0, exec_1.exec)('charmcraft', ['upload', bundleName, '--release', channel]); }); } } diff --git a/dist/release-libraries/index.js b/dist/release-libraries/index.js index 0706e75b..51ef9e85 100644 --- a/dist/release-libraries/index.js +++ b/dist/release-libraries/index.js @@ -42826,29 +42826,6 @@ __exportStar(__nccwpck_require__(6366), exports); "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) { @@ -42860,20 +42837,23 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.Bundle = void 0; -const core = __importStar(__nccwpck_require__(2186)); -const exec = __importStar(__nccwpck_require__(1514)); +const core_1 = __nccwpck_require__(2186); +const exec_1 = __nccwpck_require__(1514); class Bundle { publish(path, channel) { return __awaiter(this, void 0, void 0, function* () { - core.exportVariable('CHARMCRAFT_AUTH', core.getInput('credentials')); + (0, core_1.exportVariable)('CHARMCRAFT_AUTH', (0, core_1.getInput)('credentials')); process.chdir(path); - yield exec.exec('juju-bundle', [ - 'publish', - '--destructive-mode', - '--serial', - '--release', - channel, - ]); + const result = yield (0, exec_1.getExecOutput)('charmcraft', ['pack']); + if (result.exitCode !== 0) { + throw new Error(`charmcraft pack ran unsuccessfully with exit code ${result.exitCode}.`); + } + const lastLine = result.stderr.trim().split('\n').pop(); + if (!lastLine) { + throw new Error('Failed to extract the bundle name from the output of charmcraft pack.'); + } + const bundleName = lastLine.split(' ')[1]; + yield (0, exec_1.exec)('charmcraft', ['upload', bundleName, '--release', channel]); }); } } diff --git a/dist/upload-bundle/index.js b/dist/upload-bundle/index.js index ffaa1385..973a0215 100644 --- a/dist/upload-bundle/index.js +++ b/dist/upload-bundle/index.js @@ -42674,29 +42674,6 @@ __exportStar(__nccwpck_require__(6366), exports); "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) { @@ -42708,20 +42685,23 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.Bundle = void 0; -const core = __importStar(__nccwpck_require__(2186)); -const exec = __importStar(__nccwpck_require__(1514)); +const core_1 = __nccwpck_require__(2186); +const exec_1 = __nccwpck_require__(1514); class Bundle { publish(path, channel) { return __awaiter(this, void 0, void 0, function* () { - core.exportVariable('CHARMCRAFT_AUTH', core.getInput('credentials')); + (0, core_1.exportVariable)('CHARMCRAFT_AUTH', (0, core_1.getInput)('credentials')); process.chdir(path); - yield exec.exec('juju-bundle', [ - 'publish', - '--destructive-mode', - '--serial', - '--release', - channel, - ]); + const result = yield (0, exec_1.getExecOutput)('charmcraft', ['pack']); + if (result.exitCode !== 0) { + throw new Error(`charmcraft pack ran unsuccessfully with exit code ${result.exitCode}.`); + } + const lastLine = result.stderr.trim().split('\n').pop(); + if (!lastLine) { + throw new Error('Failed to extract the bundle name from the output of charmcraft pack.'); + } + const bundleName = lastLine.split(' ')[1]; + yield (0, exec_1.exec)('charmcraft', ['upload', bundleName, '--release', channel]); }); } } diff --git a/dist/upload-charm/index.js b/dist/upload-charm/index.js index 5d46b191..39d86170 100644 --- a/dist/upload-charm/index.js +++ b/dist/upload-charm/index.js @@ -42714,29 +42714,6 @@ __exportStar(__nccwpck_require__(6366), exports); "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) { @@ -42748,20 +42725,23 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.Bundle = void 0; -const core = __importStar(__nccwpck_require__(2186)); -const exec = __importStar(__nccwpck_require__(1514)); +const core_1 = __nccwpck_require__(2186); +const exec_1 = __nccwpck_require__(1514); class Bundle { publish(path, channel) { return __awaiter(this, void 0, void 0, function* () { - core.exportVariable('CHARMCRAFT_AUTH', core.getInput('credentials')); + (0, core_1.exportVariable)('CHARMCRAFT_AUTH', (0, core_1.getInput)('credentials')); process.chdir(path); - yield exec.exec('juju-bundle', [ - 'publish', - '--destructive-mode', - '--serial', - '--release', - channel, - ]); + const result = yield (0, exec_1.getExecOutput)('charmcraft', ['pack']); + if (result.exitCode !== 0) { + throw new Error(`charmcraft pack ran unsuccessfully with exit code ${result.exitCode}.`); + } + const lastLine = result.stderr.trim().split('\n').pop(); + if (!lastLine) { + throw new Error('Failed to extract the bundle name from the output of charmcraft pack.'); + } + const bundleName = lastLine.split(' ')[1]; + yield (0, exec_1.exec)('charmcraft', ['upload', bundleName, '--release', channel]); }); } } diff --git a/src/services/bundle/bundle.ts b/src/services/bundle/bundle.ts index 5dcb0141..a3225d6c 100644 --- a/src/services/bundle/bundle.ts +++ b/src/services/bundle/bundle.ts @@ -1,17 +1,25 @@ -import * as core from '@actions/core'; -import * as exec from '@actions/exec'; +import { exportVariable, getInput } from '@actions/core'; +import { exec, getExecOutput } from '@actions/exec'; class Bundle { async publish(path: string, channel: string) { - core.exportVariable('CHARMCRAFT_AUTH', core.getInput('credentials')); + exportVariable('CHARMCRAFT_AUTH', getInput('credentials')); process.chdir(path); - await exec.exec('juju-bundle', [ - 'publish', - '--destructive-mode', - '--serial', - '--release', - channel, - ]); + + const result = await getExecOutput('charmcraft', ['pack']); + if (result.exitCode !== 0) { + throw new Error( + `charmcraft pack ran unsuccessfully with exit code ${result.exitCode}.`, + ); + } + const lastLine = result.stderr.trim().split('\n').pop(); + if (!lastLine) { + throw new Error( + 'Failed to extract the bundle name from the output of charmcraft pack.', + ); + } + const bundleName = lastLine.split(' ')[1]; + await exec('charmcraft', ['upload', bundleName, '--release', channel]); } }