File tree Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change 1- import { addPath , debug , info } from "@actions/core" ;
1+ import { addPath , debug , exportVariable , info } from "@actions/core" ;
22import { cmd } from "../core" ;
3+ import { mkdtempSync } from "fs" ;
4+ import path from "path" ;
5+
36
47async function swiftly ( ...args : string [ ] ) {
58 return await cmd ( "swiftly" , ...args ) ;
69}
710
11+ function setupPaths ( ) {
12+ const tmpPath = mkdtempSync ( `swiftly` ) ;
13+
14+ const homeDir = process . env . SWIFTLY_HOME_DIR || path . join ( tmpPath , "home" ) ;
15+ const binDir = process . env . SWIFTLY_BIN_DIR || path . join ( tmpPath , "bin" ) ;
16+
17+ exportVariable ( 'SWIFTLY_HOME_DIR' , homeDir ) ;
18+ exportVariable ( 'SWIFTLY_BIN_DIR' , binDir ) ;
19+
20+ addPath ( binDir ) ;
21+
22+ debug ( `Using Swiftly home dir: ${ homeDir } ` ) ;
23+ debug ( `Using Swiftly bin dir: ${ binDir } ` ) ;
24+ }
25+
826/**
927 * Install Swift using Swiftly
1028 * @param version Version to install
1129 */
1230export async function installSwift ( version : string ) {
31+ setupPaths ( ) ;
32+
1333 info ( "Initializing Swiftly" ) ;
1434 await swiftly (
1535 "init" ,
You can’t perform that action at this time.
0 commit comments