fix: extract archive on linux
All checks were successful
Continuous Integration / GitHub Actions Test (push) Successful in 51s
Check Transpiled JavaScript / Check dist/ (push) Successful in 49s
Continuous Integration / TypeScript Tests (push) Successful in 59s

This commit is contained in:
2024-12-28 12:37:47 +13:00
parent 042eb7b9f9
commit 5ce719d221
4 changed files with 37 additions and 4 deletions

View File

@@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="116" height="20" role="img" aria-label="Coverage: 16.27%"><title>Coverage: 16.27%</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="116" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="63" height="20" fill="#555"/><rect x="63" width="53" height="20" fill="#e05d44"/><rect width="116" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="325" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="530">Coverage</text><text x="325" y="140" transform="scale(.1)" fill="#fff" textLength="530">Coverage</text><text aria-hidden="true" x="885" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="430">16.27%</text><text x="885" y="140" transform="scale(.1)" fill="#fff" textLength="430">16.27%</text></g></svg> <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="116" height="20" role="img" aria-label="Coverage: 16.48%"><title>Coverage: 16.48%</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="116" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="63" height="20" fill="#555"/><rect x="63" width="53" height="20" fill="#e05d44"/><rect width="116" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="325" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="530">Coverage</text><text x="325" y="140" transform="scale(.1)" fill="#fff" textLength="530">Coverage</text><text aria-hidden="true" x="885" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="430">16.48%</text><text x="885" y="140" transform="scale(.1)" fill="#fff" textLength="430">16.48%</text></g></svg>

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

17
dist/index.js generated vendored
View File

@@ -28292,6 +28292,7 @@ const tc = __importStar(__nccwpck_require__(3472));
const core = __importStar(__nccwpck_require__(7484)); const core = __importStar(__nccwpck_require__(7484));
const util = __importStar(__nccwpck_require__(4527)); const util = __importStar(__nccwpck_require__(4527));
const httpm = __importStar(__nccwpck_require__(4844)); const httpm = __importStar(__nccwpck_require__(4844));
const exec = __importStar(__nccwpck_require__(5236));
/** /**
* Download a specific version of the Zig. * Download a specific version of the Zig.
* @param version The version to download * @param version The version to download
@@ -28322,7 +28323,21 @@ async function download(version) {
extractedPath = await tc.extractZip(archivePath); extractedPath = await tc.extractZip(archivePath);
} }
else { else {
extractedPath = await tc.extractTar(archivePath); let exit = await exec.exec('mkdir', ['-p', `/tmp/zig-${version}`]);
if (exit !== 0) {
throw new Error(`Failed to create directory /tmp/zig-${version}`);
}
exit = await exec.exec('tar', [
'-x',
'--strip-components=1',
'--warning=no-unknown-keyword',
'--overwrite',
'-C',
`/tmp/zig-${version}`,
'-f',
archivePath
]);
extractedPath = `/tmp/zig-${version}`;
} }
const cachedPath = await tc.cacheDir(extractedPath, 'zig', version); const cachedPath = await tc.cacheDir(extractedPath, 'zig', version);
return cachedPath; return cachedPath;

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

View File

@@ -2,6 +2,7 @@ import * as tc from '@actions/tool-cache'
import * as core from '@actions/core' import * as core from '@actions/core'
import * as util from './util' import * as util from './util'
import * as httpm from '@actions/http-client' import * as httpm from '@actions/http-client'
import * as exec from '@actions/exec'
/** /**
* Download a specific version of the Zig. * Download a specific version of the Zig.
@@ -43,7 +44,24 @@ export async function download(version: string): Promise<string> {
if (platform == 'windows') { if (platform == 'windows') {
extractedPath = await tc.extractZip(archivePath) extractedPath = await tc.extractZip(archivePath)
} else { } else {
extractedPath = await tc.extractTar(archivePath) let exit = await exec.exec('mkdir', ['-p', `/tmp/zig-${version}`])
if (exit !== 0) {
throw new Error(`Failed to create directory /tmp/zig-${version}`)
}
exit = await exec.exec('tar', [
'-x',
'--strip-components=1',
'--warning=no-unknown-keyword',
'--overwrite',
'-C',
`/tmp/zig-${version}`,
'-f',
archivePath
])
extractedPath = `/tmp/zig-${version}`
} }
const cachedPath = await tc.cacheDir(extractedPath, 'zig', version) const cachedPath = await tc.cacheDir(extractedPath, 'zig', version)