mirror of
https://github.com/AikidoSec/safe-chain.git
synced 2026-05-26 12:10:49 +00:00
Fix safe-chain in CI
This commit is contained in:
parent
9e1bdd4a31
commit
3002d27273
3 changed files with 12 additions and 5 deletions
|
|
@ -19,7 +19,7 @@ param(
|
||||||
[switch]$includepython
|
[switch]$includepython
|
||||||
)
|
)
|
||||||
|
|
||||||
$Version = "v0.0.4-binaries-beta"
|
$Version = "v0.0.5-binaries-beta"
|
||||||
$InstallDir = Join-Path $env:USERPROFILE ".safe-chain\bin"
|
$InstallDir = Join-Path $env:USERPROFILE ".safe-chain\bin"
|
||||||
$RepoUrl = "https://github.com/AikidoSec/safe-chain"
|
$RepoUrl = "https://github.com/AikidoSec/safe-chain"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
set -e # Exit on error
|
set -e # Exit on error
|
||||||
|
|
||||||
# Configuration
|
# Configuration
|
||||||
VERSION="${SAFE_CHAIN_VERSION:-v0.0.4-binaries-beta}"
|
VERSION="${SAFE_CHAIN_VERSION:-v0.0.5-binaries-beta}"
|
||||||
INSTALL_DIR="${HOME}/.safe-chain/bin"
|
INSTALL_DIR="${HOME}/.safe-chain/bin"
|
||||||
REPO_URL="https://github.com/AikidoSec/safe-chain"
|
REPO_URL="https://github.com/AikidoSec/safe-chain"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@ export async function setupCi() {
|
||||||
ui.emptyLine();
|
ui.emptyLine();
|
||||||
|
|
||||||
const shimsDir = path.join(os.homedir(), ".safe-chain", "shims");
|
const shimsDir = path.join(os.homedir(), ".safe-chain", "shims");
|
||||||
|
const binDir = path.join(os.homedir(), ".safe-chain", "shims");
|
||||||
// Create the shims directory if it doesn't exist
|
// Create the shims directory if it doesn't exist
|
||||||
if (!fs.existsSync(shimsDir)) {
|
if (!fs.existsSync(shimsDir)) {
|
||||||
fs.mkdirSync(shimsDir, { recursive: true });
|
fs.mkdirSync(shimsDir, { recursive: true });
|
||||||
|
|
@ -36,7 +37,7 @@ export async function setupCi() {
|
||||||
|
|
||||||
createShims(shimsDir);
|
createShims(shimsDir);
|
||||||
ui.writeInformation(`Created shims in ${shimsDir}`);
|
ui.writeInformation(`Created shims in ${shimsDir}`);
|
||||||
modifyPathForCi(shimsDir);
|
modifyPathForCi(shimsDir, binDir);
|
||||||
ui.writeInformation(`Added shims directory to PATH for CI environments.`);
|
ui.writeInformation(`Added shims directory to PATH for CI environments.`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -130,13 +131,18 @@ function createShims(shimsDir) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} shimsDir
|
* @param {string} shimsDir
|
||||||
|
* @param {string} binDir
|
||||||
*
|
*
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
function modifyPathForCi(shimsDir) {
|
function modifyPathForCi(shimsDir, binDir) {
|
||||||
if (process.env.GITHUB_PATH) {
|
if (process.env.GITHUB_PATH) {
|
||||||
// In GitHub Actions, append the shims directory to GITHUB_PATH
|
// In GitHub Actions, append the shims directory to GITHUB_PATH
|
||||||
fs.appendFileSync(process.env.GITHUB_PATH, shimsDir + os.EOL, "utf-8");
|
fs.appendFileSync(
|
||||||
|
process.env.GITHUB_PATH,
|
||||||
|
shimsDir + os.EOL + binDir + os.EOL,
|
||||||
|
"utf-8"
|
||||||
|
);
|
||||||
ui.writeInformation(
|
ui.writeInformation(
|
||||||
`Added shims directory to GITHUB_PATH for GitHub Actions.`
|
`Added shims directory to GITHUB_PATH for GitHub Actions.`
|
||||||
);
|
);
|
||||||
|
|
@ -147,6 +153,7 @@ function modifyPathForCi(shimsDir) {
|
||||||
// ##vso[task.prependpath]/path/to/add
|
// ##vso[task.prependpath]/path/to/add
|
||||||
// Logging this to stdout will cause the Azure Pipelines agent to pick it up
|
// Logging this to stdout will cause the Azure Pipelines agent to pick it up
|
||||||
ui.writeInformation("##vso[task.prependpath]" + shimsDir);
|
ui.writeInformation("##vso[task.prependpath]" + shimsDir);
|
||||||
|
ui.writeInformation("##vso[task.prependpath]" + binDir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue