From cc735339112f0ab9028c3d3d995d81f4ed4d904e Mon Sep 17 00:00:00 2001 From: Sebastien Vermeille Date: Thu, 7 Sep 2023 19:25:34 +0200 Subject: [PATCH] Declare outputs path and version That way it follows the standard way used also by official gh-actions such as setup-java --- action.yml | 5 +++++ dist/index.js | 3 +++ src/installer.ts | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/action.yml b/action.yml index 8a836f1c..b46784e7 100644 --- a/action.yml +++ b/action.yml @@ -11,6 +11,11 @@ inputs: repo-token: description: 'GitHub repo token to use to avoid rate limiter' default: '' +outputs: + version: + description: 'Actual version of the protoc compiler environment that has been installed' + path: + description: 'Path to where the protoc compiler has been installed' runs: using: 'node16' main: 'dist/index.js' diff --git a/dist/index.js b/dist/index.js index 30c9c056..76c5dd02 100644 --- a/dist/index.js +++ b/dist/index.js @@ -85,6 +85,9 @@ function getProtoc(version, includePreReleases, repoToken) { toolPath = yield downloadRelease(version); process.stdout.write("Protoc cached under " + toolPath + os.EOL); } + // expose outputs + core.setOutput("path", toolPath); + core.setOutput("version", targetVersion); // add the bin folder to the PATH core.addPath(path.join(toolPath, "bin")); }); diff --git a/src/installer.ts b/src/installer.ts index ed3f58d8..c68f4da4 100644 --- a/src/installer.ts +++ b/src/installer.ts @@ -63,6 +63,10 @@ export async function getProtoc( process.stdout.write("Protoc cached under " + toolPath + os.EOL); } + // expose outputs + core.setOutput("path", toolPath); + core.setOutput("version", targetVersion); + // add the bin folder to the PATH core.addPath(path.join(toolPath, "bin")); }