foundry-toolchain
foundry-toolchain copied to clipboard
Feature: Support for Feature/Beta Builds
Support development builds
Foundry would have to add an additional identifier in its versioning to distinguish between nightly proper and dev/pr builds like
0.2.0-pr-47126-18
Also it would only work on branches in the main repo, not PR's (I think)
Something along the lines of this:
import * as core from '@actions/core'
import * as tc from '@actions/tool-cache'
async function run(): Promise<void> {
try {
const toolDir = tc.find('platform-', 'nightly-', 'x64')
if (toolDir !== '') {
core.addPath(toolDir)
return
}
const channel = core.getInput('channel')
// TODO: use feature/branch, github PR# for channels
if (!['nightly', 'edge', 'pr#', 'beta', ''].includes(channel)) {
core.setFailed(`Unknown release channel ${channel}`)
return
}
switch (process.platform) {
case 'darwin': {
let toolUrl =
'https://nightly--darwin-amd64.zip'
if (channel === 'beta') {
toolUrl =
'https://edge-darwin-amd64.zip'
}
const downloadPath = await tc.downloadTool(toolUrl)
const extPath = await tc.extractZip(downloadPath)
const cachedPath = await tc.cacheDir(extPath, 'release-', 'nightly-')
core.addPath(cachedPath)
break
}
case 'linux': {
let toolUrl =
'https://nightly-linux-amd64.tar.gz'
if (channel === 'beta') {
toolUrl =
'https://edge-linux-amd64.tar.gz'
}
const downloadPath = await tc.downloadTool(toolUrl)
const extPath = await tc.extractTar(downloadPath)
const cachedPath = await tc.cacheDir(extPath, 'release-', 'nightly-')
core.addPath(cachedPath)
break
}
default: {
core.setFailed(`Unsupported platform: ${process.platform}`)
}
}
} catch (error) {
core.setFailed(error.message)
}
}
run()