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

@@ -2,6 +2,7 @@ import * as tc from '@actions/tool-cache'
import * as core from '@actions/core'
import * as util from './util'
import * as httpm from '@actions/http-client'
import * as exec from '@actions/exec'
/**
* Download a specific version of the Zig.
@@ -43,7 +44,24 @@ export async function download(version: string): Promise<string> {
if (platform == 'windows') {
extractedPath = await tc.extractZip(archivePath)
} 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)