Skip to content

Commit 8c8d007

Browse files
Support latest-nightly
1 parent 6c02044 commit 8c8d007

File tree

5 files changed

+46
-19
lines changed

5 files changed

+46
-19
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ E.g., `8.10` will be resolved to `8.10.7`, and so will `8`.
236236

237237
**GHC:**
238238

239+
- `latest-nightly`
239240
- `latest` (default)
240241
- `9.6.2` `9.6`
241242
- `9.6.1`

action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ author: 'GitHub'
44
inputs:
55
ghc-version:
66
required: false
7-
description: 'Version of GHC to use. If set to "latest", it will always get the latest stable version.'
7+
description: 'Version of GHC to use. If set to "latest", it will always get the latest stable version. If set to "latest-nightly", it will always get the latest nightly version of GHC'
88
default: 'latest'
99
cabal-version:
1010
required: false

dist/index.js

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13436,12 +13436,21 @@ async function installTool(tool, version, os) {
1343613436
}
1343713437
switch (os) {
1343813438
case 'linux':
13439-
if (tool === 'ghc' && (0, compare_versions_1.compareVersions)('8.3', version)) {
13440-
// Andreas, 2022-12-09: The following errors out if we are not ubuntu-20.04.
13441-
// Atm, I do not know how to check whether we are on ubuntu-20.04.
13442-
// So, ignore the error.
13443-
// if (!(await aptLibCurses5())) break;
13444-
await aptLibNCurses5();
13439+
if (tool === 'ghc') {
13440+
if (version === 'latest-nightly') {
13441+
await exec(await ghcupBin(os), [
13442+
'config',
13443+
'add-release-channel',
13444+
'https://ghc.gitlab.haskell.org/ghcup-metadata/ghcup-nightlies-0.0.7.yaml'
13445+
]);
13446+
}
13447+
else if ((0, compare_versions_1.compareVersions)('8.3', version)) {
13448+
// Andreas, 2022-12-09: The following errors out if we are not ubuntu-20.04.
13449+
// Atm, I do not know how to check whether we are on ubuntu-20.04.
13450+
// So, ignore the error.
13451+
// if (!(await aptLibCurses5())) break;
13452+
await aptLibNCurses5();
13453+
}
1344513454
}
1344613455
await ghcup(tool, version, os);
1344713456
if (await isInstalled(tool, version, os))

lib/installer.js

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -155,12 +155,21 @@ async function installTool(tool, version, os) {
155155
}
156156
switch (os) {
157157
case 'linux':
158-
if (tool === 'ghc' && (0, compare_versions_1.compareVersions)('8.3', version)) {
159-
// Andreas, 2022-12-09: The following errors out if we are not ubuntu-20.04.
160-
// Atm, I do not know how to check whether we are on ubuntu-20.04.
161-
// So, ignore the error.
162-
// if (!(await aptLibCurses5())) break;
163-
await aptLibNCurses5();
158+
if (tool === 'ghc') {
159+
if (version === 'latest-nightly') {
160+
await exec(await ghcupBin(os), [
161+
'config',
162+
'add-release-channel',
163+
'https://ghc.gitlab.haskell.org/ghcup-metadata/ghcup-nightlies-0.0.7.yaml'
164+
]);
165+
}
166+
else if ((0, compare_versions_1.compareVersions)('8.3', version)) {
167+
// Andreas, 2022-12-09: The following errors out if we are not ubuntu-20.04.
168+
// Atm, I do not know how to check whether we are on ubuntu-20.04.
169+
// So, ignore the error.
170+
// if (!(await aptLibCurses5())) break;
171+
await aptLibNCurses5();
172+
}
164173
}
165174
await ghcup(tool, version, os);
166175
if (await isInstalled(tool, version, os))

src/installer.ts

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -165,12 +165,20 @@ export async function installTool(
165165

166166
switch (os) {
167167
case 'linux':
168-
if (tool === 'ghc' && compareVersions('8.3', version)) {
169-
// Andreas, 2022-12-09: The following errors out if we are not ubuntu-20.04.
170-
// Atm, I do not know how to check whether we are on ubuntu-20.04.
171-
// So, ignore the error.
172-
// if (!(await aptLibCurses5())) break;
173-
await aptLibNCurses5();
168+
if (tool === 'ghc') {
169+
if (version === 'latest-nightly') {
170+
await exec(await ghcupBin(os), [
171+
'config',
172+
'add-release-channel',
173+
'https://ghc.gitlab.haskell.org/ghcup-metadata/ghcup-nightlies-0.0.7.yaml'
174+
]);
175+
} else if (compareVersions('8.3', version)) {
176+
// Andreas, 2022-12-09: The following errors out if we are not ubuntu-20.04.
177+
// Atm, I do not know how to check whether we are on ubuntu-20.04.
178+
// So, ignore the error.
179+
// if (!(await aptLibCurses5())) break;
180+
await aptLibNCurses5();
181+
}
174182
}
175183
await ghcup(tool, version, os);
176184
if (await isInstalled(tool, version, os)) return;

0 commit comments

Comments
 (0)