-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathaction.yaml
More file actions
63 lines (61 loc) · 2.52 KB
/
Copy pathaction.yaml
File metadata and controls
63 lines (61 loc) · 2.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
name: Setup Swift
inputs:
swift-version:
description: 'Swift Version'
required: true
version-manifest:
description: 'YAML file describing Xcode versions'
required: false
default: ./.github/actions/setup-swift/versions.yaml
outputs:
developer_dir:
description: 'Selected developer dir'
runs:
using: composite
steps:
- name: Select the appropriate version of Xcode
id: check_xcode_version
if: runner.os == 'macOS'
shell: bash
run: |
for xcode_version in $(yq ".swift[] | select(.version == \"${{ inputs.swift-version }}\") | .xcode_versions[]" "${{inputs.version-manifest}}" | sort -r); do
developer_dir="/Applications/Xcode_${xcode_version}.app/Contents/Developer"
echo "Evaluating Xcode ${xcode_version} at \`${developer_dir}\`"
if [[ -d "$developer_dir" ]]; then
echo "Using Xcode ${xcode_version} for Swift ${{ inputs.swift-version }}"
echo "DEVELOPER_DIR=${developer_dir}" >> $GITHUB_ENV
echo "developer_dir=${developer_dir}" >> $GITHUB_OUTPUT
swift_arguments=$(yq ".swift[] | select(.version == \"${{inputs.swift-version}}\") | .swift_arguments" "${{inputs.version-manifest}}")
if [[ "$swift_arguments" -ne "null" ]]; then
echo "Requires the use of \"${swift_arguments}\" Swift arguments"
echo "SWIFT_ARGUMENTS=${swift_arguments}" >> $GITHUB_ENV
echo "swift_arguments=${swift_arguments}" >> $GITHUB_OUTPUT
else
echo "SWIFT_ARGUMENTS=" >> $GITHUB_ENV
echo "swift_arguments=" >> $GITHUB_OUTPUT
fi
exit 0
fi
done
echo "developer_dir=" >> $GITHUB_OUTPUT
- uses: SwiftyLab/setup-swift@latest
if: steps.check_xcode_version.outputs.developer_dir == ''
with:
swift-version: ${{ inputs.swift-version }}
- name: Install Linux utilities
if: runner.os == 'Linux'
shell: bash
env:
HOMEBREW_NO_INSTALL_CLEANUP: YES
HOMEBREW_NO_ENV_HINTS: YES
run: |
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
brew install xcbeautify
echo "HOMEBREW_PREFIX=${HOMEBREW_PREFIX}" >> $GITHUB_ENV
echo "HOMEBREW_CELLAR=${HOMEBREW_CELLAR}" >> $GITHUB_ENV
echo "HOMEBREW_REPOSITORY=${HOMEBREW_REPOSITORY}" >> $GITHUB_ENV
echo "${HOMEBREW_PREFIX}/bin" >> $GITHUB_PATH
echo "${HOMEBREW_PREFIX}/sbin" >> $GITHUB_PATH
- name: Get swift version
shell: bash
run: swift --version