2018-08-13 18:24:40 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2020-09-18 23:36:03 +00:00
|
|
|
set -e
|
2020-09-18 13:01:29 +00:00
|
|
|
|
2020-09-20 21:26:06 +00:00
|
|
|
REPOSITORY=${GITHUB_REPOSITORY:-"VSCodium/vscodium"}
|
2018-10-11 15:43:23 +00:00
|
|
|
GITHUB_RESPONSE=$(curl -s -H "Authorization: token $GITHUB_TOKEN" https://api.github.com/repos/$REPOSITORY/releases/tags/$LATEST_MS_TAG)
|
2018-08-31 14:53:36 +00:00
|
|
|
VSCODIUM_ASSETS=$(echo $GITHUB_RESPONSE | jq '.assets')
|
|
|
|
|
|
|
|
# if we just don't have the github token, get out fast
|
|
|
|
if [ "$GITHUB_TOKEN" != "" ]; then
|
|
|
|
if [ "$VSCODIUM_ASSETS" != "null" ]; then
|
2020-09-20 21:26:06 +00:00
|
|
|
if [[ "$OS_NAME" == "osx" ]]; then
|
2019-04-12 23:40:21 +00:00
|
|
|
HAVE_MAC=$(echo $VSCODIUM_ASSETS | jq --arg suffix "darwin-$LATEST_MS_TAG.zip" 'map(.name) | contains([$suffix])')
|
2018-08-31 14:53:36 +00:00
|
|
|
if [[ "$HAVE_MAC" != "true" ]]; then
|
|
|
|
echo "Building on Mac because we have no ZIP"
|
|
|
|
export SHOULD_BUILD="yes"
|
|
|
|
fi
|
2020-10-05 17:12:28 +00:00
|
|
|
elif [[ $VSCODE_ARCH == "arm64" ]]; then
|
2018-10-10 15:20:56 +00:00
|
|
|
HAVE_ARM64_DEB=$(echo $VSCODIUM_ASSETS | jq 'map(.name) | contains(["arm64.deb"])')
|
|
|
|
HAVE_ARM64_TAR=$(echo $VSCODIUM_ASSETS | jq --arg suffix "arm64-$LATEST_MS_TAG.tar.gz" 'map(.name) | contains([$suffix])')
|
|
|
|
if [[ "$HAVE_ARM64_DEB" != "true" ]]; then
|
|
|
|
echo "Building on Linux arm64 because we have no DEB"
|
|
|
|
export SHOULD_BUILD="yes"
|
|
|
|
fi
|
|
|
|
if [[ "$HAVE_ARM64_TAR" != "true" ]]; then
|
|
|
|
echo "Building on Linux arm64 because we have no TAR"
|
|
|
|
export SHOULD_BUILD="yes"
|
|
|
|
fi
|
|
|
|
if [[ "$SHOULD_BUILD" != "yes" ]]; then
|
|
|
|
echo "Already have all the Linux arm64 builds"
|
|
|
|
fi
|
2020-10-09 02:45:03 +00:00
|
|
|
elif [[ $VSCODE_ARCH == "armhf" ]]; then
|
2019-12-10 15:28:28 +00:00
|
|
|
HAVE_ARM_DEB=$(echo $VSCODIUM_ASSETS | jq 'map(.name) | contains(["armhf.deb"])')
|
2020-10-09 02:45:03 +00:00
|
|
|
HAVE_ARM_TAR=$(echo $VSCODIUM_ASSETS | jq --arg suffix "armhf-$LATEST_MS_TAG.tar.gz" 'map(.name) | contains([$suffix])')
|
2019-12-10 15:28:28 +00:00
|
|
|
if [[ "$HAVE_ARM_DEB" != "true" ]]; then
|
|
|
|
echo "Building on Linux arm because we have no DEB"
|
|
|
|
export SHOULD_BUILD="yes"
|
|
|
|
fi
|
|
|
|
if [[ "$HAVE_ARM_TAR" != "true" ]]; then
|
|
|
|
echo "Building on Linux arm because we have no TAR"
|
|
|
|
export SHOULD_BUILD="yes"
|
|
|
|
fi
|
|
|
|
if [[ "$SHOULD_BUILD" != "yes" ]]; then
|
|
|
|
echo "Already have all the Linux arm builds"
|
|
|
|
fi
|
2018-08-31 14:53:36 +00:00
|
|
|
else
|
2018-10-04 22:05:05 +00:00
|
|
|
HAVE_64_RPM=$(echo $VSCODIUM_ASSETS | jq 'map(.name) | contains(["x86_64.rpm"])')
|
|
|
|
HAVE_64_DEB=$(echo $VSCODIUM_ASSETS | jq 'map(.name) | contains(["amd64.deb"])')
|
|
|
|
HAVE_64_TAR=$(echo $VSCODIUM_ASSETS | jq --arg suffix "x64-$LATEST_MS_TAG.tar.gz" 'map(.name) | contains([$suffix])')
|
|
|
|
if [[ "$HAVE_64_RPM" != "true" ]]; then
|
|
|
|
echo "Building on Linux x64 because we have no RPM"
|
2018-08-31 14:53:36 +00:00
|
|
|
export SHOULD_BUILD="yes"
|
|
|
|
fi
|
2018-10-04 22:05:05 +00:00
|
|
|
if [[ "$HAVE_64_DEB" != "true" ]]; then
|
|
|
|
echo "Building on Linux x64 because we have no DEB"
|
2018-08-31 14:53:36 +00:00
|
|
|
export SHOULD_BUILD="yes"
|
|
|
|
fi
|
2018-10-04 22:05:05 +00:00
|
|
|
if [[ "$HAVE_64_TAR" != "true" ]]; then
|
|
|
|
echo "Building on Linux x64 because we have no TAR"
|
2018-08-31 14:53:36 +00:00
|
|
|
export SHOULD_BUILD="yes"
|
|
|
|
fi
|
|
|
|
if [[ "$SHOULD_BUILD" != "yes" ]]; then
|
2018-10-04 22:05:05 +00:00
|
|
|
echo "Already have all the Linux x64 builds"
|
2018-08-31 14:53:36 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo "Release assets do not exist at all, continuing build"
|
2018-08-13 18:24:40 +00:00
|
|
|
export SHOULD_BUILD="yes"
|
2018-10-04 22:05:05 +00:00
|
|
|
fi
|
2018-08-31 14:53:36 +00:00
|
|
|
fi
|
|
|
|
|
2020-10-05 23:31:17 +00:00
|
|
|
echo "SHOULD_BUILD=$SHOULD_BUILD" >> $GITHUB_ENV
|