@@ -17,6 +17,8 @@ type VoltaInstallOptions = {
1717} ;
1818
1919async function getLatestVolta ( authToken : string ) : Promise < string > {
20+ core . startGroup ( 'Determine the latest volta version' ) ;
21+
2022 const url = 'https://api.github.com/repos/volta-cli/volta/releases/latest' ;
2123
2224 const http = new hc . HttpClient ( 'volta-cli/action' , [ ] , {
@@ -32,12 +34,17 @@ async function getLatestVolta(authToken: string): Promise<string> {
3234 }
3335
3436 try {
37+ core . info ( `Retrieving release info from ${ url } ` ) ;
3538 const response = await http . getJson < { name : string } > ( url , headers ) ;
3639 if ( ! response . result ) {
3740 throw new Error ( `volta-cli/action: Could not download latest release from ${ url } ` ) ;
3841 }
3942
40- return semver . clean ( response . result . name ) as string ;
43+ const result = semver . clean ( response . result . name ) as string ;
44+
45+ core . info ( `Latest volta version is ${ result } ` ) ;
46+
47+ return result ;
4148 } catch ( error : unknown ) {
4249 if (
4350 error instanceof hc . HttpClientError &&
@@ -47,26 +54,46 @@ async function getLatestVolta(authToken: string): Promise<string> {
4754 `Received HTTP status code ${ error . statusCode } . This usually indicates the rate limit has been exceeded`
4855 ) ;
4956
50- return await getLatestVoltaFromVoltaSH ( ) ;
57+ const result = await getLatestVoltaFromVoltaSH ( ) ;
58+
59+ core . info ( `Latest volta version is ${ result } ` ) ;
60+
61+ return result ;
5162 } else {
63+ core . info ( `Failed to determine latest volta release from ${ url } : ${ error } ` ) ;
64+
5265 throw error ;
5366 }
67+ } finally {
68+ core . endGroup ( ) ;
5469 }
5570}
5671
5772async function getLatestVoltaFromVoltaSH ( ) : Promise < string > {
5873 const url = 'https://volta.sh/latest-version' ;
5974
60- core . info ( `Falling back to download from ${ url } ` ) ;
75+ core . info ( `Falling back to determine latest volta version from ${ url } ` ) ;
6176
6277 const http = new hc . HttpClient ( 'volta-cli/action' , [ ] , {
6378 allowRetries : true ,
6479 maxRetries : 3 ,
6580 } ) ;
6681
67- const response = await http . get ( url ) ;
82+ let response : hc . HttpClientResponse ;
83+ try {
84+ response = await http . get ( url ) ;
85+ } catch ( error : unknown ) {
86+ core . setFailed ( `Action failed with error ${ error } ` ) ;
87+
88+ throw error ;
89+ }
90+
6891 if ( response . message . statusCode !== 200 ) {
69- throw new Error ( `volta-cli/action: Could not download latest release from ${ url } ` ) ;
92+ const message = `volta-cli/action: Could not download latest release from ${ url } : ${ response . message . statusMessage } ` ;
93+
94+ core . setFailed ( message ) ;
95+
96+ throw new Error ( message ) ;
7097 }
7198
7299 return semver . clean ( await response . readBody ( ) ) as string ;
@@ -149,6 +176,8 @@ export async function getOpenSSLVersion(version = ''): Promise<string> {
149176}
150177
151178async function execOpenSSLVersion ( ) {
179+ core . info ( 'determining openssl version' ) ;
180+
152181 let output = '' ;
153182 const options : ExecOptions = { } ;
154183 options . listeners = {
@@ -218,50 +247,57 @@ async function acquireVolta(version: string, options: VoltaInstallOptions): Prom
218247 // Download - a tool installer intimately knows how to get the tool (and construct urls)
219248 //
220249
221- core . info ( `downloading volta@${ version } ` ) ;
250+ core . startGroup ( `downloading volta@${ version } ` ) ;
222251
223- const downloadUrl = await buildDownloadUrl ( os . platform ( ) , os . arch ( ) , version , options . variant ) ;
224-
225- core . debug ( `downloading from \`${ downloadUrl } \`` ) ;
226- const downloadPath = await tc . downloadTool ( downloadUrl , undefined , options . authToken ) ;
227-
228- const voltaHome = path . join (
229- // `RUNNER_TEMP` is used by @actions/tool-cache
230- process . env [ 'RUNNER_TEMP' ] || '' ,
231- uuidV4 ( )
232- ) ;
252+ try {
253+ const downloadUrl = await buildDownloadUrl ( os . platform ( ) , os . arch ( ) , version , options . variant ) ;
233254
234- await io . mkdirP ( voltaHome ) ;
255+ core . info ( `downloading volta from \`${ downloadUrl } \`` ) ;
256+ const downloadPath = await tc . downloadTool ( downloadUrl , undefined , options . authToken ) ;
235257
236- //
237- // Extract
238- //
239- const voltaHomeBin = path . join ( voltaHome , 'bin' ) ;
240- core . debug ( `extracting from \`${ downloadPath } \` into \`${ voltaHomeBin } \`` ) ;
241- if ( os . platform ( ) === 'win32' ) {
242- const tmpExtractTarget = path . join (
258+ const voltaHome = path . join (
243259 // `RUNNER_TEMP` is used by @actions/tool-cache
244260 process . env [ 'RUNNER_TEMP' ] || '' ,
245261 uuidV4 ( )
246262 ) ;
247- const msiexecPath = await io . which ( 'msiexec' , true ) ;
248263
249- await exec ( msiexecPath , [ '/a' , downloadPath , '/qn' , `TARGETDIR=${ tmpExtractTarget } ` ] ) ;
250- await io . cp ( path . join ( tmpExtractTarget , 'PFiles' , 'volta' ) , voltaHomeBin , { recursive : true } ) ;
251- } else {
252- await tc . extractTar ( downloadPath , voltaHomeBin ) ;
253- }
264+ await io . mkdirP ( voltaHome ) ;
265+
266+ //
267+ // Extract
268+ //
269+ const voltaHomeBin = path . join ( voltaHome , 'bin' ) ;
270+ core . debug ( `extracting from \`${ downloadPath } \` into \`${ voltaHomeBin } \`` ) ;
271+ if ( os . platform ( ) === 'win32' ) {
272+ const tmpExtractTarget = path . join (
273+ // `RUNNER_TEMP` is used by @actions/tool-cache
274+ process . env [ 'RUNNER_TEMP' ] || '' ,
275+ uuidV4 ( )
276+ ) ;
277+ const msiexecPath = await io . which ( 'msiexec' , true ) ;
278+
279+ await exec ( msiexecPath , [ '/a' , downloadPath , '/qn' , `TARGETDIR=${ tmpExtractTarget } ` ] ) ;
280+ await io . cp ( path . join ( tmpExtractTarget , 'PFiles' , 'volta' ) , voltaHomeBin , {
281+ recursive : true ,
282+ } ) ;
283+ } else {
284+ await tc . extractTar ( downloadPath , voltaHomeBin ) ;
285+ }
254286
255- core . debug (
256- `extracted "${ fs . readdirSync ( voltaHomeBin ) . join ( '","' ) } " from tarball into '${ voltaHomeBin } '`
257- ) ;
287+ core . debug (
288+ `extracted "${ fs . readdirSync ( voltaHomeBin ) . join ( '","' ) } " from tarball into '${ voltaHomeBin } '`
289+ ) ;
258290
259- return voltaHome ;
291+ return voltaHome ;
292+ } finally {
293+ core . endGroup ( ) ;
294+ }
260295}
261296
262297async function setupVolta ( version : string , voltaHome : string ) : Promise < void > {
263298 if ( voltaVersionHasSetup ( version ) ) {
264299 const executable = path . join ( voltaHome , 'bin' , 'volta' ) ;
300+ core . info ( `executing \`${ executable } setup\`` ) ;
265301 await exec ( executable , [ 'setup' ] , {
266302 env : {
267303 // VOLTA_HOME needs to be set before calling volta setup
0 commit comments