@@ -4,12 +4,12 @@ const path = require('path')
4
4
const artifact = require ( '././.action/artifact' )
5
5
const fs = require ( 'fs' )
6
6
7
- const scxVersion = '2 .1.0'
7
+ const scxVersion = 'v2 .1.0'
8
8
const outputPath = '.build/xcframework-zipfile.url'
9
9
10
10
core . setCommandEcho ( true )
11
11
12
- async function run ( ) {
12
+ async function run ( ) {
13
13
try {
14
14
let packagePath = core . getInput ( 'path' , { required : false } )
15
15
let targets = core . getInput ( 'target' , { required : false } )
@@ -24,7 +24,7 @@ async function run () {
24
24
await installUsingMintIfRequired ( 'swift-create-xcframework' , 'unsignedapps/swift-create-xcframework' )
25
25
26
26
// put together our options
27
- var options = [ '--zip' , '--github-action' ]
27
+ var options = [ '--zip' , '--github-action' ]
28
28
if ( ! ! packagePath ) {
29
29
options . push ( '--package-path' )
30
30
options . push ( packagePath )
@@ -60,7 +60,7 @@ async function run () {
60
60
} )
61
61
}
62
62
63
- await exec . exec ( 'swift-create-xcframework' , options )
63
+ await runUsingMint ( 'swift-create-xcframework' , options )
64
64
65
65
let client = artifact . create ( )
66
66
let files = fs . readFileSync ( outputPath , { encoding : 'utf8' } )
@@ -70,36 +70,40 @@ async function run () {
70
70
for ( var i = 0 , c = files . length ; i < c ; i ++ ) {
71
71
let file = files [ i ]
72
72
let name = path . basename ( file )
73
- await client . uploadArtifact ( name , [ file ] , path . dirname ( file ) )
73
+ await client . uploadArtifact ( name , [ file ] , path . dirname ( file ) )
74
74
}
75
75
76
76
} catch ( error ) {
77
77
core . setFailed ( error )
78
78
}
79
79
}
80
80
81
- async function installUsingBrewIfRequired ( package ) {
81
+ async function installUsingBrewIfRequired ( package ) {
82
82
if ( await isInstalled ( package ) ) {
83
83
core . info ( package + " is already installed." )
84
84
85
85
} else {
86
86
core . info ( "Installing " + package )
87
- await exec . exec ( 'brew' , [ 'install' , package ] )
87
+ await exec . exec ( 'brew' , [ 'install' , package ] )
88
88
}
89
89
}
90
90
91
- async function installUsingMintIfRequired ( command , package ) {
91
+ async function installUsingMintIfRequired ( command , package ) {
92
92
if ( await isInstalled ( command ) ) {
93
93
core . info ( command + " is already installed" )
94
94
95
95
} else {
96
96
core . info ( "Installing " + package )
97
- await exec . exec ( 'mint' , [ 'install' , 'unsignedapps/swift-create-xcframework@' + scxVersion ] )
97
+ await exec . exec ( 'mint' , [ 'install' , 'unsignedapps/swift-create-xcframework@' + scxVersion ] )
98
98
}
99
99
}
100
100
101
- async function isInstalled ( command ) {
102
- return await exec . exec ( 'which' , [ command ] , { silent : true , failOnStdErr : false , ignoreReturnCode : true } ) == 0
101
+ async function isInstalled ( command ) {
102
+ return await exec . exec ( 'which' , [ command ] , { silent : true , failOnStdErr : false , ignoreReturnCode : true } ) == 0
103
+ }
104
+
105
+ async function runUsingMint ( command , options ) {
106
+ await exec . exec ( 'mint' , [ 'run' , command , ...options ] )
103
107
}
104
108
105
109
run ( )
0 commit comments