@@ -28,6 +28,7 @@ import require$$0$9 from 'diagnostics_channel';
2828import require$$2$2 from 'child_process';
2929import require$$6$1 from 'timers';
3030import { chmodSync } from 'node:fs';
31+ import { join } from 'node:path';
3132
3233var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
3334
@@ -29826,7 +29827,7 @@ async function execOutput(commandLine, args, options) {
2982629827 const stderr = [];
2982729828 const defaultOptions = {
2982829829 // https://github.com/actions/toolkit/blob/%40actions/exec%401.0.1/packages/exec/src/interfaces.ts#L39
29829- silent: true ,
29830+ silent: false ,
2983029831 failOnStdErr: true,
2983129832 listeners: {
2983229833 stdline(data) {
@@ -29857,13 +29858,13 @@ class GpgCli {
2985729858 }
2985829859 }
2985929860 async import(ascPath) {
29860- await execOutput(this.name, ['--import', ascPath]);
29861+ await execOutput(this.name, ['--import', ascPath], { failOnStdErr: false } );
2986129862 }
2986229863 async verify(sigPath, binPath) {
29863- await execOutput(this.name, ['--verify', sigPath, binPath]);
29864+ await execOutput(this.name, ['--verify', sigPath, binPath], { failOnStdErr: false } );
2986429865 }
2986529866 async help() {
29866- const { stdout } = await execOutput(this.name, ['--help']);
29867+ const { stdout } = await execOutput(this.name, ['--help'], { silent: true } );
2986729868 return stdout.join('\n');
2986829869 }
2986929870}
@@ -29914,6 +29915,10 @@ class TrdlCli {
2991429915 const { stdout } = await execOutput(this.name, ['list']);
2991529916 return stdout.slice(1).map(parseLineToItem);
2991629917 }
29918+ async version() {
29919+ const { stdout } = await execOutput(this.name, ['version']);
29920+ return stdout.join('');
29921+ }
2991729922}
2991829923function parseLineToItem(line) {
2991929924 const [name, url, default_, channel] = line.trim().split(/ +/);
@@ -29998,13 +30003,14 @@ async function downloadParallel(binUrl, sigUrl, ascUrl) {
2999830003function findTrdlCache(toolName, toolVersion) {
2999930004 return toolCacheExports.find(toolName, toolVersion);
3000030005}
30001- async function installTrdl(toolName, toolVersion, binPath ) {
30006+ async function installTrdl(binPath, toolName, toolVersion ) {
3000230007 // install tool
30003- const installedPath = await toolCacheExports.cacheFile(binPath, toolName, toolName, toolVersion);
30004- // set permissions
30005- chmodSync(installedPath, 0o755);
30008+ const cachedPath = await toolCacheExports.cacheFile(binPath, toolName, toolName, toolVersion);
3000630009 // add tool to $PATH
30007- coreExports.addPath(installedPath);
30010+ coreExports.addPath(cachedPath);
30011+ const cachedFile = join(cachedPath, toolName);
30012+ // set permissions
30013+ chmodSync(cachedFile, 0o755);
3000830014}
3000930015async function Run() {
3001030016 const trdlCli = new TrdlCli();
@@ -30013,33 +30019,39 @@ async function Run() {
3001330019 await Do(trdlCli, gpgCli, inputs);
3001430020}
3001530021async function Do(trdlCli, gpgCli, inputs) {
30016- coreExports.startGroup(' Install or self-update trdl.' );
30017- coreExports.debug (format(`parsed inputs=%o`, inputs));
30022+ coreExports.startGroup(` Install or self-update ${trdlCli.name}.` );
30023+ coreExports.info (format(`parsed inputs=%o`, inputs));
3001830024 const defaults = trdlCli.defaults();
30019- coreExports.debug (format(`trdl defaults=%o`, defaults));
30025+ coreExports.info (format(`${trdlCli.name} repository defaults=%o`, defaults));
3002030026 const options = await getOptions(inputs, defaults);
30021- coreExports.debug (format(`installation options=%o`, options));
30022- const toolCache = findTrdlCache(defaults.repo , options.version);
30027+ coreExports.info (format(`${trdlCli.name} installation options=%o`, options));
30028+ const toolCache = findTrdlCache(trdlCli.name , options.version);
3002330029 if (toolCache) {
30024- coreExports.info(`Installation skipped. trdl @v${options.version} is found at path ${toolCache}.`);
30030+ coreExports.info(`Installation skipped. ${trdlCli.name} @v${options.version} is found in tool cache ${toolCache}.`);
3002530031 await trdlCli.mustExist();
30026- coreExports.info(`Updating trdl to group=${defaults.group} and channel=${defaults.channel}`);
30032+ coreExports.info(`Checking ${trdlCli.name} version before updating.`);
30033+ await trdlCli.version();
30034+ coreExports.info(`Updating ${trdlCli.name} to group=${defaults.group} and channel=${defaults.channel}.`);
3002730035 await trdlCli.update(defaults);
30036+ coreExports.info(`Checking ${trdlCli.name} version after updating.`);
30037+ await trdlCli.version();
3002830038 coreExports.endGroup();
3002930039 return;
3003030040 }
3003130041 await gpgCli.mustGnuGP();
3003230042 const [binUrl, sigUrl, ascUrl] = formatDownloadUrls(options.version);
30033- coreExports.debug(format('%s bin_url=%s', defaults.repo, binUrl) );
30034- coreExports.debug(format('%s sig_url=%s', defaults.repo, sigUrl) );
30035- coreExports.debug(format('%s asc_url=%s', defaults.repo, ascUrl) );
30036- coreExports.info('Downloading signatures.');
30043+ coreExports.info(`${trdlCli.name} binUrl=${binUrl}` );
30044+ coreExports.info(`${trdlCli.name} sigUrl=${sigUrl}` );
30045+ coreExports.info(`${trdlCli.name} ascUrl=${ascUrl}` );
30046+ coreExports.info('Downloading binary and signatures.');
3003730047 const [binPath, sigPath, ascPath] = await downloadParallel(binUrl, sigUrl, ascUrl);
3003830048 coreExports.info('Importing and verifying gpg keys.');
3003930049 await gpgCli.import(ascPath);
3004030050 await gpgCli.verify(sigPath, binPath);
30041- coreExports.info('Installing trdl and adding it to the $PATH.');
30042- await installTrdl(defaults.repo, options.version, binPath);
30051+ coreExports.info(`Installing ${trdlCli.name} and adding it to the $PATH.`);
30052+ await installTrdl(binPath, trdlCli.name, options.version);
30053+ coreExports.info(`Checking installed ${trdlCli.name} version.`);
30054+ await trdlCli.version();
3004330055 coreExports.endGroup();
3004430056}
3004530057
0 commit comments