diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 39558bc70..30d498d3f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,7 +17,7 @@ jobs: - name: 'Validate build' run: | - npm install + npm ci npm run build - name: 'Run L0 tests' diff --git a/.github/workflows/github_actions_test.yml b/.github/workflows/github_actions_test.yml index 1a4ce06da..5b1261622 100644 --- a/.github/workflows/github_actions_test.yml +++ b/.github/workflows/github_actions_test.yml @@ -82,10 +82,10 @@ jobs: with: node-version: '18.x' - - name: npm install, build, and test + - name: npm ci, build, and test run: | cd nodeapp - npm install + npm ci npm run build --if-present npm run test --if-present diff --git a/.github/workflows/pr_check_webapp_dotnet_windows.yml b/.github/workflows/pr_check_webapp_dotnet_windows.yml index 81cf8c238..8dc2715b8 100644 --- a/.github/workflows/pr_check_webapp_dotnet_windows.yml +++ b/.github/workflows/pr_check_webapp_dotnet_windows.yml @@ -71,11 +71,8 @@ jobs: - name: Installing dependencies and building latest changes run: | cd webapps-deploy - if (-NOT(TEST-PATH node_modules)) - { - npm install - npm run build - } + npm ci + npm run package - name: Azure authentication uses: azure/login@v2 diff --git a/.github/workflows/pr_check_windows_container_pubprofile.yml b/.github/workflows/pr_check_windows_container_pubprofile.yml index 759cd4703..86913c013 100644 --- a/.github/workflows/pr_check_windows_container_pubprofile.yml +++ b/.github/workflows/pr_check_windows_container_pubprofile.yml @@ -92,11 +92,8 @@ jobs: - name: Installing dependencies and building latest changes in action run: | cd webapps-deploy - if (-NOT(TEST-PATH node_modules)) - { - npm install - npm run build - } + npm ci + npm run package - name: 'Deploy to Azure WebApp' uses: ./webapps-deploy/ diff --git a/.gitignore b/.gitignore index 3e759b75b..308479e33 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,10 @@ ## ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore +# Bundled output (built during release) +dist/ +lib/ + # User-specific files *.suo *.user diff --git a/README.md b/README.md index 148bfaa19..c234200bb 100644 --- a/README.md +++ b/README.md @@ -82,9 +82,9 @@ jobs: uses: actions/setup-node@v1 with: node-version: '10.x' - - name: 'npm install, build, and test' + - name: 'npm ci, build, and test' run: | - npm install + npm ci npm run build --if-present npm run test --if-present diff --git a/action.yml b/action.yml index d21392e56..3a7c4cc91 100644 --- a/action.yml +++ b/action.yml @@ -52,4 +52,4 @@ branding: color: 'blue' runs: using: 'node20' - main: 'lib/main.js' + main: 'dist/index.js' diff --git a/lib/ActionInputValidator/ActionValidators/IValidator.js b/lib/ActionInputValidator/ActionValidators/IValidator.js deleted file mode 100644 index c8ad2e549..000000000 --- a/lib/ActionInputValidator/ActionValidators/IValidator.js +++ /dev/null @@ -1,2 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/lib/ActionInputValidator/ActionValidators/PublishProfileContainerWebAppValidator.js b/lib/ActionInputValidator/ActionValidators/PublishProfileContainerWebAppValidator.js deleted file mode 100644 index 3b9213c69..000000000 --- a/lib/ActionInputValidator/ActionValidators/PublishProfileContainerWebAppValidator.js +++ /dev/null @@ -1,28 +0,0 @@ -"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.PublishProfileContainerWebAppValidator = void 0; -const Validations_1 = require("../Validations"); -const actionparameters_1 = require("../../actionparameters"); -class PublishProfileContainerWebAppValidator { - validate() { - return __awaiter(this, void 0, void 0, function* () { - const actionParams = actionparameters_1.ActionParameters.getActionParams(); - (0, Validations_1.packageNotAllowed)(actionParams.packageInput); - (0, Validations_1.multiContainerNotAllowed)(actionParams.multiContainerConfigFile); - (0, Validations_1.startupCommandNotAllowed)(actionParams.startupCommand); - (0, Validations_1.siteContainersConfigNotAllowed)(actionParams.siteContainers); - (0, Validations_1.validateAppDetails)(); - (0, Validations_1.validateSingleContainerInputs)(); - }); - } -} -exports.PublishProfileContainerWebAppValidator = PublishProfileContainerWebAppValidator; diff --git a/lib/ActionInputValidator/ActionValidators/PublishProfileWebAppSiteContainersValidator.js b/lib/ActionInputValidator/ActionValidators/PublishProfileWebAppSiteContainersValidator.js deleted file mode 100644 index ff511bddd..000000000 --- a/lib/ActionInputValidator/ActionValidators/PublishProfileWebAppSiteContainersValidator.js +++ /dev/null @@ -1,20 +0,0 @@ -"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.PublishProfileWebAppSiteContainersValidator = void 0; -class PublishProfileWebAppSiteContainersValidator { - validate() { - return __awaiter(this, void 0, void 0, function* () { - throw new Error("publish-profile is not supported for Site Containers scenario"); - }); - } -} -exports.PublishProfileWebAppSiteContainersValidator = PublishProfileWebAppSiteContainersValidator; diff --git a/lib/ActionInputValidator/ActionValidators/PublishProfileWebAppValidator.js b/lib/ActionInputValidator/ActionValidators/PublishProfileWebAppValidator.js deleted file mode 100644 index 37531c529..000000000 --- a/lib/ActionInputValidator/ActionValidators/PublishProfileWebAppValidator.js +++ /dev/null @@ -1,27 +0,0 @@ -"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.PublishProfileWebAppValidator = void 0; -const Validations_1 = require("../Validations"); -const actionparameters_1 = require("../../actionparameters"); -class PublishProfileWebAppValidator { - validate() { - return __awaiter(this, void 0, void 0, function* () { - let actionParams = actionparameters_1.ActionParameters.getActionParams(); - (0, Validations_1.containerInputsNotAllowed)(actionParams.images, actionParams.multiContainerConfigFile, true); - (0, Validations_1.validateAppDetails)(); - (0, Validations_1.startupCommandNotAllowed)(actionParams.startupCommand); - (0, Validations_1.siteContainersConfigNotAllowed)(actionParams.siteContainers); - yield (0, Validations_1.validatePackageInput)(); - }); - } -} -exports.PublishProfileWebAppValidator = PublishProfileWebAppValidator; diff --git a/lib/ActionInputValidator/ActionValidators/SpnLinuxContainerWebAppValidator.js b/lib/ActionInputValidator/ActionValidators/SpnLinuxContainerWebAppValidator.js deleted file mode 100644 index b908cd3fd..000000000 --- a/lib/ActionInputValidator/ActionValidators/SpnLinuxContainerWebAppValidator.js +++ /dev/null @@ -1,13 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.SpnLinuxContainerWebAppValidator = void 0; -const Validations_1 = require("../Validations"); -const actionparameters_1 = require("../../actionparameters"); -class SpnLinuxContainerWebAppValidator { - validate() { - let actionParams = actionparameters_1.ActionParameters.getActionParams(); - (0, Validations_1.packageNotAllowed)(actionParams.packageInput); - (0, Validations_1.validateContainerInputs)(); - } -} -exports.SpnLinuxContainerWebAppValidator = SpnLinuxContainerWebAppValidator; diff --git a/lib/ActionInputValidator/ActionValidators/SpnLinuxWebAppValidator.js b/lib/ActionInputValidator/ActionValidators/SpnLinuxWebAppValidator.js deleted file mode 100644 index 579c7c342..000000000 --- a/lib/ActionInputValidator/ActionValidators/SpnLinuxWebAppValidator.js +++ /dev/null @@ -1,24 +0,0 @@ -"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.SpnLinuxWebAppValidator = void 0; -const Validations_1 = require("../Validations"); -const actionparameters_1 = require("../../actionparameters"); -class SpnLinuxWebAppValidator { - validate() { - return __awaiter(this, void 0, void 0, function* () { - let actionParams = actionparameters_1.ActionParameters.getActionParams(); - (0, Validations_1.containerInputsNotAllowed)(actionParams.images, actionParams.multiContainerConfigFile); - yield (0, Validations_1.validatePackageInput)(); - }); - } -} -exports.SpnLinuxWebAppValidator = SpnLinuxWebAppValidator; diff --git a/lib/ActionInputValidator/ActionValidators/SpnWebAppSiteContainersValidator.js b/lib/ActionInputValidator/ActionValidators/SpnWebAppSiteContainersValidator.js deleted file mode 100644 index 639e16254..000000000 --- a/lib/ActionInputValidator/ActionValidators/SpnWebAppSiteContainersValidator.js +++ /dev/null @@ -1,30 +0,0 @@ -"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.SpnWebAppSiteContainersValidator = void 0; -const Validations_1 = require("../Validations"); -const SpnLinuxWebAppValidator_1 = require("./SpnLinuxWebAppValidator"); -const actionparameters_1 = require("../../actionparameters"); -class SpnWebAppSiteContainersValidator extends SpnLinuxWebAppValidator_1.SpnLinuxWebAppValidator { - validate() { - const _super = Object.create(null, { - validate: { get: () => super.validate } - }); - return __awaiter(this, void 0, void 0, function* () { - let actionParams = actionparameters_1.ActionParameters.getActionParams(); - if (!!actionParams.blessedAppSitecontainers) { - yield _super.validate.call(this); - } - (0, Validations_1.validateSiteContainersInputs)(); - }); - } -} -exports.SpnWebAppSiteContainersValidator = SpnWebAppSiteContainersValidator; diff --git a/lib/ActionInputValidator/ActionValidators/SpnWindowsContainerWebAppValidator.js b/lib/ActionInputValidator/ActionValidators/SpnWindowsContainerWebAppValidator.js deleted file mode 100644 index d78561736..000000000 --- a/lib/ActionInputValidator/ActionValidators/SpnWindowsContainerWebAppValidator.js +++ /dev/null @@ -1,15 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.SpnWindowsContainerWebAppValidator = void 0; -const Validations_1 = require("../Validations"); -const actionparameters_1 = require("../../actionparameters"); -class SpnWindowsContainerWebAppValidator { - validate() { - let actionParams = actionparameters_1.ActionParameters.getActionParams(); - (0, Validations_1.packageNotAllowed)(actionParams.packageInput); - (0, Validations_1.startupCommandNotAllowed)(actionParams.startupCommand); - (0, Validations_1.multiContainerNotAllowed)(actionParams.multiContainerConfigFile); - (0, Validations_1.validateContainerInputs)(); - } -} -exports.SpnWindowsContainerWebAppValidator = SpnWindowsContainerWebAppValidator; diff --git a/lib/ActionInputValidator/ActionValidators/SpnWindowsWebAppValidator.js b/lib/ActionInputValidator/ActionValidators/SpnWindowsWebAppValidator.js deleted file mode 100644 index e2fed43d3..000000000 --- a/lib/ActionInputValidator/ActionValidators/SpnWindowsWebAppValidator.js +++ /dev/null @@ -1,25 +0,0 @@ -"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.SpnWindowsWebAppValidator = void 0; -const Validations_1 = require("../Validations"); -const actionparameters_1 = require("../../actionparameters"); -class SpnWindowsWebAppValidator { - validate() { - return __awaiter(this, void 0, void 0, function* () { - let actionParams = actionparameters_1.ActionParameters.getActionParams(); - (0, Validations_1.containerInputsNotAllowed)(actionParams.images, actionParams.multiContainerConfigFile); - (0, Validations_1.startupCommandNotAllowed)(actionParams.startupCommand); - yield (0, Validations_1.validatePackageInput)(); - }); - } -} -exports.SpnWindowsWebAppValidator = SpnWindowsWebAppValidator; diff --git a/lib/ActionInputValidator/Validations.js b/lib/ActionInputValidator/Validations.js deleted file mode 100644 index 6cc546713..000000000 --- a/lib/ActionInputValidator/Validations.js +++ /dev/null @@ -1,163 +0,0 @@ -"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 () { - var ownKeys = function(o) { - ownKeys = Object.getOwnPropertyNames || function (o) { - var ar = []; - for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; - return ar; - }; - return ownKeys(o); - }; - return function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); - __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()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.appNameIsRequired = appNameIsRequired; -exports.containerInputsNotAllowed = containerInputsNotAllowed; -exports.validateAppDetails = validateAppDetails; -exports.startupCommandNotAllowed = startupCommandNotAllowed; -exports.packageNotAllowed = packageNotAllowed; -exports.multiContainerNotAllowed = multiContainerNotAllowed; -exports.validateSingleContainerInputs = validateSingleContainerInputs; -exports.validateContainerInputs = validateContainerInputs; -exports.validatePackageInput = validatePackageInput; -exports.siteContainersConfigNotAllowed = siteContainersConfigNotAllowed; -exports.validateSiteContainersInputs = validateSiteContainersInputs; -const core = __importStar(require("@actions/core")); -const packageUtility_1 = require("azure-actions-utility/packageUtility"); -const PublishProfile_1 = require("../Utilities/PublishProfile"); -const actionparameters_1 = require("../actionparameters"); -const fs = require("fs"); -// Error is app-name is not provided -function appNameIsRequired(appname) { - if (!appname) { - throw new Error("app-name is a required input."); - } -} -// Error if image info is provided -function containerInputsNotAllowed(images, configFile, isPublishProfile = false) { - if (!!images || !!configFile) { - throw new Error(`This is not a container web app. Please remove inputs like images and configuration-file which are only relevant for container deployment.`); - } -} -// Cross-validate provided app name and slot is same as that in publish profile -function validateAppDetails() { - let actionParams = actionparameters_1.ActionParameters.getActionParams(); - if (!!actionParams.appName || (!!actionParams.slotName && actionParams.slotName.toLowerCase() !== 'production')) { - let creds = PublishProfile_1.PublishProfile.getPublishProfile(actionParams.publishProfileContent).creds; - //for kubeapps in publishsettings file username doesn't start with $, for all other apps it starts with $ - let splitUsername = creds.username.startsWith("$") ? creds.username.toUpperCase().substring(1).split("__") : creds.username.toUpperCase().split("__"); - let appNameMatch = !actionParams.appName || actionParams.appName.toUpperCase() === splitUsername[0]; - let slotNameMatch = actionParams.slotName.toLowerCase() === 'production' || actionParams.slotName.toUpperCase() === splitUsername[1]; - if (!appNameMatch || !slotNameMatch) { - throw new Error("Publish profile is invalid for app-name and slot-name provided. Provide correct publish profile credentials for app."); - } - } -} -// Error is startup command is provided -function startupCommandNotAllowed(startupCommand) { - if (!!startupCommand) { - throw new Error("startup-command is not a valid input for Windows web app or with publish-profile auth scheme."); - } -} -// Error if package input is provided -function packageNotAllowed(apppackage) { - if (!!apppackage && apppackage !== '.') { - throw new Error("package is not a valid input for container web app."); - } -} -// Error if multi container config file is provided -function multiContainerNotAllowed(configFile) { - if (!!configFile) { - throw new Error("Multi container support is not available for windows containerized web app or with publish profile."); - } -} -// Error if image name is not provided -function validateSingleContainerInputs() { - const actionParams = actionparameters_1.ActionParameters.getActionParams(); - if (!actionParams.images) { - throw new Error("Image name not provided for container. Provide a valid image name"); - } -} -// Validate container inputs -function validateContainerInputs() { - let actionParams = actionparameters_1.ActionParameters.getActionParams(); - actionParams.isMultiContainer = false; - if (!!actionParams.multiContainerConfigFile && (0, packageUtility_1.exist)(actionParams.multiContainerConfigFile)) { - let stats = fs.statSync(actionParams.multiContainerConfigFile); - if (!stats.isFile()) { - throw new Error("Docker-compose file path is incorrect."); - } - else { - actionParams.isMultiContainer = true; - core.debug("Is multi-container app"); - } - if (!!actionParams.images) { - console.log("Multi-container deployment with the transformation of Docker-Compose file."); - } - else { - console.log("Multi-container deployment without transformation of Docker-Compose file."); - } - } - else if (!actionParams.images) { - throw new Error("For single-container, just specify a valid image name. For multi-container specifying a Docker-Compose file is mandatory and specifying image names is optional. Provide image names if the tags in Docker-Compose file need to be substituted."); - } - else if (actionParams.images.split("\n").length > 1) { - throw new Error("Multiple images indicate multi-container deployment type, but Docker-compose file is absent."); - } -} -// validate package input -function validatePackageInput() { - return __awaiter(this, void 0, void 0, function* () { - let actionParams = actionparameters_1.ActionParameters.getActionParams(); - actionParams.package = new packageUtility_1.Package(actionParams.packageInput); - // msbuild package deployment is not supported - let isMSBuildPackage = yield actionParams.package.isMSBuildPackage(); - if (isMSBuildPackage) { - throw new Error(`Deployment of msBuild generated package is not supported. Please change package format.`); - } - }); -} -// Error if Sitecontainers configuration is provided -function siteContainersConfigNotAllowed(siteContainers) { - if (!!siteContainers) { - throw new Error("SiteContainers not valid input for this web app."); - } -} -// validate Sitecontainers inputs -function validateSiteContainersInputs() { - const actionParams = actionparameters_1.ActionParameters.getActionParams(); - if (!actionParams.siteContainers || actionParams.siteContainers.length === 0) { - throw new Error("Site containers not provided."); - } -} diff --git a/lib/ActionInputValidator/ValidatorFactory.js b/lib/ActionInputValidator/ValidatorFactory.js deleted file mode 100644 index 593b1d6d1..000000000 --- a/lib/ActionInputValidator/ValidatorFactory.js +++ /dev/null @@ -1,148 +0,0 @@ -"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 () { - var ownKeys = function(o) { - ownKeys = Object.getOwnPropertyNames || function (o) { - var ar = []; - for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; - return ar; - }; - return ownKeys(o); - }; - return function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); - __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 }); -exports.ValidatorFactory = void 0; -const core = __importStar(require("@actions/core")); -const actionparameters_1 = require("../actionparameters"); -const AzureResourceFilterUtility_1 = require("azure-actions-appservice-rest/Utilities/AzureResourceFilterUtility"); -const BaseWebAppDeploymentProvider_1 = require("../DeploymentProvider/Providers/BaseWebAppDeploymentProvider"); -const PublishProfileWebAppValidator_1 = require("./ActionValidators/PublishProfileWebAppValidator"); -const PublishProfileContainerWebAppValidator_1 = require("./ActionValidators/PublishProfileContainerWebAppValidator"); -const SpnLinuxContainerWebAppValidator_1 = require("./ActionValidators/SpnLinuxContainerWebAppValidator"); -const SpnLinuxWebAppValidator_1 = require("./ActionValidators/SpnLinuxWebAppValidator"); -const SpnWindowsContainerWebAppValidator_1 = require("./ActionValidators/SpnWindowsContainerWebAppValidator"); -const SpnWindowsWebAppValidator_1 = require("./ActionValidators/SpnWindowsWebAppValidator"); -const Validations_1 = require("./Validations"); -const PublishProfile_1 = require("../Utilities/PublishProfile"); -const RuntimeConstants_1 = __importDefault(require("../RuntimeConstants")); -const SpnWebAppSiteContainersValidator_1 = require("./ActionValidators/SpnWebAppSiteContainersValidator"); -const PublishProfileWebAppSiteContainersValidator_1 = require("./ActionValidators/PublishProfileWebAppSiteContainersValidator"); -const azure_app_service_1 = require("azure-actions-appservice-rest/Arm/azure-app-service"); -class ValidatorFactory { - static getValidator(type) { - return __awaiter(this, void 0, void 0, function* () { - let actionParams = actionparameters_1.ActionParameters.getActionParams(); - if (type === BaseWebAppDeploymentProvider_1.DEPLOYMENT_PROVIDER_TYPES.PUBLISHPROFILE) { - if (!!actionParams.blessedAppSitecontainers || !!actionParams.siteContainers) { - return new PublishProfileWebAppSiteContainersValidator_1.PublishProfileWebAppSiteContainersValidator(); - } - else if (!!actionParams.images) { - yield this.setResourceDetails(actionParams); - return new PublishProfileContainerWebAppValidator_1.PublishProfileContainerWebAppValidator(); - } - else { - try { - yield this.setResourceDetails(actionParams); - } - catch (error) { - core.warning(`Failed to set resource details: ${error.message}`); - } - return new PublishProfileWebAppValidator_1.PublishProfileWebAppValidator(); - } - } - else if (type == BaseWebAppDeploymentProvider_1.DEPLOYMENT_PROVIDER_TYPES.SPN) { - // app-name is required to get resource details - (0, Validations_1.appNameIsRequired)(actionParams.appName); - yield this.getResourceDetails(actionParams); - if (!!actionParams.isLinux) { - if (!!actionParams.siteContainers) { - yield this.setBlessedSitecontainerApp(actionParams); - return new SpnWebAppSiteContainersValidator_1.SpnWebAppSiteContainersValidator(); - } - else if (!!actionParams.images || !!actionParams.multiContainerConfigFile) { - return new SpnLinuxContainerWebAppValidator_1.SpnLinuxContainerWebAppValidator(); - } - else { - return new SpnLinuxWebAppValidator_1.SpnLinuxWebAppValidator(); - } - } - else { - if (!!actionParams.images) { - return new SpnWindowsContainerWebAppValidator_1.SpnWindowsContainerWebAppValidator(); - } - else { - return new SpnWindowsWebAppValidator_1.SpnWindowsWebAppValidator(); - } - } - } - else { - throw new Error("Valid credentials are not available. Add Azure Login action before this action or provide publish-profile input."); - } - }); - } - static getResourceDetails(params) { - return __awaiter(this, void 0, void 0, function* () { - let appDetails = yield AzureResourceFilterUtility_1.AzureResourceFilterUtility.getAppDetails(params.endpoint, params.appName, params.resourceGroupName, params.slotName); - params.resourceGroupName = appDetails["resourceGroupName"]; - params.realKind = appDetails["kind"]; - params.kind = actionparameters_1.appKindMap.get(params.realKind); - //app kind linux and kubeapp is supported only on linux environment currently - params.isLinux = params.realKind.indexOf("linux") > -1 || params.realKind.indexOf("kubeapp") > -1; - }); - } - static setResourceDetails(actionParams) { - return __awaiter(this, void 0, void 0, function* () { - const publishProfile = PublishProfile_1.PublishProfile.getPublishProfile(actionParams.publishProfileContent); - const appOS = yield publishProfile.getAppOS(); - actionParams.isLinux = appOS.includes(RuntimeConstants_1.default.Unix) || appOS.includes(RuntimeConstants_1.default.Unix.toLowerCase()); - }); - } - static setBlessedSitecontainerApp(actionParams) { - return __awaiter(this, void 0, void 0, function* () { - var _a; - const appService = new azure_app_service_1.AzureAppService(actionParams.endpoint, actionParams.resourceGroupName, actionParams.appName, actionParams.slotName); - let config = yield appService.getConfiguration(); - core.debug(`LinuxFxVersion of app is: ${config.properties.linuxFxVersion}`); - const linuxFxVersion = ((_a = config.properties.linuxFxVersion) === null || _a === void 0 ? void 0 : _a.toUpperCase()) || ""; - actionParams.blessedAppSitecontainers = (!linuxFxVersion.startsWith("DOCKER|") - && !linuxFxVersion.startsWith("COMPOSE|") - && linuxFxVersion !== "SITECONTAINERS"); - core.debug(`Is blessed app sitecontainers: ${actionParams.blessedAppSitecontainers}`); - }); - } -} -exports.ValidatorFactory = ValidatorFactory; diff --git a/lib/DeploymentProvider/DeploymentProviderFactory.js b/lib/DeploymentProvider/DeploymentProviderFactory.js deleted file mode 100644 index a0684a0f9..000000000 --- a/lib/DeploymentProvider/DeploymentProviderFactory.js +++ /dev/null @@ -1,36 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.DeploymentProviderFactory = void 0; -const actionparameters_1 = require("../actionparameters"); -const BaseWebAppDeploymentProvider_1 = require("./Providers/BaseWebAppDeploymentProvider"); -const WebAppContainerDeployment_1 = require("./Providers/WebAppContainerDeployment"); -const WebAppDeploymentProvider_1 = require("./Providers/WebAppDeploymentProvider"); -const PublishProfileWebAppContainerDeploymentProvider_1 = require("./Providers/PublishProfileWebAppContainerDeploymentProvider"); -const WebAppSiteContainersDeploymentProvider_1 = require("./Providers/WebAppSiteContainersDeploymentProvider"); -class DeploymentProviderFactory { - static getDeploymentProvider(type) { - if (type === BaseWebAppDeploymentProvider_1.DEPLOYMENT_PROVIDER_TYPES.PUBLISHPROFILE) { - if (!!actionparameters_1.ActionParameters.getActionParams().images) { - return new PublishProfileWebAppContainerDeploymentProvider_1.PublishProfileWebAppContainerDeploymentProvider(type); - } - else { - return new WebAppDeploymentProvider_1.WebAppDeploymentProvider(type); - } - } - else if (type == BaseWebAppDeploymentProvider_1.DEPLOYMENT_PROVIDER_TYPES.SPN) { - if (!!actionparameters_1.ActionParameters.getActionParams().blessedAppSitecontainers || !!actionparameters_1.ActionParameters.getActionParams().siteContainers) { - return new WebAppSiteContainersDeploymentProvider_1.WebAppSiteContainersDeploymentProvider(type); - } - else if (!!actionparameters_1.ActionParameters.getActionParams().images || (!!actionparameters_1.ActionParameters.getActionParams().isLinux && !!actionparameters_1.ActionParameters.getActionParams().multiContainerConfigFile)) { - return new WebAppContainerDeployment_1.WebAppContainerDeploymentProvider(type); - } - else { - return new WebAppDeploymentProvider_1.WebAppDeploymentProvider(type); - } - } - else { - throw new Error("Invalid deployment provider type."); - } - } -} -exports.DeploymentProviderFactory = DeploymentProviderFactory; diff --git a/lib/DeploymentProvider/Providers/BaseWebAppDeploymentProvider.js b/lib/DeploymentProvider/Providers/BaseWebAppDeploymentProvider.js deleted file mode 100644 index 5a6c8f914..000000000 --- a/lib/DeploymentProvider/Providers/BaseWebAppDeploymentProvider.js +++ /dev/null @@ -1,129 +0,0 @@ -"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 () { - var ownKeys = function(o) { - ownKeys = Object.getOwnPropertyNames || function (o) { - var ar = []; - for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; - return ar; - }; - return ownKeys(o); - }; - return function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); - __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()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.DEPLOYMENT_PROVIDER_TYPES = exports.BaseWebAppDeploymentProvider = void 0; -const core = __importStar(require("@actions/core")); -const PublishProfile_1 = require("../../Utilities/PublishProfile"); -const actionparameters_1 = require("../../actionparameters"); -const azure_app_service_1 = require("azure-actions-appservice-rest/Arm/azure-app-service"); -const AzureAppServiceUtility_1 = require("azure-actions-appservice-rest/Utilities/AzureAppServiceUtility"); -const KuduServiceUtility_1 = require("azure-actions-appservice-rest/Utilities/KuduServiceUtility"); -const AnnotationUtility_1 = require("azure-actions-appservice-rest/Utilities/AnnotationUtility"); -class BaseWebAppDeploymentProvider { - constructor(type) { - this.authType = type; - this.actionParams = actionparameters_1.ActionParameters.getActionParams(); - } - PreDeploymentStep() { - return __awaiter(this, void 0, void 0, function* () { - switch (this.authType) { - case DEPLOYMENT_PROVIDER_TYPES.SPN: - yield this.initializeForSPN(); - break; - case DEPLOYMENT_PROVIDER_TYPES.PUBLISHPROFILE: - yield this.initializeForPublishProfile(); - break; - default: - throw new Error("Invalid deployment provider type"); - } - }); - } - UpdateDeploymentStatus(isDeploymentSuccess) { - return __awaiter(this, void 0, void 0, function* () { - if (!!this.appService) { - yield (0, AnnotationUtility_1.addAnnotation)(this.actionParams.endpoint, this.appService, isDeploymentSuccess); - } - this.activeDeploymentID = yield this.kuduServiceUtility.updateDeploymentStatus(isDeploymentSuccess, null, { 'type': 'Deployment', slotName: this.actionParams.slotName }); - core.debug('Active DeploymentId :' + this.activeDeploymentID); - if (!!isDeploymentSuccess && !!this.deploymentID && !!this.activeDeploymentID) { - yield this.kuduServiceUtility.postZipDeployOperation(this.deploymentID, this.activeDeploymentID); - } - console.log('App Service Application URL: ' + this.applicationURL); - core.setOutput('webapp-url', this.applicationURL); - }); - } - initializeForSPN() { - return __awaiter(this, void 0, void 0, function* () { - this.appService = new azure_app_service_1.AzureAppService(this.actionParams.endpoint, this.actionParams.resourceGroupName, this.actionParams.appName, this.actionParams.slotName); - this.appServiceUtility = new AzureAppServiceUtility_1.AzureAppServiceUtility(this.appService); - const warmupInstanceId = yield this.getWarmupInstanceId(); - core.debug(`Warmup Instance Id: ${warmupInstanceId}`); - this.kuduService = yield this.appServiceUtility.getKuduService(warmupInstanceId); - this.kuduServiceUtility = new KuduServiceUtility_1.KuduServiceUtility(this.kuduService); - this.applicationURL = yield this.appServiceUtility.getApplicationURL(); - }); - } - initializeForPublishProfile() { - return __awaiter(this, void 0, void 0, function* () { - const publishProfile = PublishProfile_1.PublishProfile.getPublishProfile(this.actionParams.publishProfileContent); - this.kuduService = publishProfile.kuduService; - this.kuduServiceUtility = new KuduServiceUtility_1.KuduServiceUtility(this.kuduService); - this.applicationURL = publishProfile.appUrl; - }); - } - // Get the warmup instance id. - getWarmupInstanceId() { - return __awaiter(this, void 0, void 0, function* () { - var _a; - try { - const instances = yield this.appServiceUtility.getAppserviceInstances(); - if (((_a = instances === null || instances === void 0 ? void 0 : instances.value) === null || _a === void 0 ? void 0 : _a.length) > 0) { - // Sort by name and pick the first one. - const sortedInstances = instances.value.sort((a, b) => a.name.localeCompare(b.name)); - return sortedInstances[0].name; - } - } - catch (error) { - core.debug(`Failed to get app service instances - ${error}`); - } - return undefined; - }); - } -} -exports.BaseWebAppDeploymentProvider = BaseWebAppDeploymentProvider; -var DEPLOYMENT_PROVIDER_TYPES; -(function (DEPLOYMENT_PROVIDER_TYPES) { - DEPLOYMENT_PROVIDER_TYPES[DEPLOYMENT_PROVIDER_TYPES["SPN"] = 0] = "SPN"; - DEPLOYMENT_PROVIDER_TYPES[DEPLOYMENT_PROVIDER_TYPES["PUBLISHPROFILE"] = 1] = "PUBLISHPROFILE"; -})(DEPLOYMENT_PROVIDER_TYPES || (exports.DEPLOYMENT_PROVIDER_TYPES = DEPLOYMENT_PROVIDER_TYPES = {})); diff --git a/lib/DeploymentProvider/Providers/IWebAppDeploymentProvider.js b/lib/DeploymentProvider/Providers/IWebAppDeploymentProvider.js deleted file mode 100644 index c8ad2e549..000000000 --- a/lib/DeploymentProvider/Providers/IWebAppDeploymentProvider.js +++ /dev/null @@ -1,2 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/lib/DeploymentProvider/Providers/PublishProfileWebAppContainerDeploymentProvider.js b/lib/DeploymentProvider/Providers/PublishProfileWebAppContainerDeploymentProvider.js deleted file mode 100644 index f185359c1..000000000 --- a/lib/DeploymentProvider/Providers/PublishProfileWebAppContainerDeploymentProvider.js +++ /dev/null @@ -1,24 +0,0 @@ -"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.PublishProfileWebAppContainerDeploymentProvider = void 0; -const BaseWebAppDeploymentProvider_1 = require("./BaseWebAppDeploymentProvider"); -class PublishProfileWebAppContainerDeploymentProvider extends BaseWebAppDeploymentProvider_1.BaseWebAppDeploymentProvider { - DeployWebAppStep() { - return __awaiter(this, void 0, void 0, function* () { - const appName = this.actionParams.appName; - const images = this.actionParams.images; - const isLinux = this.actionParams.isLinux; - yield this.kuduServiceUtility.deployWebAppImage(appName, images, isLinux); - }); - } -} -exports.PublishProfileWebAppContainerDeploymentProvider = PublishProfileWebAppContainerDeploymentProvider; diff --git a/lib/DeploymentProvider/Providers/WebAppContainerDeployment.js b/lib/DeploymentProvider/Providers/WebAppContainerDeployment.js deleted file mode 100644 index 7b9a54f5d..000000000 --- a/lib/DeploymentProvider/Providers/WebAppContainerDeployment.js +++ /dev/null @@ -1,28 +0,0 @@ -"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.WebAppContainerDeploymentProvider = void 0; -const BaseWebAppDeploymentProvider_1 = require("./BaseWebAppDeploymentProvider"); -const ContainerDeploymentUtility_1 = require("azure-actions-appservice-rest/Utilities/ContainerDeploymentUtility"); -class WebAppContainerDeploymentProvider extends BaseWebAppDeploymentProvider_1.BaseWebAppDeploymentProvider { - DeployWebAppStep() { - return __awaiter(this, void 0, void 0, function* () { - let containerDeploymentUtility = new ContainerDeploymentUtility_1.ContainerDeploymentUtility(this.appService); - let images = this.actionParams.images; - let configFile = this.actionParams.multiContainerConfigFile; - let isLinux = this.actionParams.isLinux; - let isMultiContainer = this.actionParams.isMultiContainer; - let startupCommand = this.actionParams.startupCommand; - yield containerDeploymentUtility.deployWebAppImage(images, configFile, isLinux, isMultiContainer, startupCommand); - }); - } -} -exports.WebAppContainerDeploymentProvider = WebAppContainerDeploymentProvider; diff --git a/lib/DeploymentProvider/Providers/WebAppDeploymentProvider.js b/lib/DeploymentProvider/Providers/WebAppDeploymentProvider.js deleted file mode 100644 index a21424496..000000000 --- a/lib/DeploymentProvider/Providers/WebAppDeploymentProvider.js +++ /dev/null @@ -1,151 +0,0 @@ -"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 () { - var ownKeys = function(o) { - ownKeys = Object.getOwnPropertyNames || function (o) { - var ar = []; - for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; - return ar; - }; - return ownKeys(o); - }; - return function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); - __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 }); -exports.WebAppDeploymentProvider = void 0; -const core = __importStar(require("@actions/core")); -const utility = __importStar(require("azure-actions-utility/utility.js")); -const zipUtility = __importStar(require("azure-actions-utility/ziputility.js")); -const packageUtility_1 = require("azure-actions-utility/packageUtility"); -const BaseWebAppDeploymentProvider_1 = require("./BaseWebAppDeploymentProvider"); -const AnnotationUtility_1 = require("azure-actions-appservice-rest/Utilities/AnnotationUtility"); -const fs_1 = __importDefault(require("fs")); -const path_1 = __importDefault(require("path")); -class WebAppDeploymentProvider extends BaseWebAppDeploymentProvider_1.BaseWebAppDeploymentProvider { - DeployWebAppStep() { - return __awaiter(this, void 0, void 0, function* () { - let appPackage = this.actionParams.package; - let webPackage = appPackage.getPath(); - const validTypes = ["war", "jar", "ear", "zip", "static"]; - // kudu warm up - yield this.kuduServiceUtility.warmUp(); - // If provided, type paramater takes precidence over file package type - if (this.actionParams.type != null && validTypes.includes(this.actionParams.type.toLowerCase())) { - core.debug("Initiated deployment via kudu service for webapp" + this.actionParams.type + "package : " + webPackage); - } - else { - // Retains the old behavior of determining the package type from the file extension if valid type is not defined - let packageType = appPackage.getPackageType(); - switch (packageType) { - case packageUtility_1.PackageType.war: - core.debug("Initiated deployment via kudu service for webapp war package : " + webPackage); - this.actionParams.type = "war"; - break; - case packageUtility_1.PackageType.jar: - core.debug("Initiated deployment via kudu service for webapp jar package : " + webPackage); - this.actionParams.type = "jar"; - break; - case packageUtility_1.PackageType.folder: - let tempPackagePath = utility.generateTemporaryFolderOrZipPath(`${process.env.RUNNER_TEMP}`, false); - // Excluding release.zip while creating zip for deployment if it's a Linux app - yield this.deleteReleaseZipForLinuxApps(webPackage); - webPackage = (yield zipUtility.archiveFolder(webPackage, "", tempPackagePath)); - core.debug("Compressed folder into zip " + webPackage); - core.debug("Initiated deployment via kudu service for webapp package : " + webPackage); - this.actionParams.type = "zip"; - break; - case packageUtility_1.PackageType.zip: - core.debug("Initiated deployment via kudu service for webapp zip package : " + webPackage); - this.actionParams.type = "zip"; - break; - default: - throw new Error('Invalid App Service package: ' + webPackage + ' or type provided: ' + this.actionParams.type); - } - } - this.deploymentID = yield this.kuduServiceUtility.deployUsingOneDeploy(webPackage, { slotName: this.actionParams.slotName, commitMessage: this.actionParams.commitMessage }, this.actionParams.targetPath, this.actionParams.type, this.actionParams.clean, this.actionParams.restart); - // updating startup command - if (!!this.actionParams.startupCommand) { - yield this.updateStartupCommand(); - } - }); - } - updateStartupCommand() { - return __awaiter(this, void 0, void 0, function* () { - let currentConfig = yield this.appService.getConfiguration(); - let currentStartupCommand = currentConfig.properties.appCommandLine; - let newStartupCommand = this.actionParams.startupCommand; - if (currentStartupCommand != newStartupCommand) { - yield this.appServiceUtility.updateConfigurationSettings({ appCommandLine: newStartupCommand }); - } - else { - core.debug(`Skipped updating appCommandLine. Current value is: ${currentStartupCommand}`); - } - }); - } - UpdateDeploymentStatus(isDeploymentSuccess) { - return __awaiter(this, void 0, void 0, function* () { - if (!!this.appService) { - yield (0, AnnotationUtility_1.addAnnotation)(this.actionParams.endpoint, this.appService, isDeploymentSuccess); - } - console.log('App Service Application URL: ' + this.applicationURL); - core.setOutput('webapp-url', this.applicationURL); - }); - } - deleteReleaseZipForLinuxApps(webPackage) { - return __awaiter(this, void 0, void 0, function* () { - // If the app is not a Linux app, skip the deletion of release.zip - if (!this.actionParams.isLinux) { - core.debug(`It's not a Linux app, skipping deletion of release.zip`); - return; - } - const releaseZipPath = path_1.default.join(webPackage, 'release.zip'); - // Check if release.zip exists - if (!fs_1.default.existsSync(releaseZipPath)) { - core.debug(`release.zip does not exist, skipping deletion: ${releaseZipPath}`); - return; - } - // Delete release.zip if it exists - try { - yield fs_1.default.promises.unlink(releaseZipPath); - core.debug(`Deleted release.zip`); - } - catch (error) { - core.debug(`Error while deleting release.zip for Linux app: ${error}`); - } - }); - } -} -exports.WebAppDeploymentProvider = WebAppDeploymentProvider; diff --git a/lib/DeploymentProvider/Providers/WebAppSiteContainersDeploymentProvider.js b/lib/DeploymentProvider/Providers/WebAppSiteContainersDeploymentProvider.js deleted file mode 100644 index cf41c4cae..000000000 --- a/lib/DeploymentProvider/Providers/WebAppSiteContainersDeploymentProvider.js +++ /dev/null @@ -1,70 +0,0 @@ -"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 () { - var ownKeys = function(o) { - ownKeys = Object.getOwnPropertyNames || function (o) { - var ar = []; - for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; - return ar; - }; - return ownKeys(o); - }; - return function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); - __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()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.WebAppSiteContainersDeploymentProvider = void 0; -const SiteContainerDeploymentUtility_1 = require("azure-actions-appservice-rest/Utilities/SiteContainerDeploymentUtility"); -const core = __importStar(require("@actions/core")); -const WebAppDeploymentProvider_1 = require("./WebAppDeploymentProvider"); -class WebAppSiteContainersDeploymentProvider extends WebAppDeploymentProvider_1.WebAppDeploymentProvider { - DeployWebAppStep() { - const _super = Object.create(null, { - DeployWebAppStep: { get: () => super.DeployWebAppStep } - }); - return __awaiter(this, void 0, void 0, function* () { - if (!!this.actionParams.blessedAppSitecontainers) { - core.info("Blessed site containers detected, using WebAppDeploymentProvider for deployment."); - yield _super.DeployWebAppStep.call(this); - } - let siteContainerDeploymentUtility = new SiteContainerDeploymentUtility_1.SiteContainerDeploymentUtility(this.appService); - let siteContainers = this.actionParams.siteContainers; - core.info("Updating site containers"); - for (let i = 0; i < siteContainers.length; i++) { - let siteContainer = siteContainers[i]; - core.info("updating site container: " + siteContainer.getName()); - yield siteContainerDeploymentUtility.updateSiteContainer(siteContainer); - } - }); - } -} -exports.WebAppSiteContainersDeploymentProvider = WebAppSiteContainersDeploymentProvider; diff --git a/lib/RuntimeConstants.js b/lib/RuntimeConstants.js deleted file mode 100644 index a4efb9a79..000000000 --- a/lib/RuntimeConstants.js +++ /dev/null @@ -1,9 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -class RuntimeConstants { -} -RuntimeConstants.system = "system"; -RuntimeConstants.osName = "os_name"; -RuntimeConstants.Windows = "Windows"; -RuntimeConstants.Unix = "Unix"; -exports.default = RuntimeConstants; diff --git a/lib/Utilities/PublishProfile.js b/lib/Utilities/PublishProfile.js deleted file mode 100644 index e8a787ae3..000000000 --- a/lib/Utilities/PublishProfile.js +++ /dev/null @@ -1,72 +0,0 @@ -"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()); - }); -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.PublishProfile = void 0; -var core = require("@actions/core"); -const actions_secret_parser_1 = require("actions-secret-parser"); -const azure_app_kudu_service_1 = require("azure-actions-appservice-rest/Kudu/azure-app-kudu-service"); -const RuntimeConstants_1 = __importDefault(require("../RuntimeConstants")); -class PublishProfile { - constructor(publishProfileContent) { - try { - let secrets = new actions_secret_parser_1.SecretParser(publishProfileContent, actions_secret_parser_1.FormatType.XML); - this._creds = { - uri: secrets.getSecret("//publishProfile/@publishUrl", false), - username: secrets.getSecret("//publishProfile/@userName", true), - password: secrets.getSecret("//publishProfile/@userPWD", true) - }; - this._appUrl = secrets.getSecret("//publishProfile/@destinationAppUrl", false); - if (this._creds.uri.indexOf("scm") < 0) { - throw new Error("Publish profile does not contain kudu URL"); - } - this._creds.uri = `https://${this._creds.uri}`; - this._kuduService = new azure_app_kudu_service_1.Kudu(this._creds.uri, { username: this._creds.username, password: this._creds.password }); - } - catch (error) { - core.error("Failed to fetch credentials from Publish Profile. For more details on how to set publish profile credentials refer https://aka.ms/create-secrets-for-GitHub-workflows"); - throw error; - } - } - static getPublishProfile(publishProfileContent) { - if (!this._publishProfile) { - this._publishProfile = new PublishProfile(publishProfileContent); - } - return this._publishProfile; - } - get creds() { - return this._creds; - } - get appUrl() { - return this._appUrl; - } - get kuduService() { - return this._kuduService; - } - getAppOS() { - return __awaiter(this, void 0, void 0, function* () { - try { - if (!this._appOS) { - const appRuntimeDetails = yield this._kuduService.getAppRuntime(); - this._appOS = appRuntimeDetails[RuntimeConstants_1.default.system][RuntimeConstants_1.default.osName]; - core.debug(`App Runtime OS: ${this._appOS}`); - } - } - catch (error) { - throw Error("Failed to get app runtime OS\n" + JSON.stringify(error)); - } - return this._appOS; - }); - } -} -exports.PublishProfile = PublishProfile; diff --git a/lib/actionparameters.js b/lib/actionparameters.js deleted file mode 100644 index 97e957e90..000000000 --- a/lib/actionparameters.js +++ /dev/null @@ -1,186 +0,0 @@ -"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 () { - var ownKeys = function(o) { - ownKeys = Object.getOwnPropertyNames || function (o) { - var ar = []; - for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; - return ar; - }; - return ownKeys(o); - }; - return function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); - __setModuleDefault(result, mod); - return result; - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ActionParameters = exports.appKindMap = exports.WebAppKind = void 0; -const core = __importStar(require("@actions/core")); -const SiteContainer_1 = require("azure-actions-appservice-rest/Arm/SiteContainer"); -const github = require('@actions/github'); -var WebAppKind; -(function (WebAppKind) { - WebAppKind[WebAppKind["Windows"] = 0] = "Windows"; - WebAppKind[WebAppKind["Linux"] = 1] = "Linux"; - WebAppKind[WebAppKind["WindowsContainer"] = 2] = "WindowsContainer"; - WebAppKind[WebAppKind["LinuxContainer"] = 3] = "LinuxContainer"; -})(WebAppKind || (exports.WebAppKind = WebAppKind = {})); -; -exports.appKindMap = new Map([ - ['app', WebAppKind.Windows], - ['app,linux', WebAppKind.Linux], - ['app,container,windows', WebAppKind.WindowsContainer], - ['app,linux,container', WebAppKind.LinuxContainer], - ['api', WebAppKind.Windows], -]); -class ActionParameters { - constructor(endpoint) { - this._publishProfileContent = core.getInput('publish-profile'); - this._appName = core.getInput('app-name'); - this._slotName = core.getInput('slot-name'); - this._packageInput = core.getInput('package'); - this._images = core.getInput('images'); - this._multiContainerConfigFile = core.getInput('configuration-file'); - this._startupCommand = core.getInput('startup-command'); - this._resourceGroupName = core.getInput('resource-group-name'); - /** - * Trimming the commit message because it is used as a param in uri of deployment api. And sometimes, it exceeds the max length of http URI. - */ - this._commitMessage = github.context.eventName === 'push' ? github.context.payload.head_commit.message.slice(0, 1000) : ""; - this._endpoint = endpoint; - // Used only for OneDeploy - this._type = core.getInput('type'); - this._targetPath = core.getInput('target-path'); - this._clean = core.getInput('clean'); - this._restart = core.getInput('restart'); - // Used for Sitecontainers app. - const siteContainersConfigInput = core.getInput('sitecontainers-config'); - if (siteContainersConfigInput) { - const raw = JSON.parse(siteContainersConfigInput); - this._siteContainers = raw.map(SiteContainer_1.SiteContainer.fromJson); - } - else { - this._siteContainers = null; - } - this._blessedAppSitecontainers = false; - } - static getActionParams(endpoint) { - if (!this.actionparams) { - this.actionparams = new ActionParameters(!!endpoint ? endpoint : null); - } - return this.actionparams; - } - get appName() { - return this._appName; - } - get commitMessage() { - return this._commitMessage; - } - set commitMessage(commitMessage) { - this._commitMessage = commitMessage; - } - get packageInput() { - return this._packageInput; - } - get package() { - return this._package; - } - set package(appPackage) { - this._package = appPackage; - } - get images() { - return this._images; - } - get resourceGroupName() { - return this._resourceGroupName; - } - set resourceGroupName(rg) { - this._resourceGroupName = rg; - } - get kind() { - return this._kind; - } - set kind(kind) { - this._kind = kind; - } - get realKind() { - return this._realKind; - } - set realKind(kind) { - this._realKind = kind; - } - get endpoint() { - return this._endpoint; - } - get publishProfileContent() { - return this._publishProfileContent; - } - get slotName() { - return this._slotName; - } - get isMultiContainer() { - return this._isMultiContainer; - } - set isMultiContainer(isMultiCont) { - this._isMultiContainer = isMultiCont; - } - get isLinux() { - return this._isLinux; - } - set isLinux(isLin) { - this._isLinux = isLin; - } - get startupCommand() { - return this._startupCommand; - } - get multiContainerConfigFile() { - return this._multiContainerConfigFile; - } - get type() { - return this._type; - } - set type(type) { - this._type = type; - } - get targetPath() { - return this._targetPath; - } - get clean() { - return this._clean; - } - get restart() { - return this._restart; - } - get siteContainers() { - return this._siteContainers; - } - set siteContainers(siteContainers) { - this._siteContainers = siteContainers; - } - get blessedAppSitecontainers() { - return this._blessedAppSitecontainers; - } - set blessedAppSitecontainers(blessedAppSitecontainers) { - this._blessedAppSitecontainers = blessedAppSitecontainers; - } -} -exports.ActionParameters = ActionParameters; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 5a68a7d35..000000000 --- a/lib/main.js +++ /dev/null @@ -1,103 +0,0 @@ -"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 () { - var ownKeys = function(o) { - ownKeys = Object.getOwnPropertyNames || function (o) { - var ar = []; - for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; - return ar; - }; - return ownKeys(o); - }; - return function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); - __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()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.main = main; -const core = __importStar(require("@actions/core")); -const crypto = __importStar(require("crypto")); -const actionparameters_1 = require("./actionparameters"); -const AuthorizerFactory_1 = require("azure-actions-webclient/AuthorizerFactory"); -const BaseWebAppDeploymentProvider_1 = require("./DeploymentProvider/Providers/BaseWebAppDeploymentProvider"); -const DeploymentProviderFactory_1 = require("./DeploymentProvider/DeploymentProviderFactory"); -const ValidatorFactory_1 = require("./ActionInputValidator/ValidatorFactory"); -var prefix = !!process.env.AZURE_HTTP_USER_AGENT ? `${process.env.AZURE_HTTP_USER_AGENT}` : ""; -function main() { - return __awaiter(this, void 0, void 0, function* () { - let isDeploymentSuccess = true; - try { - // Set user agent variable - let usrAgentRepo = crypto.createHash('sha256').update(`${process.env.GITHUB_REPOSITORY}`).digest('hex'); - let actionName = 'DeployWebAppToAzure'; - let userAgentString = (!!prefix ? `${prefix}+` : '') + `GITHUBACTIONS_${actionName}_${usrAgentRepo}`; - core.exportVariable('AZURE_HTTP_USER_AGENT', userAgentString); - // Initialize action inputs - let endpoint = !!core.getInput('publish-profile') ? null : yield AuthorizerFactory_1.AuthorizerFactory.getAuthorizer(); - actionparameters_1.ActionParameters.getActionParams(endpoint); - let type = null; - if (!!endpoint) { - type = BaseWebAppDeploymentProvider_1.DEPLOYMENT_PROVIDER_TYPES.SPN; - } - else { - type = BaseWebAppDeploymentProvider_1.DEPLOYMENT_PROVIDER_TYPES.PUBLISHPROFILE; - } - // Validate action inputs - let validator = yield ValidatorFactory_1.ValidatorFactory.getValidator(type); - yield validator.validate(); - var deploymentProvider = DeploymentProviderFactory_1.DeploymentProviderFactory.getDeploymentProvider(type); - core.info("Predeployment Step Started"); - yield deploymentProvider.PreDeploymentStep(); - core.info("Deployment Step Started"); - yield deploymentProvider.DeployWebAppStep(); - } - catch (error) { - isDeploymentSuccess = false; - if (error.statusCode == 403) { - core.setFailed("The deployment to your web app failed with HTTP status code 403. \ - Your web app may have networking features enabled which are blocking access (such as Private Endpoints). \ - For more information about deploying to virtual network integrated web apps, please follow https://aka.ms/gha/deploying-to-network-secured-sites"); - } - else { - core.setFailed("Deployment Failed, " + error); - } - } - finally { - if (deploymentProvider != null) { - yield deploymentProvider.UpdateDeploymentStatus(isDeploymentSuccess); - } - // Reset AZURE_HTTP_USER_AGENT - core.exportVariable('AZURE_HTTP_USER_AGENT', prefix); - core.debug(isDeploymentSuccess ? "Deployment Succeeded" : "Deployment failed"); - } - }); -} -main(); diff --git a/package-lock.json b/package-lock.json index 59bbfcec1..9d8105b49 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,6 +19,7 @@ "devDependencies": { "@types/jest": "^29.5.12", "@types/node": "^20.12.2", + "@vercel/ncc": "^0.38.1", "jest": "29.7.0", "ts-jest": "29.1.2", "ts-node": "^10.9.1", @@ -1272,6 +1273,16 @@ "dev": true, "license": "MIT" }, + "node_modules/@vercel/ncc": { + "version": "0.38.4", + "resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.38.4.tgz", + "integrity": "sha512-8LwjnlP39s08C08J5NstzriPvW1SP8Zfpp1BvC2sI35kPeZnHfxVkCwu4/+Wodgnd60UtT1n8K8zw+Mp7J9JmQ==", + "dev": true, + "license": "MIT", + "bin": { + "ncc": "dist/ncc/cli.js" + } + }, "node_modules/abbrev": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", @@ -2763,21 +2774,6 @@ "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", "license": "ISC" }, - "node_modules/fsevents": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", - "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", - "dev": true, - "hasInstallScript": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" - } - }, "node_modules/function-bind": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", diff --git a/package.json b/package.json index f15928935..fbe1463b3 100644 --- a/package.json +++ b/package.json @@ -2,9 +2,11 @@ "name": "webapps-deploy", "version": "3.0.0", "description": "Deploy web apps and containerized web apps to Azure", - "main": "lib/main.js", + "main": "dist/index.js", "scripts": { "build": "tsc", + "bundle": "ncc build lib/main.js -o dist", + "package": "npm run build && npm run bundle", "test": "jest" }, "repository": { @@ -25,6 +27,7 @@ "devDependencies": { "@types/jest": "^29.5.12", "@types/node": "^20.12.2", + "@vercel/ncc": "^0.38.1", "jest": "29.7.0", "ts-jest": "29.1.2", "ts-node": "^10.9.1",