mirror of
https://github.com/outbackdingo/UltraGrid.git
synced 2026-03-22 00:40:25 +00:00
shellchecked .github/*sh
This commit is contained in:
6
.github/scripts/environment.sh
vendored
6
.github/scripts/environment.sh
vendored
@@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
if expr $GITHUB_REF : 'refs/tags/'; then
|
||||
if expr "$GITHUB_REF" : 'refs/tags/'; then
|
||||
TAG=${GITHUB_REF#refs/tags/}
|
||||
VERSION=${TAG#v}
|
||||
CHANNEL=release
|
||||
@@ -15,6 +15,4 @@ fi
|
||||
|
||||
export CHANNEL TAG VERSION
|
||||
|
||||
echo "CHANNEL=$CHANNEL" >> $GITHUB_ENV
|
||||
echo "TAG=$TAG" >> $GITHUB_ENV
|
||||
echo "VERSION=$VERSION" >> $GITHUB_ENV
|
||||
printf '%b' "CHANNEL=$CHANNEL\nTAG=$TAG\nVERSION=$VERSION\n" >> "$GITHUB_ENV"
|
||||
|
||||
4
.github/scripts/get-etags.sh
vendored
4
.github/scripts/get-etags.sh
vendored
@@ -5,10 +5,10 @@
|
||||
OUT=
|
||||
|
||||
while [ $# -gt 0 ]; do
|
||||
ETAG=$(curl -LI $1 | grep -i '^etag' | sed 's/.*"\(.*\)".*/\1/')
|
||||
ETAG=$(curl -LI "$1" | grep -i '^etag' | sed 's/.*"\(.*\)".*/\1/')
|
||||
OUT=$OUT${OUT:+_}${ETAG:-NOTFOUND}
|
||||
shift
|
||||
done
|
||||
|
||||
echo $OUT
|
||||
echo "$OUT"
|
||||
|
||||
|
||||
17
.github/scripts/install-common-deps.sh
vendored
17
.github/scripts/install-common-deps.sh
vendored
@@ -2,11 +2,10 @@
|
||||
|
||||
case "$(uname -s)" in
|
||||
CYGWIN*|MINGW32*|MSYS*|MINGW*)
|
||||
SUDO=
|
||||
;;
|
||||
|
||||
*)
|
||||
SUDO="sudo "
|
||||
sudo="sudo"
|
||||
;;
|
||||
esac
|
||||
|
||||
@@ -16,13 +15,13 @@ fi
|
||||
|
||||
# only download here, compilation is handled per-platform
|
||||
download_cineform() {(
|
||||
cd $GITHUB_WORKSPACE
|
||||
cd "$GITHUB_WORKSPACE"
|
||||
git clone --depth 1 https://github.com/gopro/cineform-sdk
|
||||
mkdir cineform-sdk/build
|
||||
)}
|
||||
|
||||
install_ews() {
|
||||
${SUDO}curl -LS https://raw.githubusercontent.com/hellerf/EmbeddableWebServer/master/EmbeddableWebServer.h -o /usr/local/include/EmbeddableWebServer.h
|
||||
${sudo:+"$sudo" }curl -LS https://raw.githubusercontent.com/hellerf/EmbeddableWebServer/master/EmbeddableWebServer.h -o /usr/local/include/EmbeddableWebServer.h
|
||||
}
|
||||
|
||||
install_juice() {
|
||||
@@ -31,8 +30,8 @@ install_juice() {
|
||||
mkdir libjuice/build
|
||||
cd libjuice/build
|
||||
cmake -DCMAKE_INSTALL_PREFIX=/usr/local -G "Unix Makefiles" ..
|
||||
make -j $(nproc)
|
||||
${SUDO}make install
|
||||
make -j "$(nproc)"
|
||||
${sudo:+"$sudo" }make install
|
||||
)
|
||||
}
|
||||
|
||||
@@ -43,15 +42,15 @@ install_pcp() {
|
||||
./autogen.sh || true # autogen exits with 1
|
||||
CFLAGS=-fPIC ./configure --disable-shared
|
||||
make -j "$(nproc)"
|
||||
${SUDO}make install
|
||||
${sudo+"$sudo" }make install
|
||||
)
|
||||
rm -rf pcp
|
||||
}
|
||||
|
||||
install_zfec() {(
|
||||
git clone --depth 1 https://github.com/tahoe-lafs/zfec zfec
|
||||
${SUDO}mkdir -p /usr/local/src
|
||||
${SUDO}mv zfec/zfec /usr/local/src
|
||||
${sudo:+"$sudo" }mkdir -p /usr/local/src
|
||||
${sudo:+"$sudo" }mv zfec/zfec /usr/local/src
|
||||
)}
|
||||
|
||||
download_cineform
|
||||
|
||||
16
.github/scripts/replace-asset.sh
vendored
16
.github/scripts/replace-asset.sh
vendored
@@ -2,20 +2,18 @@
|
||||
|
||||
set +e # pattern matching may fail
|
||||
# If first parameter 2 parameters is GITHUB_REPOSOTIRY and GITHUB_TOKEN, those willbe used as an env var (used by the scripts below)
|
||||
REPOSITORY=$(expr $1 : "GITHUB_REPOSITORY=\(.*\)")
|
||||
if [ $? -eq 0 ]; then
|
||||
export GITHUB_REPOSITORY=$REPOSITORY
|
||||
if repository=$(expr "$1" : "GITHUB_REPOSITORY=\(.*\)"); then
|
||||
export GITHUB_REPOSITORY="$repository"
|
||||
shift
|
||||
fi
|
||||
TOKEN=$(expr $1 : "GITHUB_TOKEN=\(.*\)")
|
||||
if [ $? -eq 0 ]; then
|
||||
export GITHUB_TOKEN=$TOKEN
|
||||
if token=$(expr "$1" : "GITHUB_TOKEN=\(.*\)"); then
|
||||
export GITHUB_TOKEN="$token"
|
||||
shift
|
||||
fi
|
||||
set -e
|
||||
|
||||
DIR=$(dirname $0)
|
||||
dir=$(dirname "$0")
|
||||
|
||||
$DIR/delete-asset.sh "$@"
|
||||
$DIR/upload-asset.sh "$@"
|
||||
"$dir/delete-asset.sh" "$@"
|
||||
"$dir/upload-asset.sh" "$@"
|
||||
|
||||
|
||||
13
.github/scripts/upload-asset.sh
vendored
13
.github/scripts/upload-asset.sh
vendored
@@ -1,6 +1,7 @@
|
||||
#!/bin/sh -eu
|
||||
|
||||
. $(dirname $0)/json-common.sh
|
||||
dir=$(dirname "$0")
|
||||
"$dir/json-common.sh"
|
||||
|
||||
TAG_NAME=${1?}
|
||||
FILE=${2?}
|
||||
@@ -8,12 +9,12 @@ FILENAME=$(basename "${2?}")
|
||||
CONTENT_TYPE=${3?}
|
||||
LABEL=${4?}
|
||||
|
||||
JSON=$(fetch_json https://api.github.com/repos/$GITHUB_REPOSITORY/releases/tags/$TAG_NAME $GITHUB_TOKEN)
|
||||
UPLOAD_URL=$(jq -r .upload_url $JSON | sed "s/{.*}//")
|
||||
JSON=$(fetch_json "https://api.github.com/repos/$GITHUB_REPOSITORY/releases/tags/$TAG_NAME" "$GITHUB_TOKEN")
|
||||
UPLOAD_URL=$(jq -r .upload_url "$JSON" | sed "s/{.*}//")
|
||||
|
||||
JSON=$(mktemp)
|
||||
STATUS=$(curl -S -H "Authorization: token $GITHUB_TOKEN" -H "Content-Type: $CONTENT_TYPE" -X POST "$UPLOAD_URL?name=$FILENAME&label=$LABEL" -T $FILE -w %{http_code} -o $JSON)
|
||||
STATUS=$(curl -S -H "Authorization: token $GITHUB_TOKEN" -H "Content-Type: $CONTENT_TYPE" -X POST "$UPLOAD_URL?name=$FILENAME&label=$LABEL" -T "$FILE" -w '%{http_code}' -o "$JSON")
|
||||
check_errors "$JSON"
|
||||
check_status $STATUS
|
||||
rm $JSON
|
||||
check_status "$STATUS"
|
||||
rm "$JSON"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user