Skip to content

Commit b4136be

Browse files
committed
Extract tarball
1 parent 5032ff7 commit b4136be

File tree

4 files changed

+10
-24
lines changed

4 files changed

+10
-24
lines changed

dist/index.js

Lines changed: 4 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ test('releae url', () => {
1111

1212
const url = getReleaseURL('v2.4.6')
1313
expect(url).toBe(
14-
'https://github.com/labd/mach-composer/releases/download/v2.4.6/mach-composer-2.4.6-linux-amd64'
14+
'https://github.com/labd/mach-composer/releases/download/v2.4.6/mach-composer-2.4.6-linux-amd64.tar.gz'
1515
)
1616
})

src/main.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import * as os from 'os'
2-
import {chmod} from 'fs/promises'
32
import * as core from '@actions/core'
43
import * as cache from '@actions/tool-cache'
54
import * as semver from 'semver'
@@ -43,20 +42,17 @@ function getArch(): string {
4342

4443
async function downloadCLI(version: string): Promise<string> {
4544
const url = getReleaseURL(version)
46-
const downloadedTool = await cache.downloadTool(url)
47-
const permissions = 0o755
48-
49-
await chmod(downloadedTool, permissions)
50-
return await cache.cacheFile(downloadedTool, toolName, toolName, version)
45+
const artifactPath = await cache.downloadTool(url)
46+
const path = await cache.extractTar(artifactPath)
47+
return await cache.cacheFile(path, toolName, toolName, version)
5148
}
5249

5350
export function getReleaseURL(version: string): string {
5451
const cleanVersion = semver.clean(version) || ''
5552
const platform = getPlatform()
5653
const arch = getArch()
57-
5854
return encodeURI(
59-
`https://github.com/labd/mach-composer/releases/download/v${cleanVersion}/mach-composer-${cleanVersion}-${platform}-${arch}`
55+
`https://github.com/labd/mach-composer/releases/download/v${cleanVersion}/mach-composer-${cleanVersion}-${platform}-${arch}.tar.gz`
6056
)
6157
}
6258

0 commit comments

Comments
 (0)