firebase-tools
Version:
Command-Line Interface for Firebase
31 lines (30 loc) • 1.62 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.command = void 0;
const apphosting = require("../gcp/apphosting");
const command_1 = require("../command");
const projectUtils_1 = require("../projectUtils");
const error_1 = require("../error");
const rollout_1 = require("../apphosting/rollout");
const utils_1 = require("../utils");
exports.command = new command_1.Command("apphosting:rollouts:create <backendId>")
.description("create a rollout using a build for an App Hosting backend")
.option("-l, --location <location>", "specify the region of the backend")
.option("-b, --git-branch <gitBranch>", "repository branch to deploy (mutually exclusive with -g)")
.option("-g, --git-commit <gitCommit>", "git commit to deploy (mutually exclusive with -b)")
.withForce("Skip confirmation before creating rollout")
.before(apphosting.ensureApiEnabled)
.action(async (backendId, options) => {
var _a;
const projectId = (0, projectUtils_1.needProjectId)(options);
if (options.location !== undefined) {
(0, utils_1.logWarning)("--location is being removed in the next major release.");
}
const location = (_a = options.location) !== null && _a !== void 0 ? _a : "-";
const branch = options.gitBranch;
const commit = options.gitCommit;
if (branch && commit) {
throw new error_1.FirebaseError("Cannot specify both a branch and commit to deploy. Please specify either --git-branch or --git-commit.");
}
await (0, rollout_1.createRollout)(backendId, projectId, location, branch, commit, options.force);
});