Skip to content

Commit 44f4367

Browse files
Set swift-sdk-id output
1 parent ce0d57c commit 44f4367

File tree

6 files changed

+16
-2
lines changed

6 files changed

+16
-2
lines changed

.github/workflows/test.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,9 @@ jobs:
3939
echo "TOOLCHAINS=$TOOLCHAINS" >> $GITHUB_ENV
4040
- run: swift --version
4141
- uses: ./
42+
id: setup-swiftwasm
4243
- run: |
4344
mkdir -p /tmp/hello
4445
cd /tmp/hello
4546
swift package init --type executable
46-
swift build --swift-sdk wasm32-unknown-wasi
47+
swift build --swift-sdk "${{ steps.setup-swiftwasm.outputs.swift-sdk-id }}"

README.md

+6
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,9 @@ To install a Swift SDK for other targets, add the following to your workflow fil
3838
|-------|---------|-------------|
3939
| `tag` | The version of `swift` found in the PATH. | The tag name of swiftlang/swift repository to download the Swift SDK compatible with. |
4040
| `target` | `wasm32-unknown-wasi` | The target to install the Swift SDK for. |
41+
42+
## Outputs
43+
44+
| Output | Description |
45+
|-------|-------------|
46+
| `swift-sdk-id` | The ID of the installed Swift SDK. You can pass this to `--swift-sdk` option of `swift build` command. |

action.yml

+5
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ inputs:
1616
For example, `wasm32-unknown-wasi` or `wasm32-unknown-wasip1-threads`.
1717
required: false
1818
default: 'wasm32-unknown-wasi'
19+
outputs:
20+
swift-sdk-id:
21+
description: >
22+
The ID of the installed Swift SDK.
23+
You can pass this to `--swift-sdk` option of `swift build` command.
1924
runs:
2025
using: 'node20'
2126
main: 'dist/index.js'

dist/index.js

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

index.js

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export async function run() {
88
const target = core.getInput("target");
99
const sdk = swiftSDKInfo["swift-sdks"][target];
1010
await installSwiftSDK(sdk.url, sdk.checksum);
11+
core.setOutput("swift-sdk-id", sdk.id);
1112
}
1213

1314
/** @returns {Promise<string>} */

0 commit comments

Comments
 (0)