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

Commit b28505f

Browse files
committed
Add stack-root output
1 parent 7604fca commit b28505f

File tree

5 files changed

+29
-10
lines changed

5 files changed

+29
-10
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ jobs:
118118
| `cabal-store` | The path to the cabal store | string |
119119
| `stack-path` | The path of the stack executable _directory_ | string |
120120
| `stack-exe` | The path of the stack _executable_ | string |
121+
| `stack-root` | The path to the stack root | string |
121122

122123
## Version Support
123124

action.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ outputs:
3838
description: 'The path of the stack executable _directory_'
3939
stack-exe:
4040
description: 'The path of the stack _executable_'
41+
stack-root:
42+
description: 'The path to the stack root'
4143
runs:
4244
using: 'node12'
4345
main: 'dist/index.js'

dist/action.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,20 @@ inputs:
2626
outputs:
2727
ghc-path:
2828
description: 'The path of the ghc executable _directory_'
29-
cabal-path:
30-
description: 'The path of the cabal executable _directory_'
31-
stack-path:
32-
description: 'The path of the stack executable _directory_'
33-
cabal-store:
34-
description: 'The path to the cabal store'
3529
ghc-exe:
3630
description: 'The path of the ghc _executable_'
31+
cabal-path:
32+
description: 'The path of the cabal executable _directory_'
3733
cabal-exe:
3834
description: 'The path of the cabal _executable_'
35+
cabal-store:
36+
description: 'The path to the cabal store'
37+
stack-path:
38+
description: 'The path of the stack executable _directory_'
3939
stack-exe:
4040
description: 'The path of the stack _executable_'
41+
stack-root:
42+
description: 'The path to the stack root'
4143
runs:
4244
using: 'node12'
4345
main: 'dist/index.js'

dist/index.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8728,7 +8728,15 @@ async function cabalConfig() {
87288728
for (const [t, { resolved }] of Object.entries(opts).filter(o => o[1].enable))
87298729
await core.group(`Installing ${t} version ${resolved}`, async () => installer_1.installTool(t, resolved, process.platform));
87308730
if (opts.stack.setup)
8731-
await core.group('Pre-installing GHC with stack', async () => exec_1.exec('stack', ['setup', opts.ghc.resolved]));
8731+
await core.group('Pre-installing GHC with stack', async () => {
8732+
await exec_1.exec('stack', ['setup', opts.ghc.resolved]);
8733+
if (process.platform === 'win32') {
8734+
core.setOutput('stack-root', 'C:\\sr');
8735+
}
8736+
else {
8737+
core.setOutput('stack-root', `${process.env.HOME}/.stack`);
8738+
}
8739+
});
87328740
if (opts.cabal.enable)
87338741
await core.group('Setting up cabal', async () => {
87348742
await exec_1.exec('cabal', ['user-config', 'update'], { silent: true });

src/setup-haskell.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,15 @@ async function cabalConfig(): Promise<string> {
2626
);
2727

2828
if (opts.stack.setup)
29-
await core.group('Pre-installing GHC with stack', async () =>
30-
exec('stack', ['setup', opts.ghc.resolved])
31-
);
29+
await core.group('Pre-installing GHC with stack', async () => {
30+
await exec('stack', ['setup', opts.ghc.resolved]);
31+
32+
if (process.platform === 'win32') {
33+
core.setOutput('stack-root', 'C:\\sr');
34+
} else {
35+
core.setOutput('stack-root', `${process.env.HOME}/.stack`);
36+
}
37+
});
3238

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

0 commit comments

Comments
 (0)