Repository navigation
Expand file tree
/
Copy pathinstall.sh
More file actions
92 lines (73 loc) · 1.99 KB
/
Copy pathinstall.sh
File metadata and controls
92 lines (73 loc) · 1.99 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
set -euo pipefail
if [[ "$RUNNER_OS" == "Windows" ]]; then
BINARY="gdscript-formatter.exe"
else
BINARY="gdscript-formatter"
fi
if [[ "$CACHE_HIT" == "true" && -f "$INSTALL_DIR/$BINARY" ]]; then
if [[ "$RUNNER_OS" != "Windows" ]]; then
chmod +x "$INSTALL_DIR/$BINARY"
fi
echo "Adding GDScript Formatter to PATH"
echo "$INSTALL_DIR" >> "$GITHUB_PATH"
exit 0
fi
if [[ "$CACHE_ENABLED" == "false" ]]; then
echo "Caching is disabled."
fi
case "$RUNNER_OS" in
Linux)
OS="linux"
;;
macOS)
OS="macos"
;;
Windows)
OS="windows"
;;
*)
echo "Unsupported operating system: $RUNNER_OS"
exit 1
;;
esac
case "$RUNNER_ARCH" in
X64)
ARCH="x86_64"
;;
ARM64)
ARCH="aarch64"
;;
*)
echo "Unsupported architecture: $RUNNER_ARCH"
exit 1
;;
esac
if [[ "$RUNNER_OS" == "Windows" ]]; then
ARCHIVE="gdscript-formatter-$VERSION-$OS-$ARCH.exe.zip"
SOURCE_BINARY="gdscript-formatter-$VERSION-$OS-$ARCH.exe"
else
ARCHIVE="gdscript-formatter-$VERSION-$OS-$ARCH.zip"
SOURCE_BINARY="gdscript-formatter-$VERSION-$OS-$ARCH"
fi
URL="https://github.com/GDQuest/GDScript-formatter/releases/download/$VERSION/$ARCHIVE"
mkdir -p "$INSTALL_DIR"
TMP_DIR="$(mktemp -d)"
TMP_ARCHIVE="$TMP_DIR/formatter.zip"
trap 'rm -rf "${TMP_DIR:-}"' EXIT
echo "Downloading GDScript Formatter $VERSION for $OS-$ARCH..."
curl -fsSL "$URL" -o "$TMP_ARCHIVE"
echo "Extracting Archive..."
if [[ "$RUNNER_OS" == "Windows" ]]; then
7z x "$TMP_ARCHIVE" -o"$TMP_DIR" -y >/dev/null
else
unzip -q "$TMP_ARCHIVE" -d "$TMP_DIR"
fi
echo "Installing GDScript Formatter"
echo "Install directory: $INSTALL_DIR"
mv "$TMP_DIR/$SOURCE_BINARY" "$INSTALL_DIR/$BINARY"
if [[ "$RUNNER_OS" != "Windows" ]]; then
chmod +x "$INSTALL_DIR/$BINARY"
fi
echo "Adding GDScript Formatter to PATH"
echo "$INSTALL_DIR" >> "$GITHUB_PATH"
echo "GDScript Formatter installed successfully."