fix: extract archive on linux
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user