Skip to content

Commit

Permalink
Fix: windows arm64 setup (#1126)
Browse files Browse the repository at this point in the history
* Add condition to ensure ZIP extraction targets only Windows ARM64 official archives

* Bumps micromatch from 4.0.5 to 4.0.8
  • Loading branch information
priyagupta108 committed Sep 6, 2024
1 parent 26961cf commit 1c7b2db
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 12 deletions.
8 changes: 4 additions & 4 deletions dist/setup/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -93883,7 +93883,7 @@ class BaseDistribution {
}
throw err;
}
const toolPath = yield this.extractArchive(downloadPath, info);
const toolPath = yield this.extractArchive(downloadPath, info, true);
core.info('Done');
return toolPath;
});
Expand Down Expand Up @@ -93933,7 +93933,7 @@ class BaseDistribution {
return toolPath;
});
}
extractArchive(downloadPath, info) {
extractArchive(downloadPath, info, isOfficialArchive) {
return __awaiter(this, void 0, void 0, function* () {
//
// Extract
Expand All @@ -93948,7 +93948,7 @@ class BaseDistribution {
// on Windows runners without PowerShell Core.
//
// For default PowerShell Windows it should contain extension type to unpack it.
if (extension === '.zip') {
if (extension === '.zip' && isOfficialArchive) {
const renamedArchive = `${downloadPath}.zip`;
fs_1.default.renameSync(downloadPath, renamedArchive);
extPath = yield tc.extractZip(renamedArchive);
Expand Down Expand Up @@ -94186,7 +94186,7 @@ class OfficialBuilds extends base_distribution_1.default {
core.info(`Acquiring ${versionInfo.resolvedVersion} - ${versionInfo.arch} from ${versionInfo.downloadUrl}`);
downloadPath = yield tc.downloadTool(versionInfo.downloadUrl, undefined, this.nodeInfo.auth);
if (downloadPath) {
toolPath = yield this.extractArchive(downloadPath, versionInfo);
toolPath = yield this.extractArchive(downloadPath, versionInfo, false);
}
}
else {
Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

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

7 changes: 4 additions & 3 deletions src/distributions/base-distribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ export default abstract class BaseDistribution {
throw err;
}

const toolPath = await this.extractArchive(downloadPath, info);
const toolPath = await this.extractArchive(downloadPath, info, true);
core.info('Done');

return toolPath;
Expand Down Expand Up @@ -210,7 +210,8 @@ export default abstract class BaseDistribution {

protected async extractArchive(
downloadPath: string,
info: INodeVersionInfo | null
info: INodeVersionInfo | null,
isOfficialArchive?: boolean
) {
//
// Extract
Expand All @@ -225,7 +226,7 @@ export default abstract class BaseDistribution {
// on Windows runners without PowerShell Core.
//
// For default PowerShell Windows it should contain extension type to unpack it.
if (extension === '.zip') {
if (extension === '.zip' && isOfficialArchive) {
const renamedArchive = `${downloadPath}.zip`;
fs.renameSync(downloadPath, renamedArchive);
extPath = await tc.extractZip(renamedArchive);
Expand Down
6 changes: 5 additions & 1 deletion src/distributions/official_builds/official_builds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,11 @@ export default class OfficialBuilds extends BaseDistribution {
);

if (downloadPath) {
toolPath = await this.extractArchive(downloadPath, versionInfo);
toolPath = await this.extractArchive(
downloadPath,
versionInfo,
false
);
}
} else {
core.info(
Expand Down

0 comments on commit 1c7b2db

Please sign in to comment.