Skip to content

Commit 0a3e4b0

Browse files
committed
Expose ghcup binary location
1 parent 64f55f9 commit 0a3e4b0

File tree

7 files changed

+30
-136
lines changed

7 files changed

+30
-136
lines changed

Diff for: README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ jobs:
200200
| `stack-setup-ghc` | If set, `enable-stack` must be set. Runs stack setup to install the specified GHC. (Note: setting this does _not_ imply `stack-no-global`.) | "boolean" | false/unset |
201201
| `disable-matcher` | If set, disables match messages from GHC as GitHub CI annotations. | "boolean" | false/unset |
202202
| `cabal-update` | If set to `false`, skip `cabal update` step. | `boolean` | `true` |
203-
| `ghcup-release-channel` | If set, add a [release channel](https://www.haskell.org/ghcup/guide/#metadata) to ghcup. | `URL` | none |
203+
| `ghcup-release-channel` | If set, add a [release channel](https://www.haskell.org/ghcup/guide/#metadata) to ghcup. | `URL` | none |
204204

205205
Note: "boolean" types are set/unset, not true/false.
206206
That is, setting any "boolean" to a value other than the empty string (`""`) will be considered true/set.
@@ -228,6 +228,7 @@ and `ghc-exe` and `ghc-path` will be set accordingly.
228228
| `stack-path` | The path of the `stack` executable _directory_ | string |
229229
| `cabal-store` | The path to the cabal store | string |
230230
| `stack-root` | The path to the stack root (equal to the `STACK_ROOT` environment variable if it is set; otherwise an OS-specific default) | string |
231+
| `ghcup-command` | The path of the `ghcup` _executable_. Might not be an absolute file path. | string |
231232

232233
## Version Support
233234

Diff for: action.yml

+2
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ outputs:
4545
description: 'The resolved version of stack'
4646
ghc-exe:
4747
description: 'The path of the ghc _executable_'
48+
ghcup-command:
49+
description: 'The path of the ghcup _executable_'
4850
cabal-exe:
4951
description: 'The path of the cabal _executable_'
5052
stack-exe:

Diff for: dist/index.js

+7-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: lib/installer.js

+6-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: lib/setup-haskell.js

-132
This file was deleted.

Diff for: src/installer.ts

+5
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ function failed(tool: Tool, version: string): void {
1818
throw new Error(`All install methods for ${tool} ${version} failed`);
1919
}
2020

21+
export async function configureGhcupOutput(os: OS, arch: Arch): Promise<void> {
22+
const bin = await ghcupBin(os, arch);
23+
core.setOutput('ghcup-command', bin);
24+
}
25+
2126
async function configureOutputs(
2227
tool: Tool,
2328
version: string,

Diff for: src/setup-haskell.ts

+8-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,12 @@ import * as fs from 'fs';
55
import * as path from 'path';
66
import {EOL} from 'os';
77
import {getOpts, getDefaults, Tool} from './opts';
8-
import {addGhcupReleaseChannel, installTool, resetTool} from './installer';
8+
import {
9+
addGhcupReleaseChannel,
10+
configureGhcupOutput,
11+
installTool,
12+
resetTool
13+
} from './installer';
914
import type {Arch, OS} from './opts';
1015
import {exec} from '@actions/exec';
1116

@@ -40,6 +45,8 @@ export default async function run(
4045
core.debug(`run: os = ${JSON.stringify(os)}`);
4146
core.debug(`run: opts = ${JSON.stringify(opts)}`);
4247

48+
await configureGhcupOutput(os, arch);
49+
4350
if (opts.ghcup.releaseChannel) {
4451
await core.group(`Preparing ghcup environment`, async () =>
4552
addGhcupReleaseChannel(opts.ghcup.releaseChannel!, os, arch)

0 commit comments

Comments
 (0)