Skip to content
This repository has been archived by the owner on Dec 12, 2020. It is now read-only.

Commit

Permalink
Add stack-root output
Browse files Browse the repository at this point in the history
  • Loading branch information
avh4 committed Sep 12, 2020
1 parent 7604fca commit b28505f
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 10 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ jobs:
| `cabal-store` | The path to the cabal store | string |
| `stack-path` | The path of the stack executable _directory_ | string |
| `stack-exe` | The path of the stack _executable_ | string |
| `stack-root` | The path to the stack root | string |

## Version Support

Expand Down
2 changes: 2 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ outputs:
description: 'The path of the stack executable _directory_'
stack-exe:
description: 'The path of the stack _executable_'
stack-root:
description: 'The path to the stack root'
runs:
using: 'node12'
main: 'dist/index.js'
14 changes: 8 additions & 6 deletions dist/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,20 @@ inputs:
outputs:
ghc-path:
description: 'The path of the ghc executable _directory_'
cabal-path:
description: 'The path of the cabal executable _directory_'
stack-path:
description: 'The path of the stack executable _directory_'
cabal-store:
description: 'The path to the cabal store'
ghc-exe:
description: 'The path of the ghc _executable_'
cabal-path:
description: 'The path of the cabal executable _directory_'
cabal-exe:
description: 'The path of the cabal _executable_'
cabal-store:
description: 'The path to the cabal store'
stack-path:
description: 'The path of the stack executable _directory_'
stack-exe:
description: 'The path of the stack _executable_'
stack-root:
description: 'The path to the stack root'
runs:
using: 'node12'
main: 'dist/index.js'
10 changes: 9 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8728,7 +8728,15 @@ async function cabalConfig() {
for (const [t, { resolved }] of Object.entries(opts).filter(o => o[1].enable))
await core.group(`Installing ${t} version ${resolved}`, async () => installer_1.installTool(t, resolved, process.platform));
if (opts.stack.setup)
await core.group('Pre-installing GHC with stack', async () => exec_1.exec('stack', ['setup', opts.ghc.resolved]));
await core.group('Pre-installing GHC with stack', async () => {
await exec_1.exec('stack', ['setup', opts.ghc.resolved]);
if (process.platform === 'win32') {
core.setOutput('stack-root', 'C:\\sr');
}
else {
core.setOutput('stack-root', `${process.env.HOME}/.stack`);
}
});
if (opts.cabal.enable)
await core.group('Setting up cabal', async () => {
await exec_1.exec('cabal', ['user-config', 'update'], { silent: true });
Expand Down
12 changes: 9 additions & 3 deletions src/setup-haskell.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,15 @@ async function cabalConfig(): Promise<string> {
);

if (opts.stack.setup)
await core.group('Pre-installing GHC with stack', async () =>
exec('stack', ['setup', opts.ghc.resolved])
);
await core.group('Pre-installing GHC with stack', async () => {
await exec('stack', ['setup', opts.ghc.resolved]);

if (process.platform === 'win32') {
core.setOutput('stack-root', 'C:\\sr');
} else {
core.setOutput('stack-root', `${process.env.HOME}/.stack`);
}
});

if (opts.cabal.enable)
await core.group('Setting up cabal', async () => {
Expand Down

0 comments on commit b28505f

Please sign in to comment.