Skip to content
This repository was archived by the owner on Apr 11, 2024. It is now read-only.

Commit 696e13a

Browse files
authored
Merge pull request #58 from philprime/main
Fixed GitHub Action
2 parents a8376e9 + 0e1dcde commit 696e13a

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

action.js

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ const path = require('path')
44
const artifact = require('././.action/artifact')
55
const fs = require('fs')
66

7-
const scxVersion = '2.1.0'
7+
const scxVersion = 'v2.1.0'
88
const outputPath = '.build/xcframework-zipfile.url'
99

1010
core.setCommandEcho(true)
1111

12-
async function run () {
12+
async function run() {
1313
try {
1414
let packagePath = core.getInput('path', { required: false })
1515
let targets = core.getInput('target', { required: false })
@@ -24,7 +24,7 @@ async function run () {
2424
await installUsingMintIfRequired('swift-create-xcframework', 'unsignedapps/swift-create-xcframework')
2525

2626
// put together our options
27-
var options = [ '--zip', '--github-action' ]
27+
var options = ['--zip', '--github-action']
2828
if (!!packagePath) {
2929
options.push('--package-path')
3030
options.push(packagePath)
@@ -60,7 +60,7 @@ async function run () {
6060
})
6161
}
6262

63-
await exec.exec('swift-create-xcframework', options)
63+
await runUsingMint('swift-create-xcframework', options)
6464

6565
let client = artifact.create()
6666
let files = fs.readFileSync(outputPath, { encoding: 'utf8' })
@@ -70,36 +70,40 @@ async function run () {
7070
for (var i = 0, c = files.length; i < c; i++) {
7171
let file = files[i]
7272
let name = path.basename(file)
73-
await client.uploadArtifact(name, [ file ], path.dirname(file))
73+
await client.uploadArtifact(name, [file], path.dirname(file))
7474
}
7575

7676
} catch (error) {
7777
core.setFailed(error)
7878
}
7979
}
8080

81-
async function installUsingBrewIfRequired (package) {
81+
async function installUsingBrewIfRequired(package) {
8282
if (await isInstalled(package)) {
8383
core.info(package + " is already installed.")
8484

8585
} else {
8686
core.info("Installing " + package)
87-
await exec.exec('brew', [ 'install', package ])
87+
await exec.exec('brew', ['install', package])
8888
}
8989
}
9090

91-
async function installUsingMintIfRequired (command, package) {
91+
async function installUsingMintIfRequired(command, package) {
9292
if (await isInstalled(command)) {
9393
core.info(command + " is already installed")
9494

9595
} else {
9696
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])
9898
}
9999
}
100100

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])
103107
}
104108

105109
run()

0 commit comments

Comments
 (0)