Skip to content

Commit 6377828

Browse files
committed
Refactored to also output platform-short and workspace-path
1 parent 99222a8 commit 6377828

3 files changed

Lines changed: 34 additions & 22 deletions

File tree

action.yml

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,18 @@ inputs:
2424
required: false
2525

2626
outputs:
27-
destination-platform:
28-
description: "Platform"
29-
value: ${{ steps.parse-inputs.outputs.parsed-platform }}
30-
destination-id:
31-
description: "Simulator ID"
27+
id:
28+
description: "Destination Simulator ID"
3229
value: ${{ steps.id-finder.outputs.id }}
30+
platform:
31+
description: "Destination Platform"
32+
value: ${{ steps.id-finder.outputs.platform }}
33+
platform-short:
34+
description: "Platform (Short)"
35+
value: ${{ steps.id-finder.outputs.platform-short }}
36+
workspace-path:
37+
description: "Xcode workspace path relative to repo root"
38+
value: ${{ steps.id-finder.outputs.workspace-path }}
3339

3440
runs:
3541
using: "composite"
@@ -82,9 +88,11 @@ runs:
8288
SIMDEVICE_REGEX: ${{ steps.parse-inputs.outputs.parsed-device-regex }}
8389
OSVERSION_REGEX: ${{ steps.parse-inputs.outputs.parsed-os-version-regex }}
8490
# outputs:
85-
# destination-platform
86-
# destination-id
87-
91+
# id
92+
# platform
93+
# platform-short
94+
# workspace-path
95+
8896
branding:
8997
icon: 'code'
9098
color: 'blue'

scripts/id.sh

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
# - https://docs.github.com/en/actions/how-tos/create-and-publish-actions/set-exit-codes
1111

1212
# Inputs:
13-
# - WORKSPACEPATH optional
13+
# - WORKSPACEPATH required
1414
# - SCHEME required
1515
# - SIMPLATFORM required
1616
# - SIMPLATFORM_SHORT required
@@ -19,8 +19,10 @@
1919
# - OSVERSION_REGEX optional
2020

2121
# Step outputs produced:
22-
# - destination-platform Platform string (ie: "iOS Simulator") which can be used verbatim in `xcodebuild destination="platform=X"` in place of X
23-
# - destination-id ID string (ie: "17FC425F-F336-48DC-8D5A-05DA7BCF7B7D") which can be used verbatim in `xcodebuild destination="id=X"` in place of X
22+
# - id
23+
# - platform
24+
# - platform-short
25+
# - workspace-path
2426

2527
# Note that validation of variables is skipped in this script, as validation already occurred
2628
# in the action step that runs parse-inputs.sh.
@@ -60,5 +62,7 @@ if [[ -z $DESTID ]]; then echo "⛔️ Error: No matching simulators available."
6062
echo "🟢 Found device simulator: $DESTDESC"
6163

6264
# Set output variable.
63-
echo "destination-platform=$(echo $SIMPLATFORM)" >> $GITHUB_OUTPUT
64-
echo "destination-id=$(echo $DESTID)" >> $GITHUB_OUTPUT
65+
echo "id=$(echo $DESTID)" >> $GITHUB_OUTPUT
66+
echo "platform=$(echo $SIMPLATFORM)" >> $GITHUB_OUTPUT
67+
echo "platform-short=$(echo $SIMPLATFORM_SHORT)" >> $GITHUB_OUTPUT
68+
echo "workspace-path=$(echo $WORKSPACEPATH)" >> $GITHUB_OUTPUT

scripts/parse-inputs.sh

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77
# - INPUT_OSVERSION optional
88

99
# Step outputs produced:
10-
# - parsed-workspace-path Relative path to .xcworkspace file from repo root
11-
# - parsed-scheme Xcode scheme name
10+
# - parsed-device-regex Device name regex used when parsing simulator list output from `xcodebuild -showdestinations`
11+
# - parsed-os-version-regex OS version regex used when parsing simulator list output from `xcodebuild -showdestinations` (Optional)
1212
# - parsed-platform Platform string (ie: "iOS Simulator") which can be used verbatim in `xcodebuild destination="platform=X"` in place of X
1313
# - parsed-platform-short Platform short name (ie: "iOS")
14-
# - parsed-platform-regex Platform name regex used when parsing simulator list output from `xcodebuild -showdestinations``
15-
# - parsed-device-regex
16-
# - parsed-os-version-regex
14+
# - parsed-platform-regex Platform name regex used when parsing simulator list output from `xcodebuild -showdestinations`
15+
# - parsed-scheme Xcode scheme name
16+
# - parsed-workspace-path Relative path to .xcworkspace file from repo root
1717

1818
# Setup workspace path.
1919
if [[ -z $INPUT_WORKSPACEPATH ]]; then
@@ -200,10 +200,10 @@ echo "Using platform name regex: $SIMPLATFORM_REGEX"
200200
echo "Using device name regex: $SIMDEVICE_REGEX"
201201

202202
# Set output variables.
203-
echo "parsed-workspace-path=$(echo $WORKSPACEPATH)" >> $GITHUB_OUTPUT
204-
echo "parsed-scheme=$(echo $SCHEME)" >> $GITHUB_OUTPUT
203+
echo "parsed-device-regex=$(echo $SIMDEVICE_REGEX)" >> $GITHUB_OUTPUT
204+
echo "parsed-os-version-regex=$(echo $OSVERSION_REGEX)" >> $GITHUB_OUTPUT
205205
echo "parsed-platform=$(echo $SIMPLATFORM)" >> $GITHUB_OUTPUT
206206
echo "parsed-platform-short=$(echo $SIMPLATFORM_SHORT)" >> $GITHUB_OUTPUT
207207
echo "parsed-platform-regex=$(echo $SIMPLATFORM_REGEX)" >> $GITHUB_OUTPUT
208-
echo "parsed-device-regex=$(echo $SIMDEVICE_REGEX)" >> $GITHUB_OUTPUT
209-
echo "parsed-os-version-regex=$(echo $OSVERSION_REGEX)" >> $GITHUB_OUTPUT
208+
echo "parsed-scheme=$(echo $SCHEME)" >> $GITHUB_OUTPUT
209+
echo "parsed-workspace-path=$(echo $WORKSPACEPATH)" >> $GITHUB_OUTPUT

0 commit comments

Comments
 (0)