Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the bin directory under the local switch to the system path #130

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ and this project adheres to

## [unreleased]

### Added

- The bin directory under the local switch is now added to the system path.

### Changed

- Use the week number to manage Cygwin cache.
Expand Down
10 changes: 10 additions & 0 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions dist/post/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions src/installer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
import { installDepext, installSystemPackages } from "./depext";
import { installDune } from "./dune";
import {
exposeOpamBinPath,
installOcaml,
pin,
repositoryAddAll,
Expand Down Expand Up @@ -145,6 +146,7 @@ export async function installer(): Promise<void> {
await installSystemPackages(fnames);
}
}
exposeOpamBinPath();
await exec("opam", ["--version"]);
await exec("opam", ["depext", "--version"]);
await exec("opam", ["exec", "--", "ocaml", "-version"]);
Expand Down
11 changes: 11 additions & 0 deletions src/opam.ts
Original file line number Diff line number Diff line change
Expand Up @@ -369,3 +369,14 @@ export async function repositoryRemoveAll(): Promise<void> {
}
core.endGroup();
}

export function exposeOpamBinPath(): void {
core.startGroup(
"Add the bin directory under the local switch to the system path"
);
const githubWorkspace = process.env.GITHUB_WORKSPACE ?? process.cwd();
const opamBinPath = path.join(githubWorkspace, "_opam", "bin");
core.addPath(opamBinPath);
core.info(`Added ${opamBinPath} to the system path`);
core.endGroup();
}