GSI - Employe Self Service Mobile
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
2.0 KiB

2 months ago
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.release = void 0;
  4. const api = require("../../hosting/api");
  5. const logger_1 = require("../../logger");
  6. const utils = require("../../utils");
  7. const convertConfig_1 = require("./convertConfig");
  8. const error_1 = require("../../error");
  9. async function release(context, options, functionsPayload) {
  10. if (!context.hosting || !context.hosting.deploys) {
  11. return;
  12. }
  13. logger_1.logger.debug(JSON.stringify(context.hosting.deploys, null, 2));
  14. await Promise.all(context.hosting.deploys.map(async (deploy) => {
  15. if (!deploy.version) {
  16. throw new error_1.FirebaseError("Assertion failed: Hosting version should have been set in the prepare phase", { exit: 2 });
  17. }
  18. utils.logLabeledBullet(`hosting[${deploy.config.site}]`, "finalizing version...");
  19. const update = {
  20. status: "FINALIZED",
  21. config: await (0, convertConfig_1.convertConfig)(context, functionsPayload, deploy),
  22. };
  23. const versionId = utils.last(deploy.version.split("/"));
  24. const finalizedVersion = await api.updateVersion(deploy.config.site, versionId, update);
  25. logger_1.logger.debug(`[hosting] finalized version for ${deploy.config.site}:${finalizedVersion}`);
  26. utils.logLabeledSuccess(`hosting[${deploy.config.site}]`, "version finalized");
  27. utils.logLabeledBullet(`hosting[${deploy.config.site}]`, "releasing new version...");
  28. if (context.hostingChannel) {
  29. logger_1.logger.debug("[hosting] releasing to channel:", context.hostingChannel);
  30. }
  31. const otherReleaseOpts = {};
  32. if (options.message) {
  33. otherReleaseOpts.message = options.message;
  34. }
  35. const release = await api.createRelease(deploy.config.site, context.hostingChannel || "live", deploy.version, otherReleaseOpts);
  36. logger_1.logger.debug("[hosting] release:", release);
  37. utils.logLabeledSuccess(`hosting[${deploy.config.site}]`, "release complete");
  38. }));
  39. }
  40. exports.release = release;