From 649927d4a359dfbe07470d3031ccb0a24bba2034 Mon Sep 17 00:00:00 2001 From: Sivli Embir Date: Mon, 1 Aug 2022 11:31:48 -0700 Subject: [PATCH] build-on-commit - build on commit build-on-commit - build on commit build-on-commit - build on commit build-on-commit - build on commit build-on-commit - build on commit --- dist/index.js | 56 ++++++++++++++++++++++---------------------- git-hooks/pre-commit | 2 ++ package-lock.json | 46 ++++++++++-------------------------- package.json | 6 +++-- 4 files changed, 47 insertions(+), 63 deletions(-) create mode 100755 git-hooks/pre-commit diff --git a/dist/index.js b/dist/index.js index ea6fee4..70db244 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1,7 +1,7 @@ /******/ (() => { // webpackBootstrap /******/ var __webpack_modules__ = ({ -/***/ 117: +/***/ 241: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -28,7 +28,7 @@ var __importStar = (this && this.__importStar) || function (mod) { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.issue = exports.issueCommand = void 0; const os = __importStar(__nccwpck_require__(37)); -const utils_1 = __nccwpck_require__(46); +const utils_1 = __nccwpck_require__(278); /** * Commands * @@ -100,7 +100,7 @@ function escapeProperty(s) { /***/ }), -/***/ 559: +/***/ 186: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -135,12 +135,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.getIDToken = exports.getState = exports.saveState = exports.group = exports.endGroup = exports.startGroup = exports.info = exports.notice = exports.warning = exports.error = exports.debug = exports.isDebug = exports.setFailed = exports.setCommandEcho = exports.setOutput = exports.getBooleanInput = exports.getMultilineInput = exports.getInput = exports.addPath = exports.setSecret = exports.exportVariable = exports.ExitCode = void 0; -const command_1 = __nccwpck_require__(117); -const file_command_1 = __nccwpck_require__(28); -const utils_1 = __nccwpck_require__(46); +const command_1 = __nccwpck_require__(241); +const file_command_1 = __nccwpck_require__(717); +const utils_1 = __nccwpck_require__(278); const os = __importStar(__nccwpck_require__(37)); const path = __importStar(__nccwpck_require__(17)); -const oidc_utils_1 = __nccwpck_require__(853); +const oidc_utils_1 = __nccwpck_require__(41); /** * The code to exit an action */ @@ -418,18 +418,18 @@ exports.getIDToken = getIDToken; /** * Summary exports */ -var summary_1 = __nccwpck_require__(368); +var summary_1 = __nccwpck_require__(327); Object.defineProperty(exports, "summary", ({ enumerable: true, get: function () { return summary_1.summary; } })); /** * @deprecated use core.summary */ -var summary_2 = __nccwpck_require__(368); +var summary_2 = __nccwpck_require__(327); Object.defineProperty(exports, "markdownSummary", ({ enumerable: true, get: function () { return summary_2.markdownSummary; } })); //# sourceMappingURL=core.js.map /***/ }), -/***/ 28: +/***/ 717: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -460,7 +460,7 @@ exports.issueCommand = void 0; /* eslint-disable @typescript-eslint/no-explicit-any */ const fs = __importStar(__nccwpck_require__(147)); const os = __importStar(__nccwpck_require__(37)); -const utils_1 = __nccwpck_require__(46); +const utils_1 = __nccwpck_require__(278); function issueCommand(command, message) { const filePath = process.env[`GITHUB_${command}`]; if (!filePath) { @@ -478,7 +478,7 @@ exports.issueCommand = issueCommand; /***/ }), -/***/ 853: +/***/ 41: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -494,9 +494,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.OidcClient = void 0; -const http_client_1 = __nccwpck_require__(506); -const auth_1 = __nccwpck_require__(754); -const core_1 = __nccwpck_require__(559); +const http_client_1 = __nccwpck_require__(255); +const auth_1 = __nccwpck_require__(526); +const core_1 = __nccwpck_require__(186); class OidcClient { static createHttpClient(allowRetry = true, maxRetry = 10) { const requestOptions = { @@ -562,7 +562,7 @@ exports.OidcClient = OidcClient; /***/ }), -/***/ 368: +/***/ 327: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -852,7 +852,7 @@ exports.summary = _summary; /***/ }), -/***/ 46: +/***/ 278: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -899,7 +899,7 @@ exports.toCommandProperties = toCommandProperties; /***/ }), -/***/ 754: +/***/ 526: /***/ (function(__unused_webpack_module, exports) { "use strict"; @@ -987,7 +987,7 @@ exports.PersonalAccessTokenCredentialHandler = PersonalAccessTokenCredentialHand /***/ }), -/***/ 506: +/***/ 255: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; @@ -1025,8 +1025,8 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); exports.HttpClient = exports.isHttps = exports.HttpClientResponse = exports.HttpClientError = exports.getProxyUrl = exports.MediaTypes = exports.Headers = exports.HttpCodes = void 0; const http = __importStar(__nccwpck_require__(685)); const https = __importStar(__nccwpck_require__(687)); -const pm = __importStar(__nccwpck_require__(617)); -const tunnel = __importStar(__nccwpck_require__(683)); +const pm = __importStar(__nccwpck_require__(835)); +const tunnel = __importStar(__nccwpck_require__(294)); var HttpCodes; (function (HttpCodes) { HttpCodes[HttpCodes["OK"] = 200] = "OK"; @@ -1599,7 +1599,7 @@ const lowercaseKeys = (obj) => Object.keys(obj).reduce((c, k) => ((c[k.toLowerCa /***/ }), -/***/ 617: +/***/ 835: /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -1667,15 +1667,15 @@ exports.checkBypass = checkBypass; /***/ }), -/***/ 683: +/***/ 294: /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { -module.exports = __nccwpck_require__(578); +module.exports = __nccwpck_require__(219); /***/ }), -/***/ 578: +/***/ 219: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; @@ -2084,7 +2084,7 @@ module.exports = require("util"); var __webpack_exports__ = {}; // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. (() => { -const core = __nccwpck_require__(559); +const core = __nccwpck_require__(186); const { stringify } = __nccwpck_require__(477); const npm_auth_token = core.getInput('npm_auth_token', { required: true }); const gh_token = core.getInput('gh_token', { required: true }); @@ -2101,6 +2101,8 @@ const main = async () => { console.log('skipping due to [skip ci] message') return; } + execSync(`echo "//registry.npmjs.org/:_authToken=${npm_auth_token}" > .npmrc`, + {stdio: 'inherit'}) execSync('yarn global add auto', {stdio: 'inherit'}) execSync('yarn install --frozen-lockfile', @@ -2117,8 +2119,6 @@ const main = async () => { {stdio: 'inherit'}) execSync('git fetch --tags', {stdio: 'inherit'}) - execSync(`echo "//registry.npmjs.org/:_authToken=${npm_auth_token}" > .npmrc`, - {stdio: 'inherit'}) execSync(`NPM_TOKEN=${npm_auth_token} GH_TOKEN=${gh_token} auto shipit --email internal-automation.bot@jupiterone.com --name j1-internal-automation`, {stdio: 'inherit'}) } diff --git a/git-hooks/pre-commit b/git-hooks/pre-commit new file mode 100755 index 0000000..ad0600b --- /dev/null +++ b/git-hooks/pre-commit @@ -0,0 +1,2 @@ +yarn build +git add dist/index.js diff --git a/package-lock.json b/package-lock.json index dad1953..bee8e5b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,54 +1,34 @@ { "name": "action-npm-build-release", "version": "1.0.0", - "lockfileVersion": 2, + "lockfileVersion": 1, "requires": true, - "packages": { - "": { - "name": "action-npm-build-release", - "version": "1.0.0", - "license": "ISC", - "dependencies": { - "@actions/core": "^1.8.2" - } - }, - "node_modules/@actions/core": { - "version": "1.8.2", - "license": "MIT", - "dependencies": { - "@actions/http-client": "^2.0.1" - } - }, - "node_modules/@actions/http-client": { - "version": "2.0.1", - "license": "MIT", - "dependencies": { - "tunnel": "^0.0.6" - } - }, - "node_modules/tunnel": { - "version": "0.0.6", - "license": "MIT", - "engines": { - "node": ">=0.6.11 <=0.7.0 || >=0.7.3" - } - } - }, "dependencies": { "@actions/core": { "version": "1.8.2", + "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.8.2.tgz", + "integrity": "sha512-FXcBL7nyik8K5ODeCKlxi+vts7torOkoDAKfeh61EAkAy1HAvwn9uVzZBY0f15YcQTcZZ2/iSGBFHEuioZWfDA==", "requires": { "@actions/http-client": "^2.0.1" } }, "@actions/http-client": { "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.0.1.tgz", + "integrity": "sha512-PIXiMVtz6VvyaRsGY268qvj57hXQEpsYogYOu2nrQhlf+XCGmZstmuZBbAybUl1nQGnvS1k1eEsQ69ZoD7xlSw==", "requires": { "tunnel": "^0.0.6" } }, + "@vercel/ncc": { + "version": "0.34.0", + "resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.34.0.tgz", + "integrity": "sha512-G9h5ZLBJ/V57Ou9vz5hI8pda/YQX5HQszCs3AmIus3XzsmRn/0Ptic5otD3xVST8QLKk7AMk7AqpsyQGN7MZ9A==" + }, "tunnel": { - "version": "0.0.6" + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz", + "integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==" } } } diff --git a/package.json b/package.json index 674230b..8e5924d 100644 --- a/package.json +++ b/package.json @@ -4,8 +4,9 @@ "description": "", "main": "index.js", "scripts": { + "postinstall": "git config core.hooksPath ./git-hooks", "test": "echo \"Error: no test specified\" && exit 1", - "build": "ncc build src/index.js" + "build": "yarn ncc build src/index.js" }, "repository": { "type": "git", @@ -19,6 +20,7 @@ }, "homepage": "https://github.com/JupiterOne/action-npm-build-release#readme", "dependencies": { - "@actions/core": "^1.8.2" + "@actions/core": "^1.8.2", + "@vercel/ncc": "^0.34.0" } }