fix caching by ignoring semver build metadata
This commit is contained in:
parent
c7b6cdd3ad
commit
9f5e80ae9e
18397
dist/index.js
vendored
18397
dist/index.js
vendored
File diff suppressed because one or more lines are too long
14
test.js
14
test.js
|
@ -1,4 +1,5 @@
|
||||||
const assert = require('assert').strict
|
const assert = require('assert').strict
|
||||||
|
const semver = require('semver')
|
||||||
const {
|
const {
|
||||||
resolveCommit,
|
resolveCommit,
|
||||||
resolveVersion
|
resolveVersion
|
||||||
|
@ -7,13 +8,18 @@ const {
|
||||||
async function test () {
|
async function test () {
|
||||||
assert.deepEqual(resolveCommit('linux', '0.6.0+4b48fccad'), {
|
assert.deepEqual(resolveCommit('linux', '0.6.0+4b48fccad'), {
|
||||||
downloadUrl: 'https://ziglang.org/builds/zig-linux-x86_64-0.6.0+4b48fccad.tar.xz',
|
downloadUrl: 'https://ziglang.org/builds/zig-linux-x86_64-0.6.0+4b48fccad.tar.xz',
|
||||||
variantName: 'zig-linux-x86_64-0.6.0+4b48fccad',
|
variantName: 'zig-linux-x86_64-0.6.0',
|
||||||
version: '0.6.0+4b48fccad'
|
version: '0.6.0'
|
||||||
})
|
})
|
||||||
assert.deepEqual(resolveCommit('win32', '0.6.0+4b48fccad'), {
|
assert.deepEqual(resolveCommit('win32', '0.6.0+4b48fccad'), {
|
||||||
downloadUrl: 'https://ziglang.org/builds/zig-windows-x86_64-0.6.0+4b48fccad.zip',
|
downloadUrl: 'https://ziglang.org/builds/zig-windows-x86_64-0.6.0+4b48fccad.zip',
|
||||||
variantName: 'zig-windows-x86_64-0.6.0+4b48fccad',
|
variantName: 'zig-windows-x86_64-0.6.0',
|
||||||
version: '0.6.0+4b48fccad'
|
version: '0.6.0'
|
||||||
|
})
|
||||||
|
assert.deepEqual(resolveCommit('win32', '0.12.0-dev.1092+68ed78775'), {
|
||||||
|
downloadUrl: 'https://ziglang.org/builds/zig-windows-x86_64-0.12.0-dev.1092+68ed78775.zip',
|
||||||
|
variantName: 'zig-windows-x86_64-0.12.0-dev.1092',
|
||||||
|
version: '0.12.0-dev.1092'
|
||||||
})
|
})
|
||||||
|
|
||||||
assert.deepEqual(await resolveVersion('linux', '0.7.0'), {
|
assert.deepEqual(await resolveVersion('linux', '0.7.0'), {
|
||||||
|
|
|
@ -19,9 +19,11 @@ function resolveCommit (platform, version) {
|
||||||
}[platform]
|
}[platform]
|
||||||
|
|
||||||
const downloadUrl = `https://ziglang.org/builds/zig-${addrhost}-${version}.${ext}`
|
const downloadUrl = `https://ziglang.org/builds/zig-${addrhost}-${version}.${ext}`
|
||||||
const variantName = `zig-${addrhost}-${version}`
|
|
||||||
|
|
||||||
return { downloadUrl, variantName, version }
|
const versionWithoutBuildHash = semver.clean(version)
|
||||||
|
const variantName = `zig-${addrhost}-${versionWithoutBuildHash}`
|
||||||
|
|
||||||
|
return { downloadUrl, variantName, version: versionWithoutBuildHash }
|
||||||
}
|
}
|
||||||
|
|
||||||
function getJSON (opts) {
|
function getJSON (opts) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user