-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
79 lines (74 loc) · 2.78 KB
/
action.yml
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
name: Swiftly
description: Install and invoke the Swiftly toolchain manager for Swift
inputs:
toolchain:
required: false
default: ''
description: >
A Swift toolchain version to install and select as the default. If omitted, Swiftly will be installed by itself.
See https://github.com/swift-server/swiftly/blob/main/README.md#installing-a-toolchain for a description of how
to specify a toolchain version.
#TODO: This is not yet possible to implement without duplicating most if not all of Swiftly's installation script.
#tool-version:
# required: false
# default: 'latest'
# description: >
# Specifies a version of Swiftly to install as a git tag. The default, 'latest', will always install the most recent
# released version. The value 'HEAD" will install Swiftly from the 'main' branch (use with caution; the head version
# is not guaranteed to be stable or even functional).
runs:
using: composite
steps:
# N.B.: Swiftly also checks the OS, but its error message at the time of this writing is less than helpful.
- id: platform-check
name: Check that the current runner platform is supported
shell: bash
env:
RUNNER_OS: ${{ runner.os }}
run: |
case "${RUNNER_OS}" in
'Linux')
;;
'Windows')
echo 'Swiftly does not yet support Windows.'
exit 1
;;
'macOS')
echo 'Swiftly does not yet support macOS.'
exit 1
;;
esac
- id: deps-install
name: Make sure Swiftly's deps are available
shell: bash
run: |
command -v curl >/dev/null || {
if command -v apt-get >/dev/null; then
apt-get update -q
apt-get install -qy curl
elif command -v yum >/dev/null; then
yum install -y curl
else
echo "curl is not installed and we couldn't figure out how to install it."
exit 1
fi
}
- id: swiftly-install
name: Install Swiftly itself
shell: bash
run: |
curl -L -o swiftly-install.sh https://swiftlang.github.io/swiftly/swiftly-install.sh
chmod a+x swiftly-install.sh
./swiftly-install.sh --disable-confirmation --no-modify-profile </dev/null
echo "SWIFTLY_HOME_DIR=${HOME}/.local/share/swiftly" >>"${GITHUB_ENV}"
echo "SWIFTLY_BIN_DIR=${HOME}/.local/bin" >>"${GITHUB_ENV}"
echo "${HOME}/.local/bin" >>"${GITHUB_PATH}"
- id: toolchain-install
name: Install requested Swift toolchain
if: ${{ inputs.toolchain != '' }}
shell: bash
env:
REQUESTED_TOOLCHAIN: ${{ inputs.toolchain }}
run: |
swiftly install "${REQUESTED_TOOLCHAIN}"
swiftly use "${REQUESTED_TOOLCHAIN}"