Skip to content

Commit

Permalink
fix(upload-bundle): Implement the same functionality without using `j…
Browse files Browse the repository at this point in the history
…uju-bundle` (#151)

* Update upload-bundle action

* Update upload-bundle action

* Update upload-bundle action

* Update upload-bundle action

* Update upload-bundle action

* Update if-else blocks to be more legible

* Update bundle.ts to use inverted conditionals
  • Loading branch information
mvlassis authored Aug 29, 2024
1 parent 46fe0c6 commit 9341933
Show file tree
Hide file tree
Showing 8 changed files with 109 additions and 241 deletions.
46 changes: 13 additions & 33 deletions dist/channel/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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]);
});
}
}
Expand Down
46 changes: 13 additions & 33 deletions dist/check-libraries/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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]);
});
}
}
Expand Down
46 changes: 13 additions & 33 deletions dist/promote-charm/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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]);
});
}
}
Expand Down
46 changes: 13 additions & 33 deletions dist/release-charm/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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]);
});
}
}
Expand Down
46 changes: 13 additions & 33 deletions dist/release-libraries/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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]);
});
}
}
Expand Down
46 changes: 13 additions & 33 deletions dist/upload-bundle/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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]);
});
}
}
Expand Down
Loading

0 comments on commit 9341933

Please sign in to comment.