mirror of
https://github.com/goreleaser/goreleaser-action
synced 2026-09-03 09:28:29 +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 tag = release.tag_name;
|
||||||
const toolVersion = tag.replace(/^v/, '');
|
const toolVersion = tag.replace(/^v/, '');
|
||||||
|
|
||||||
const toolPath: string = tc.find(distribution, toolVersion);
|
const toolPath = tc.find(distribution, toolVersion);
|
||||||
if (toolPath) {
|
if (toolPath) {
|
||||||
core.info(`GoReleaser ${tag} found in the runner tool cache: ${toolPath}`);
|
core.info(`GoReleaser ${tag} found in the runner tool cache: ${toolPath}`);
|
||||||
return getExePath(toolPath);
|
return getExePath(toolPath);
|
||||||
@@ -46,13 +46,12 @@ export async function install(distribution: string, version: string, cacheBinary
|
|||||||
core.info('Extracting GoReleaser');
|
core.info('Extracting GoReleaser');
|
||||||
await io.rmRF(extPath);
|
await io.rmRF(extPath);
|
||||||
if (context.osPlat == 'win32') {
|
if (context.osPlat == 'win32') {
|
||||||
if (!downloadPath.endsWith('.zip')) {
|
let zipPath = downloadPath;
|
||||||
const newPath = downloadPath + '.zip';
|
if (!zipPath.endsWith('.zip')) {
|
||||||
fs.renameSync(downloadPath, newPath);
|
zipPath = `${downloadPath}.zip`;
|
||||||
await tc.extractZip(newPath, extPath);
|
fs.renameSync(downloadPath, zipPath);
|
||||||
} else {
|
|
||||||
await tc.extractZip(downloadPath, extPath);
|
|
||||||
}
|
}
|
||||||
|
await tc.extractZip(zipPath, extPath);
|
||||||
} else {
|
} else {
|
||||||
await tc.extractTar(downloadPath, extPath);
|
await tc.extractTar(downloadPath, extPath);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user