Skip to content

Commit

Permalink
feat(config): support templating bin_path (#19)
Browse files Browse the repository at this point in the history
Co-authored-by: Robert Schönthal <robert.schoenthal@statista.com>
  • Loading branch information
digitalkaoz and Robert Schönthal authored Nov 24, 2024
1 parent 053d98c commit 27af3fa
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,13 @@ export async function main() {
// download or pull from cache
const toolPath = await downloadTool(config);

if (config.binPath != "") {
config.binPath = template(config.binPath, {
...config,
...templateArgs,
});
}

core.debug("cached path: " + toolPath);
core.addPath(path.join(toolPath, config.binPath));
core.info(`Successfully installed version ${config.version}`);
Expand Down
7 changes: 7 additions & 0 deletions src/presets/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ const presets: Record<string, Partial<Config>> = {
"https://storage.googleapis.com/cloud-sql-connectors/cloud-sql-proxy/v{{version}}/cloud-sql-proxy.{{os}}.{{arch}}",
downloadName: "cloud-sql-proxy",
},
"github-cli": {
repo: "cli/cli",
version: "2.62.0",
downloadUrl:
"/releases/download/v{{version}}/gh_{{version}}_{{os}}_{{arch}}.{{archive}}",
binPath: "/gh_{{version}}_{{os}}_{{arch}}/bin",
},
};

export default presets;

0 comments on commit 27af3fa

Please sign in to comment.