added githubapi versioning (#3530)

This commit is contained in:
/rootzoll 2022-12-16 11:12:56 +01:00 committed by GitHub
parent 45c2716e0e
commit 54c66559e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 19 additions and 17 deletions

View File

@ -172,13 +172,13 @@ range_argument fatpack "0" "1" "false" "true"
# could be any valid github-user that has a fork of the raspiblitz repo - 'rootzoll' is default
# The 'raspiblitz' repo of this user is used to provisioning sd card with raspiblitz assets/scripts later on.
: "${github_user:=$defaultRepo}"
curl -s "https://api.github.com/repos/${github_user}/raspiblitz" | grep -q "\"message\": \"Not Found\"" && error_msg "Repository 'raspiblitz' not found for user '${github_user}"
curl --header "X-GitHub-Api-Version:2022-11-28" -s "https://api.github.com/repos/${github_user}/raspiblitz" | grep -q "\"message\": \"Not Found\"" && error_msg "Repository 'raspiblitz' not found for user '${github_user}"
# GITHUB-BRANCH
# -------------------------------------
# could be any valid branch or tag of the given GITHUB-USERNAME forked raspiblitz repo
: "${branch:=$defaultBranch}"
curl -s "https://api.github.com/repos/${github_user}/raspiblitz/branches/${branch}" | grep -q "\"message\": \"Branch not found\"" && error_msg "Repository 'raspiblitz' for user '${github_user}' does not contain branch '${branch}'"
curl --header "X-GitHub-Api-Version:2022-11-28" -s "https://api.github.com/repos/${github_user}/raspiblitz/branches/${branch}" | grep -q "\"message\": \"Branch not found\"" && error_msg "Repository 'raspiblitz' for user '${github_user}' does not contain branch '${branch}'"
# DISPLAY-CLASS
# ----------------------------------------

View File

@ -46,7 +46,7 @@ installedVersion=$(sudo -u bitcoin bitcoind --version | head -n1| cut -d" " -f4|
bitcoinUpdateInstalled=$(echo "${installedVersion}" | grep -c "${bitcoinVersion}")
# get latest release from GitHub releases
gitHubLatestReleaseJSON="$(curl -s https://api.github.com/repos/bitcoin/bitcoin/releases | jq '.[0]')"
gitHubLatestReleaseJSON="$(curl --header "X-GitHub-Api-Version:2022-11-28" -s https://api.github.com/repos/bitcoin/bitcoin/releases | jq '.[0]')"
bitcoinLatestVersion=$(echo "${gitHubLatestReleaseJSON}"|jq -r '.tag_name'|cut -c 2-)
# INFO

View File

@ -73,7 +73,7 @@ if [ ${#wantedGitHubUser} -gt 0 ] && [ ${vagrant} -eq 0 ]; then
else
echo "# checking repo exists .."
repoExists=$(curl -s https://api.github.com/repos/${wantedGitHubUser}/raspiblitz | jq -r '.name' | grep -c 'raspiblitz')
repoExists=$(curl --header "X-GitHub-Api-Version:2022-11-28" -s https://api.github.com/repos/${wantedGitHubUser}/raspiblitz | jq -r '.name' | grep -c 'raspiblitz')
if [ ${repoExists} -eq 0 ]; then
echo "error='repo not found'"
exit 1
@ -100,7 +100,7 @@ if [ ${#wantedBranch} -gt 0 ] && [ ${vagrant} -eq 0 ]; then
localBranch=$(git branch | grep -c "${wantedBranch}")
if [ ${localBranch} -eq 0 ]; then
echo "# checking branch exists .."
branchExists=$(curl -s https://api.github.com/repos/${activeGitHubUser}/raspiblitz/branches/${wantedBranch} | jq -r '.name' | grep -c ${wantedBranch})
branchExists=$(curl --header "X-GitHub-Api-Version:2022-11-28" -s https://api.github.com/repos/${activeGitHubUser}/raspiblitz/branches/${wantedBranch} | jq -r '.name' | grep -c ${wantedBranch})
if [ ${branchExists} -eq 0 ]; then
echo "error='branch not found'"
exit 1

View File

@ -165,7 +165,7 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
fi
# check if given branch exits on that github user/repo
branchExists=$(curl -s "https://api.github.com/repos/${GITHUB_USER}/${GITHUB_REPO}/branches/${GITHUB_BRANCH}" | grep -c "\"name\": \"${GITHUB_BRANCH}\"")
branchExists=$(curl --header "X-GitHub-Api-Version:2022-11-28" -s "https://api.github.com/repos/${GITHUB_USER}/${GITHUB_REPO}/branches/${GITHUB_BRANCH}" | grep -c "\"name\": \"${GITHUB_BRANCH}\"")
if [ ${branchExists} -lt 1 ]; then
echo
echo "# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
@ -179,7 +179,7 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
fi
# re-check (if case its fallback)
branchExists=$(curl -s "https://api.github.com/repos/${GITHUB_USER}/${GITHUB_REPO}/branches/${GITHUB_BRANCH}" | grep -c "\"name\": \"${GITHUB_BRANCH}\"")
branchExists=$(curl --header "X-GitHub-Api-Version:2022-11-28" -s "https://api.github.com/repos/${GITHUB_USER}/${GITHUB_REPO}/branches/${GITHUB_BRANCH}" | grep -c "\"name\": \"${GITHUB_BRANCH}\"")
if [ ${branchExists} -lt 1 ]; then
echo
echo "# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
@ -188,6 +188,8 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
exit 1
fi
curl -s "https://api.github.com/repos/fusion44/blitz_api/branches/master" | grep -c "\"name\": \"master\""
echo "# INSTALL Web API ..."
# clean old source
rm -r /root/blitz_api 2>/dev/null

View File

@ -48,7 +48,7 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
fi
# check if given branch exits on that github user/repo
branchExists=$(curl -s "https://api.github.com/repos/${GITHUB_USER}/${GITHUB_REPO}/branches/${GITHUB_BRANCH}" | grep -c "\"name\": \"${GITHUB_BRANCH}\"")
branchExists=$(curl --header "X-GitHub-Api-Version:2022-11-28" -s "https://api.github.com/repos/${GITHUB_USER}/${GITHUB_REPO}/branches/${GITHUB_BRANCH}" | grep -c "\"name\": \"${GITHUB_BRANCH}\"")
if [ ${branchExists} -lt 1 ]; then
echo
echo "# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
@ -62,7 +62,7 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
fi
# re-check (if case its fallback)
branchExists=$(curl -s "https://api.github.com/repos/${GITHUB_USER}/${GITHUB_REPO}/branches/${GITHUB_BRANCH}" | grep -c "\"name\": \"${GITHUB_BRANCH}\"")
branchExists=$(curl --header "X-GitHub-Api-Version:2022-11-28" -s "https://api.github.com/repos/${GITHUB_USER}/${GITHUB_REPO}/branches/${GITHUB_BRANCH}" | grep -c "\"name\": \"${GITHUB_BRANCH}\"")
if [ ${branchExists} -lt 1 ]; then
echo
echo "# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"

View File

@ -523,7 +523,7 @@ if [ "$1" = "update" ]; then
sudo -u electrs git fetch
localVersion=$(git describe --tag)
updateVersion=$(curl -s https://api.github.com/repos/romanz/electrs/releases/latest|grep tag_name|head -1|cut -d '"' -f4)
updateVersion=$(curl --header "X-GitHub-Api-Version:2022-11-28" -s https://api.github.com/repos/romanz/electrs/releases/latest|grep tag_name|head -1|cut -d '"' -f4)
if [ $localVersion = $updateVersion ]; then
echo "# Up-to-date on version $localVersion"

View File

@ -3,7 +3,7 @@
# https://github.com/bastienwirtz/homer
installVersion="v22.06.1"
remoteVersion=$(curl -s https://api.github.com/repos/bastienwirtz/homer/releases/latest|grep tag_name|head -1|cut -d '"' -f4)
remoteVersion=$(curl --header "X-GitHub-Api-Version:2022-11-28" -s https://api.github.com/repos/bastienwirtz/homer/releases/latest|grep tag_name|head -1|cut -d '"' -f4)
# command info
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "-help" ]; then

View File

@ -10,7 +10,7 @@ GITHUB_REPO="https://github.com/itchysats/itchysats"
# the github tag of the version of the source code to install
# can also be a commit hash
# if empty it will use the latest source version
# GITHUB_VERSION=$( curl -s https://api.github.com/repos/itchysats/itchysats/releases | jq -r '.[].tag_name' | grep -v "rc" | head -n1)
# GITHUB_VERSION=$( curl --header "X-GitHub-Api-Version:2022-11-28" -s https://api.github.com/repos/itchysats/itchysats/releases | jq -r '.[].tag_name' | grep -v "rc" | head -n1)
GITHUB_VERSION="0.7.0"
# the github signature to verify the author
@ -481,7 +481,7 @@ fi
# UPDATE
###############
if [ "$1" = "update" ]; then
LATEST_VERSION=$( curl -s https://api.github.com/repos/itchysats/itchysats/releases | jq -r '.[].tag_name' | grep -v "rc" | head -n1)
LATEST_VERSION=$( curl --header "X-GitHub-Api-Version:2022-11-28" -s https://api.github.com/repos/itchysats/itchysats/releases | jq -r '.[].tag_name' | grep -v "rc" | head -n1)
echo "# Updating ItchySats to $LATEST_VERSION"
echo "# Making sure service is not running"

View File

@ -243,7 +243,7 @@ if [ "$1" = "update" ]; then
echo "# Downloading the latest commit in the default branch of $REPO"
sudo -u $USERNAME git clone https://github.com/$REPO
else
version=$(curl --silent "https://api.github.com/repos/$REPO/releases/latest" | grep '"tag_name":' | sed -E 's/.*"v([^"]+)".*/\1/')
version=$(curl --header "X-GitHub-Api-Version:2022-11-28" --silent "https://api.github.com/repos/$REPO/releases/latest" | grep '"tag_name":' | sed -E 's/.*"v([^"]+)".*/\1/')
cd $APP_DIR || exit 1
current=$(node -p "require('./package.json').version")
cd ..

View File

@ -424,7 +424,7 @@ if [ "$1" = "update" ]; then
cd /home/mempool/mempool
localVersion=$(git describe --tag)
updateVersion=$(curl -s https://api.github.com/repos/mempool/mempool/releases/latest|grep tag_name|head -1|cut -d '"' -f4)
updateVersion=$(curl --header "X-GitHub-Api-Version:2022-11-28" -s https://api.github.com/repos/mempool/mempool/releases/latest|grep tag_name|head -1|cut -d '"' -f4)
if [ $localVersion = $updateVersion ]; then
echo "*** You are up-to-date on version $localVersion ***"

View File

@ -35,7 +35,7 @@ clInstalledVersionMinor=$(echo "${clInstalledVersion}" | cut -d "-" -f1 | cut -d
clUpdateInstalled=$(echo "${clInstalledVersion}" | grep -c "${clUpdateVersion}")
# get latest release from Core Lightning GitHub releases without release candidates
clLatestVersion=$(curl -s https://api.github.com/repos/ElementsProject/lightning/releases | jq -r '.[].tag_name' | grep -v "rc" | head -n1)
clLatestVersion=$(curl --header "X-GitHub-Api-Version:2022-11-28" -s https://api.github.com/repos/ElementsProject/lightning/releases | jq -r '.[].tag_name' | grep -v "rc" | head -n1)
# example: v0.12.1
# INFO

View File

@ -68,7 +68,7 @@ lndInstalledVersionMinor=$(echo "${lndInstalledVersion}" | cut -d "-" -f1 | cut
lndUpdateInstalled=$(echo "${lndInstalledVersion}" | grep -c "${lndUpdateVersion}")
# get latest release from LND GitHub releases (without release candidates)
lndLatestVersion=$(curl -s https://api.github.com/repos/lightningnetwork/lnd/releases | jq -r '.[].tag_name' | grep -v "rc" | head -n1)
lndLatestVersion=$(curl --header "X-GitHub-Api-Version:2022-11-28" -s https://api.github.com/repos/lightningnetwork/lnd/releases | jq -r '.[].tag_name' | grep -v "rc" | head -n1)
# example: v0.13.3-beta
binaryName="lnd-linux-${cpuArchitecture}-${lndLatestVersion}.tar.gz"
# example: lnd-linux-arm64-v0.13.3-beta.tar.gz