mirror of
https://github.com/goreleaser/goreleaser-action
synced 2026-08-30 02:08:28 +00:00
refactor: collapse the duplicated zip extract branches
Both branches called extractZip with the same destination after the install rewrite, so only the source path differs now. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4eaf86fa-a85b-41f6-8763-612acc1ccc39 Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
This commit is contained in:
co-authored by
Copilot
parent
fa7c11c5a3
commit
52910df325
+1
-1
File diff suppressed because one or more lines are too long
+6
-7
@@ -16,7 +16,7 @@ export async function install(distribution: string, version: string, cacheBinary
|
||||
const tag = release.tag_name;
|
||||
const toolVersion = tag.replace(/^v/, '');
|
||||
|
||||
const toolPath: string = tc.find(distribution, toolVersion);
|
||||
const toolPath = tc.find(distribution, toolVersion);
|
||||
if (toolPath) {
|
||||
core.info(`GoReleaser ${tag} found in the runner tool cache: ${toolPath}`);
|
||||
return getExePath(toolPath);
|
||||
@@ -46,13 +46,12 @@ export async function install(distribution: string, version: string, cacheBinary
|
||||
core.info('Extracting GoReleaser');
|
||||
await io.rmRF(extPath);
|
||||
if (context.osPlat == 'win32') {
|
||||
if (!downloadPath.endsWith('.zip')) {
|
||||
const newPath = downloadPath + '.zip';
|
||||
fs.renameSync(downloadPath, newPath);
|
||||
await tc.extractZip(newPath, extPath);
|
||||
} else {
|
||||
await tc.extractZip(downloadPath, extPath);
|
||||
let zipPath = downloadPath;
|
||||
if (!zipPath.endsWith('.zip')) {
|
||||
zipPath = `${downloadPath}.zip`;
|
||||
fs.renameSync(downloadPath, zipPath);
|
||||
}
|
||||
await tc.extractZip(zipPath, extPath);
|
||||
} else {
|
||||
await tc.extractTar(downloadPath, extPath);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user