@@ -57,11 +57,18 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
5757 step ( ( generator = generator . apply ( thisArg , _arguments || [ ] ) ) . next ( ) ) ;
5858 } ) ;
5959} ;
60+ var __importStar = ( this && this . __importStar ) || function ( mod ) {
61+ if ( mod && mod . __esModule ) return mod ;
62+ var result = { } ;
63+ if ( mod != null ) for ( var k in mod ) if ( Object . hasOwnProperty . call ( mod , k ) ) result [ k ] = mod [ k ] ;
64+ result [ "default" ] = mod ;
65+ return result ;
66+ } ;
6067Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
61- const childProcess = __webpack_require__ ( 129 ) ;
62- const path = __webpack_require__ ( 622 ) ;
68+ const childProcess = __importStar ( __webpack_require__ ( 129 ) ) ;
69+ const path = __importStar ( __webpack_require__ ( 622 ) ) ;
6370const util_1 = __webpack_require__ ( 669 ) ;
64- const ioUtil = __webpack_require__ ( 672 ) ;
71+ const ioUtil = __importStar ( __webpack_require__ ( 672 ) ) ;
6572const exec = util_1 . promisify ( childProcess . exec ) ;
6673/**
6774 * Copies a file or folder.
@@ -229,58 +236,73 @@ function which(tool, check) {
229236 throw new Error ( `Unable to locate executable file: ${ tool } . Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable.` ) ;
230237 }
231238 }
239+ return result ;
232240 }
233- try {
234- // build the list of extensions to try
235- const extensions = [ ] ;
236- if ( ioUtil . IS_WINDOWS && process . env . PATHEXT ) {
237- for ( const extension of process . env . PATHEXT . split ( path . delimiter ) ) {
238- if ( extension ) {
239- extensions . push ( extension ) ;
240- }
241- }
242- }
243- // if it's rooted, return it if exists. otherwise return empty.
244- if ( ioUtil . isRooted ( tool ) ) {
245- const filePath = yield ioUtil . tryGetExecutablePath ( tool , extensions ) ;
246- if ( filePath ) {
247- return filePath ;
241+ const matches = yield findInPath ( tool ) ;
242+ if ( matches && matches . length > 0 ) {
243+ return matches [ 0 ] ;
244+ }
245+ return '' ;
246+ } ) ;
247+ }
248+ exports . which = which ;
249+ /**
250+ * Returns a list of all occurrences of the given tool on the system path.
251+ *
252+ * @returns Promise<string[]> the paths of the tool
253+ */
254+ function findInPath ( tool ) {
255+ return __awaiter ( this , void 0 , void 0 , function * ( ) {
256+ if ( ! tool ) {
257+ throw new Error ( "parameter 'tool' is required" ) ;
258+ }
259+ // build the list of extensions to try
260+ const extensions = [ ] ;
261+ if ( ioUtil . IS_WINDOWS && process . env [ 'PATHEXT' ] ) {
262+ for ( const extension of process . env [ 'PATHEXT' ] . split ( path . delimiter ) ) {
263+ if ( extension ) {
264+ extensions . push ( extension ) ;
248265 }
249- return '' ;
250- }
251- // if any path separators, return empty
252- if ( tool . includes ( '/' ) || ( ioUtil . IS_WINDOWS && tool . includes ( '\\' ) ) ) {
253- return '' ;
254266 }
255- // build the list of directories
256- //
257- // Note, technically "where" checks the current directory on Windows. From a toolkit perspective,
258- // it feels like we should not do this. Checking the current directory seems like more of a use
259- // case of a shell, and the which() function exposed by the toolkit should strive for consistency
260- // across platforms.
261- const directories = [ ] ;
262- if ( process . env . PATH ) {
263- for ( const p of process . env . PATH . split ( path . delimiter ) ) {
264- if ( p ) {
265- directories . push ( p ) ;
266- }
267- }
267+ }
268+ // if it's rooted, return it if exists. otherwise return empty.
269+ if ( ioUtil . isRooted ( tool ) ) {
270+ const filePath = yield ioUtil . tryGetExecutablePath ( tool , extensions ) ;
271+ if ( filePath ) {
272+ return [ filePath ] ;
268273 }
269- // return the first match
270- for ( const directory of directories ) {
271- const filePath = yield ioUtil . tryGetExecutablePath ( directory + path . sep + tool , extensions ) ;
272- if ( filePath ) {
273- return filePath ;
274+ return [ ] ;
275+ }
276+ // if any path separators, return empty
277+ if ( tool . includes ( path . sep ) ) {
278+ return [ ] ;
279+ }
280+ // build the list of directories
281+ //
282+ // Note, technically "where" checks the current directory on Windows. From a toolkit perspective,
283+ // it feels like we should not do this. Checking the current directory seems like more of a use
284+ // case of a shell, and the which() function exposed by the toolkit should strive for consistency
285+ // across platforms.
286+ const directories = [ ] ;
287+ if ( process . env . PATH ) {
288+ for ( const p of process . env . PATH . split ( path . delimiter ) ) {
289+ if ( p ) {
290+ directories . push ( p ) ;
274291 }
275292 }
276- return '' ;
277293 }
278- catch ( err ) {
279- throw new Error ( `which failed with message ${ err . message } ` ) ;
294+ // find all matches
295+ const matches = [ ] ;
296+ for ( const directory of directories ) {
297+ const filePath = yield ioUtil . tryGetExecutablePath ( path . join ( directory , tool ) , extensions ) ;
298+ if ( filePath ) {
299+ matches . push ( filePath ) ;
300+ }
280301 }
302+ return matches ;
281303 } ) ;
282304}
283- exports . which = which ;
305+ exports . findInPath = findInPath ;
284306function readCopyOptions ( options ) {
285307 const force = options . force == null ? true : options . force ;
286308 const recursive = Boolean ( options . recursive ) ;
@@ -354,13 +376,20 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
354376 step ( ( generator = generator . apply ( thisArg , _arguments || [ ] ) ) . next ( ) ) ;
355377 } ) ;
356378} ;
379+ var __importStar = ( this && this . __importStar ) || function ( mod ) {
380+ if ( mod && mod . __esModule ) return mod ;
381+ var result = { } ;
382+ if ( mod != null ) for ( var k in mod ) if ( Object . hasOwnProperty . call ( mod , k ) ) result [ k ] = mod [ k ] ;
383+ result [ "default" ] = mod ;
384+ return result ;
385+ } ;
357386Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
358- const os = __webpack_require__ ( 87 ) ;
359- const events = __webpack_require__ ( 614 ) ;
360- const child = __webpack_require__ ( 129 ) ;
361- const path = __webpack_require__ ( 622 ) ;
362- const io = __webpack_require__ ( 1 ) ;
363- const ioUtil = __webpack_require__ ( 672 ) ;
387+ const os = __importStar ( __webpack_require__ ( 87 ) ) ;
388+ const events = __importStar ( __webpack_require__ ( 614 ) ) ;
389+ const child = __importStar ( __webpack_require__ ( 129 ) ) ;
390+ const path = __importStar ( __webpack_require__ ( 622 ) ) ;
391+ const io = __importStar ( __webpack_require__ ( 1 ) ) ;
392+ const ioUtil = __importStar ( __webpack_require__ ( 672 ) ) ;
364393/* eslint-disable @typescript-eslint/unbound-method */
365394const IS_WINDOWS = process . platform === 'win32' ;
366395/*
@@ -804,6 +833,12 @@ class ToolRunner extends events.EventEmitter {
804833 resolve ( exitCode ) ;
805834 }
806835 } ) ;
836+ if ( this . options . input ) {
837+ if ( ! cp . stdin ) {
838+ throw new Error ( 'child process missing stdin' ) ;
839+ }
840+ cp . stdin . end ( this . options . input ) ;
841+ }
807842 } ) ;
808843 } ) ;
809844 }
@@ -1083,17 +1118,25 @@ function formatReleaseMessage(releaseNumber) {
10831118 "This is the first release" ;
10841119}
10851120
1121+ function addExtraFlagCleanCache ( gigalixirClean ) {
1122+ return gigalixirClean ? ` -c http.extraheader="GIGALIXIR-CLEAN: true" ` : ""
1123+ }
1124+
10861125async function run ( ) {
10871126 try {
1088- const baseInputOptions = {
1127+ const requiredInputOptions = {
10891128 required : true
10901129 } ;
1091- const gigalixirUsername = core . getInput ( 'GIGALIXIR_USERNAME' , baseInputOptions ) ;
1092- const gigalixirPassword = core . getInput ( 'GIGALIXIR_PASSWORD' , baseInputOptions ) ;
1093- const sshPrivateKey = core . getInput ( 'SSH_PRIVATE_KEY' , baseInputOptions ) ;
1094- const gigalixirApp = core . getInput ( 'GIGALIXIR_APP' , baseInputOptions ) ;
1095- const migrations = core . getInput ( 'MIGRATIONS' , baseInputOptions ) ;
1096- const appSubfolder = core . getInput ( 'APP_SUBFOLDER' , { required : false } ) ;
1130+ const optionalInputOptions = {
1131+ required : false
1132+ } ;
1133+ const appSubfolder = core . getInput ( 'APP_SUBFOLDER' , optionalInputOptions ) ;
1134+ const gigalixirApp = core . getInput ( 'GIGALIXIR_APP' , requiredInputOptions ) ;
1135+ const gigalixirClean = core . getInput ( 'GIGALIXIR_CLEAN' , optionalInputOptions ) ;
1136+ const gigalixirUsername = core . getInput ( 'GIGALIXIR_USERNAME' , requiredInputOptions ) ;
1137+ const gigalixirPassword = core . getInput ( 'GIGALIXIR_PASSWORD' , requiredInputOptions ) ;
1138+ const migrations = core . getInput ( 'MIGRATIONS' , requiredInputOptions ) ;
1139+ const sshPrivateKey = core . getInput ( 'SSH_PRIVATE_KEY' , { required : migrations } ) ;
10971140
10981141 await core . group ( "Installing gigalixir" , async ( ) => {
10991142 await exec . exec ( 'pip3 install gigalixir' )
@@ -1115,9 +1158,9 @@ async function run() {
11151158
11161159 await core . group ( "Deploying to gigalixir" , async ( ) => {
11171160 if ( appSubfolder ) {
1118- await exec . exec ( `git subtree push --prefix ${ appSubfolder } gigalixir master` ) ;
1161+ await exec . exec ( `git ${ addExtraFlagCleanCache ( gigalixirClean ) } subtree push --prefix ${ appSubfolder } gigalixir master` ) ;
11191162 } else {
1120- await exec . exec ( " git push -f gigalixir HEAD:refs/heads/master" ) ;
1163+ await exec . exec ( ` git ${ addExtraFlagCleanCache ( gigalixirClean ) } push -f gigalixir HEAD:refs/heads/master` ) ;
11211164 }
11221165 } ) ;
11231166
@@ -1367,6 +1410,7 @@ exports.getInput = getInput;
13671410 */
13681411// eslint-disable-next-line @typescript-eslint/no-explicit-any
13691412function setOutput ( name , value ) {
1413+ process . stdout . write ( os . EOL ) ;
13701414 command_1 . issueCommand ( 'set-output' , { name } , value ) ;
13711415}
13721416exports . setOutput = setOutput ;
@@ -1537,11 +1581,18 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
15371581 step ( ( generator = generator . apply ( thisArg , _arguments || [ ] ) ) . next ( ) ) ;
15381582 } ) ;
15391583} ;
1584+ var __importStar = ( this && this . __importStar ) || function ( mod ) {
1585+ if ( mod && mod . __esModule ) return mod ;
1586+ var result = { } ;
1587+ if ( mod != null ) for ( var k in mod ) if ( Object . hasOwnProperty . call ( mod , k ) ) result [ k ] = mod [ k ] ;
1588+ result [ "default" ] = mod ;
1589+ return result ;
1590+ } ;
15401591var _a ;
15411592Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
15421593const assert_1 = __webpack_require__ ( 357 ) ;
1543- const fs = __webpack_require__ ( 747 ) ;
1544- const path = __webpack_require__ ( 622 ) ;
1594+ const fs = __importStar ( __webpack_require__ ( 747 ) ) ;
1595+ const path = __importStar ( __webpack_require__ ( 622 ) ) ;
15451596_a = fs . promises , exports . chmod = _a . chmod , exports . copyFile = _a . copyFile , exports . lstat = _a . lstat , exports . mkdir = _a . mkdir , exports . readdir = _a . readdir , exports . readlink = _a . readlink , exports . rename = _a . rename , exports . rmdir = _a . rmdir , exports . stat = _a . stat , exports . symlink = _a . symlink , exports . unlink = _a . unlink ;
15461597exports . IS_WINDOWS = process . platform === 'win32' ;
15471598function exists ( fsPath ) {
@@ -1746,8 +1797,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
17461797 step ( ( generator = generator . apply ( thisArg , _arguments || [ ] ) ) . next ( ) ) ;
17471798 } ) ;
17481799} ;
1800+ var __importStar = ( this && this . __importStar ) || function ( mod ) {
1801+ if ( mod && mod . __esModule ) return mod ;
1802+ var result = { } ;
1803+ if ( mod != null ) for ( var k in mod ) if ( Object . hasOwnProperty . call ( mod , k ) ) result [ k ] = mod [ k ] ;
1804+ result [ "default" ] = mod ;
1805+ return result ;
1806+ } ;
17491807Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
1750- const tr = __webpack_require__ ( 9 ) ;
1808+ const tr = __importStar ( __webpack_require__ ( 9 ) ) ;
17511809/**
17521810 * Exec a command.
17531811 * Output will be streamed to the live console.
0 commit comments