Skip to content

Commit 3f2172d

Browse files
committed
Add more checks the github prep script
1 parent a46fc4e commit 3f2172d

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

scripts/prep-gh-action.sh

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,21 @@ if [ "$installSwiftly" == true ]; then
2222
echo "Installing swiftly"
2323
curl -O https://download.swift.org/swiftly/linux/swiftly-${SWIFTLY_BOOTSTRAP_VERSION}-$(uname -m).tar.gz && tar zxf swiftly-*.tar.gz && ./swiftly init -y --skip-install
2424

25-
echo "Updating environment"
26-
. "/root/.local/share/swiftly/env.sh" && echo "PATH=$PATH" >> "$GITHUB_ENV" && echo "SWIFTLY_HOME_DIR=$SWIFTLY_HOME_DIR" >> "$GITHUB_ENV" && echo "SWIFTLY_BIN_DIR=$SWIFTLY_BIN_DIR" >> "$GITHUB_ENV"
25+
. "/root/.local/share/swiftly/env.sh"
26+
hash -r
2727

28-
echo "Installing selected swift toolchain"
29-
swiftly install --post-install-file=post-install.sh
28+
if [ -n "$GITHUB_ENV" ]; then
29+
echo "Updating GitHub environment"
30+
echo "PATH=$PATH" >> "$GITHUB_ENV" && echo "SWIFTLY_HOME_DIR=$SWIFTLY_HOME_DIR" >> "$GITHUB_ENV" && echo "SWIFTLY_BIN_DIR=$SWIFTLY_BIN_DIR" >> "$GITHUB_ENV"
31+
fi
32+
33+
if [ -f .swift-version ]; then
34+
echo "Installing selected swift toolchain"
35+
swiftly install --post-install-file=post-install.sh
36+
else
37+
echo "Installing latest toolchain"
38+
swiftly install --post-install-file=post-install.sh latest
39+
fi
3040

3141
if [ -f post-install.sh ]; then
3242
echo "Performing swift toolchain post-installation"

0 commit comments

Comments
 (0)