-
Notifications
You must be signed in to change notification settings - Fork 0
/
entrypoint.sh
executable file
·52 lines (44 loc) · 1.38 KB
/
entrypoint.sh
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
#!/usr/bin/env bash
# SPDX-FileCopyrightText: 2020 Serokell <https://serokell.io/>
#
# SPDX-License-Identifier: MPL-2.0
# This script downloads xrefcheck from GitHub releases, unpacks it
# and optionally runs.
# Inputs:
# • $VERSION is the version of xrefcheck, can be set to "latest".
# • $ACTION can be 'install' or 'run'.
# • $1 stores all command line arguments that will be passed to xrefcheck.
set -euo pipefail
if [ "$VERSION" = "latest" ]; then
URL="https://github.com/serokell/xrefcheck/releases/latest/download/xrefcheck-x86_64-linux"
else
URL="https://github.com/serokell/xrefcheck/releases/download/v$VERSION/xrefcheck-x86_64-linux"
fi
case "$ACTION" in
"run" )
need_run=true
;;
"install" )
echo "xrefcheck will be installed but not launched"
need_run=false
;;
* )
echo 1>&2 "Unexpected action: $ACTION"
exit 1
;;
esac
# Download xrefcheck and put it into `bin/xrefcheck`.
# We put it into `bin/` so that it's less likely to interfere with anything.
# Perhaps it's better to put it into some global location, we'll do it one day.
echo "Downloading xrefcheck version $VERSION"
mkdir -p bin/
xrefcheck_path="bin/xrefcheck"
wget --quiet -O "$xrefcheck_path" "$URL"
chmod +x "$xrefcheck_path"
# Run xrefcheck.
if [ "$need_run" == true ]; then
set -x
./$xrefcheck_path $1
set +x
fi
echo "xrefcheck-path=$xrefcheck_path" >> $GITHUB_OUTPUT