Skip to content

Commit 7ffa8af

Browse files
committed
Support Linux (amd64 only for now)
1 parent fdc2695 commit 7ffa8af

File tree

3 files changed

+47
-21
lines changed

3 files changed

+47
-21
lines changed

dist/index.js

Lines changed: 20 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main.ts

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,37 @@ export async function run(): Promise<void> {
1919
try {
2020
const version: string = core.getInput('version')
2121

22-
// Fail the workflow run if we're not running on macOS
23-
if (process.platform !== 'darwin') {
24-
core.setFailed(
25-
`Unsupported OS "${process.platform}, only "darwin" is currently supported`
26-
)
27-
28-
return
29-
}
30-
3122
// Determine the asset URL
3223
let url: string
3324

3425
if (version !== 'latest') {
35-
url = `https://github.com/realm/SwiftLint/releases/download/${version}/portable_swiftlint.zip`
26+
url = `https://github.com/realm/SwiftLint/releases/download/${version}/`
3627
} else {
37-
url =
38-
'https://github.com/realm/SwiftLint/releases/latest/download/portable_swiftlint.zip'
28+
url = 'https://github.com/realm/SwiftLint/releases/latest/download/'
29+
}
30+
31+
if (process.platform === 'darwin') {
32+
// SwiftLint's binaries for Darwin are universal
33+
url += 'portable_swiftlint.zip'
34+
} else if (process.platform === 'linux') {
35+
// SwiftLint's binaries for Linux are x64-only[1]
36+
//
37+
// [1]: https://github.com/realm/SwiftLint/issues/4531
38+
if (process.arch === 'x64') {
39+
core.setFailed(
40+
`Unsupported Linux architecture "${process.arch}", only "x64" is currently supported`
41+
)
42+
43+
return
44+
}
45+
46+
url += 'swiftlint_linux.zip'
47+
} else {
48+
core.setFailed(
49+
`Unsupported OS "${process.platform}", only "darwin" and "linux" are currently supported`
50+
)
51+
52+
return
3953
}
4054

4155
// Retrieve the SwiftLint binary from the tool cache

0 commit comments

Comments
 (0)