Skip to content

Commit

Permalink
fixup! Support bazelisk-version input
Browse files Browse the repository at this point in the history
  • Loading branch information
p0deje committed Feb 7, 2024
1 parent 62e45b7 commit 2caeed7
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 21 deletions.
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,14 @@ Cache [`bazelisk`][1] downloads based on contents of a `.bazelversion` file.

Default `false`.

### `bazelisk-cache`
### `bazelisk-version`

[`bazelisk`][1] version to download and use.

[`bazelisk`][1] version to download and use if not installed. Supports semver specification and ranges.
Supports semver specification and ranges.
Leave empty to use [pre-installed Bazelisk][8].

Default `1.x`.
Default `""`.

### `bazelrc`

Expand Down Expand Up @@ -124,4 +127,5 @@ However, if you used a `bazel-version` input before, you will need to remove it
[4]: https://bazel.build/run/bazelrc
[5]: https://docs.github.com/en/actions/learn-github-actions/contexts#github-context
[6]: https://github.com/bazelbuild/setup-bazelisk
[7]: https://github.com/bazelbuild/bazelisk/blob/master/README.md#how-does-bazelisk-know-which-bazel-version-to-run
[7]: https://github.com/bazelbuild/bazelisk/blob/master/README.md#how-does-bazelisk-know-which-bazel-version-to-run
[8]: https://github.com/actions/runner-images/pull/490
16 changes: 8 additions & 8 deletions dist/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -96723,33 +96723,33 @@ async function run() {
}

async function setupBazel() {
core.startGroup('Setup Bazelisk')
await setupBazelisk()
core.endGroup()

core.startGroup('Configure Bazel')
console.log('Configuration:')
console.log(JSON.stringify(config, null, 2))

await setupBazelrc()
core.endGroup()

await setupBazelisk()
await restoreCache(config.bazeliskCache)
await restoreCache(config.diskCache)
await restoreCache(config.repositoryCache)
await restoreExternalCaches(config.externalCache)
}

async function setupBazelisk() {
const toolPath = tc.find('bazelisk', config.bazeliskVersion)
if (config.bazeliskVersion.length == 0) {
return
}

core.startGroup('Setup Bazelisk')
const toolPath = tc.find('bazelisk', config.bazeliskVersion)
if (toolPath) {
console.log(`Found in cache @ ${toolPath}`)
return toolPath
} else {
return await downloadBazelisk()
await downloadBazelisk()
}

core.endGroup()
}

async function downloadBazelisk() {
Expand Down
2 changes: 1 addition & 1 deletion dist/main/index.js.map

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,33 +16,33 @@ async function run() {
}

async function setupBazel() {
core.startGroup('Setup Bazelisk')
await setupBazelisk()
core.endGroup()

core.startGroup('Configure Bazel')
console.log('Configuration:')
console.log(JSON.stringify(config, null, 2))

await setupBazelrc()
core.endGroup()

await setupBazelisk()
await restoreCache(config.bazeliskCache)
await restoreCache(config.diskCache)
await restoreCache(config.repositoryCache)
await restoreExternalCaches(config.externalCache)
}

async function setupBazelisk() {
const toolPath = tc.find('bazelisk', config.bazeliskVersion)
if (config.bazeliskVersion.length == 0) {
return
}

core.startGroup('Setup Bazelisk')
const toolPath = tc.find('bazelisk', config.bazeliskVersion)
if (toolPath) {
console.log(`Found in cache @ ${toolPath}`)
return toolPath
} else {
return await downloadBazelisk()
await downloadBazelisk()
}

core.endGroup()
}

async function downloadBazelisk() {
Expand Down

0 comments on commit 2caeed7

Please sign in to comment.