@actions/core#addPath TypeScript Examples

The following examples show how to use @actions/core#addPath. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: find.ts    From setup-poetry with MIT License 6 votes vote down vote up
export async function findPoetry(inputs: Inputs): Promise<void> {
  // Download get-poetry.py
  const getPoetryPath = await downloadTool(GET_POETRY_URL)

  // Run Poetry installation script
  await exec("python", [getPoetryPath, ...getPoetryInstallArgs(inputs)])

  // Add Poetry executable to the PATH
  const poetryPath = path.join(os.homedir(), ...getPoetryPathArgs())
  addPath(poetryPath)
}
Example #2
Source File: foreman.ts    From setup-foreman with MIT License 6 votes vote down vote up
function addBinDirToPath(): void {
  if (process.platform === "win32") {
    addPath(`${process.env.USERPROFILE}\\.foreman\\bin`);
  } else if (process.platform === "darwin" || process.platform === "linux") {
    addPath(`${process.env.HOME}/.foreman/bin`);
  } else {
    throw new Error(`Unsupported platform "${process.platform}"`);
  }
}
Example #3
Source File: minikube.ts    From setup-minikube with MIT License 6 votes vote down vote up
export async function downloadMinikube(version: string): Promise<void> {
  const url = getDownloadUrl(version)
  const downloadPath = await downloadTool(url)
  const binPath =
    getPlatform() === 'darwin' ? '/Users/runner/bin' : '/home/runner/bin'
  await mkdirP(binPath)
  await exec('chmod', ['+x', downloadPath])
  await mv(downloadPath, join(binPath, 'minikube'))
  addPath(binPath)
}
Example #4
Source File: main.ts    From setup-foreman with MIT License 5 votes vote down vote up
async function run(): Promise<void> {
  try {
    const versionReq: string = getInput("version");
    const githubToken: string = getInput("token");
    const workingDir: string = getInput("working-directory");

    const octokit = new GitHub(githubToken);
    const releases = await foreman.getReleases(octokit);

    debug("Choosing release from GitHub API");

    const release = foreman.chooseRelease(versionReq, releases);
    if (release == null) {
      throw new Error(
        `Could not find Foreman release for version ${versionReq}`
      );
    }

    debug(`Chose release ${release.tag_name}`);

    const asset = foreman.chooseAsset(release);
    if (asset == null) {
      throw new Error(
        `Could not find asset for version ${release.tag_name} on platform ${process.platform}`
      );
    }

    debug(`Chose release asset ${asset.browser_download_url}`);

    const zipPath = await downloadTool(asset.browser_download_url);
    const extractedPath = await extractZip(zipPath, ".foreman-install");
    addPath(resolve(extractedPath));

    if (process.platform === "darwin" || process.platform === "linux") {
      await exec("chmod +x .foreman-install/foreman");
    }

    await foreman.authenticate(githubToken);
    foreman.addBinDirToPath();

    if (workingDir !== undefined && workingDir !== null && workingDir !== "") {
      process.chdir(workingDir);
    }
    await foreman.installTools();
  } catch (error) {
    if (error instanceof Error) {
      setFailed(error.message);
    }
  }
}