Skip to content

Commit 5f7f9ea

Browse files
committed
Simplify Windows installation
after crystal-lang/crystal#11494
1 parent a9687f2 commit 5f7f9ea

File tree

3 files changed

+17
-35
lines changed

3 files changed

+17
-35
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ jobs:
4646
crystal eval 'puts "test" + "ing"' | grep 'testing'
4747
- run: |
4848
'${{ steps.install.outputs.path }}/bin/crystal' --version
49+
if: ${{ runner.os != 'Windows' }}
4950
- run: |
5051
ls '${{ steps.install.outputs.path }}/src/prelude.cr'
5152
- run: |

.github/workflows/release.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ jobs:
4646
crystal eval 'puts "test" + "ing"' | grep 'testing'
4747
- run: |
4848
'${{ steps.install.outputs.path }}/bin/crystal' --version
49+
if: ${{ runner.os != 'Windows' }}
4950
- run: |
5051
ls '${{ steps.install.outputs.path }}/src/prelude.cr'
5152
- run: |

index.js

Lines changed: 15 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -358,22 +358,10 @@ async function installCrystalForWindows({crystal, arch = "x86_64", path}) {
358358

359359
Core.info("Setting up environment for Crystal");
360360
const vars = await variablesForVCBuildTools();
361-
addPathToVars(vars, "PATH", Path.join(path, "bin"));
362-
addPathToVars(vars, "LIB", Path.join(path, "bin"));
363-
addPathToVars(vars, "CRYSTAL_PATH", Path.join(path, "src"));
364-
addPathToVars(vars, "CRYSTAL_PATH", "lib");
365361
for (const [k, v] of vars.entries()) {
366362
Core.exportVariable(k, v);
367363
}
368-
}
369-
370-
function addPathToVars(vars, key, value) {
371-
for (const [k, v] of vars.entries()) {
372-
if (k.toLowerCase() === key.toLowerCase()) {
373-
return vars.set(k, value + Path.delimiter + v);
374-
}
375-
}
376-
return vars.set(key, value);
364+
Core.addPath(path);
377365
}
378366

379367
const outputSep = "---";
@@ -419,28 +407,20 @@ async function downloadCrystalNightlyForWindows() {
419407
Core.info(`Found Crystal release ${workflowRun["html_url"]}`);
420408
Core.setOutput("crystal", ref);
421409

422-
const fetchSrcTask = downloadSource({name: "Crystal", apiBase: GitHubApiBase, ref});
423-
const fetchExeTask = (async () => {
424-
const artifactsResp = await githubGet({
425-
url: GitHubApiBase + "/actions/runs/:run_id/artifacts",
426-
"run_id": runId,
427-
});
428-
const artifact = artifactsResp.data["artifacts"].find((x) => x.name === "crystal");
429-
430-
Core.info("Downloading Crystal build");
431-
const downloadedPath = await githubDownloadViaRedirect({
432-
url: GitHubApiBase + "/actions/artifacts/:artifact_id/zip",
433-
"artifact_id": artifact.id,
434-
});
435-
436-
Core.info("Extracting Crystal build");
437-
return ToolCache.extractZip(downloadedPath);
438-
})();
439-
440-
const path = await fetchSrcTask;
441-
await IO.rmRF(Path.join(path, "bin"));
442-
await IO.mv(await fetchExeTask, Path.join(path, "bin"));
443-
return path;
410+
const artifactsResp = await githubGet({
411+
url: GitHubApiBase + "/actions/runs/:run_id/artifacts",
412+
"run_id": runId,
413+
});
414+
const artifact = artifactsResp.data["artifacts"].find((x) => x.name === "crystal");
415+
416+
Core.info("Downloading Crystal build");
417+
const downloadedPath = await githubDownloadViaRedirect({
418+
url: GitHubApiBase + "/actions/artifacts/:artifact_id/zip",
419+
"artifact_id": artifact.id,
420+
});
421+
422+
Core.info("Extracting Crystal build");
423+
return ToolCache.extractZip(downloadedPath);
444424
}
445425

446426
function githubGet(request) {

0 commit comments

Comments
 (0)