Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
Signed-off-by: Patrick Zheng <[email protected]>
  • Loading branch information
Two-Hearts committed Aug 9, 2023
1 parent 8fe66d8 commit fa2098b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
10 changes: 5 additions & 5 deletions dist/sign.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/sign.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions src/sign.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const plugin_checksum = core.getInput('plugin_checksum').toLowerCase();
if (!plugin_checksum) {
throw new Error("input plugin_checksum is required");
}
const notationPluginName = `notation-${plugin_name}` + getBinaryExtension();
const notationPluginBinary = `notation-${plugin_name}` + getBinaryExtension();

// sign signs the target artifact with Notation.
async function sign(): Promise<void> {
Expand Down Expand Up @@ -105,7 +105,7 @@ async function setupPlugin() {
fs.mkdirSync(notationPluginPath, { recursive: true, });
await extract(pathToTarball, notationPluginPath);
console.log(`successfully extracted the plugin binary to ${notationPluginPath}`);
fs.chmod(path.join(notationPluginPath, notationPluginName), 0o755, (err) => {
fs.chmod(path.join(notationPluginPath, notationPluginBinary), 0o755, (err) => {
if (err) throw err;
console.log(`successfully changed permission of plugin binary`);
});
Expand All @@ -120,7 +120,7 @@ async function setupPlugin() {

// checkPluginExistence checks if the plugin is already installed in Notation
function checkPluginExistence(notationPluginPath: string): boolean {
const pluginBinaryPath = path.join(notationPluginPath, notationPluginName);
const pluginBinaryPath = path.join(notationPluginPath, notationPluginBinary);
return fs.existsSync(pluginBinaryPath);
}

Expand All @@ -129,9 +129,9 @@ function checkPluginExistence(notationPluginPath: string): boolean {
async function validateDownloadPluginName(pathToTarball: string) {
const extract = plugin_url.endsWith('.zip') ? tc.extractZip : tc.extractTar;
const curDir = await extract(pathToTarball);
const expectedPluginBinaryPath = path.join(curDir, notationPluginName);
const expectedPluginBinaryPath = path.join(curDir, notationPluginBinary);
if (!fs.existsSync(expectedPluginBinaryPath)) {
throw new Error(`downloaded plugin does not match user input plugin_name, expected "${notationPluginName}" not found`);
throw new Error(`downloaded plugin does not match user input plugin_name, expected "${notationPluginBinary}" not found`);
}
}

Expand Down

0 comments on commit fa2098b

Please sign in to comment.