mirror of
https://github.com/halcyon/asdf-java.git
synced 2024-10-06 07:42:09 +08:00
Provide GitHub API token, resolves #59
This commit is contained in:
parent
680e8f72e1
commit
dfd43d6c91
@ -1,10 +1,14 @@
|
|||||||
language: c
|
language: c
|
||||||
script: asdf plugin-test java "$TRAVIS_BUILD_DIR" --asdf-plugin-gitref "$TRAVIS_COMMIT" --asdf-tool-version azul-zulu-8.44.0.11-jdk8.0.242
|
script: asdf plugin-test java "$TRAVIS_BUILD_DIR" --asdf-plugin-gitref "$TRAVIS_COMMIT"
|
||||||
|
--asdf-tool-version azul-zulu-8.44.0.11-jdk8.0.242
|
||||||
before_script:
|
before_script:
|
||||||
- git clone https://github.com/asdf-vm/asdf.git
|
- git clone https://github.com/asdf-vm/asdf.git
|
||||||
- . asdf/asdf.sh
|
- ". asdf/asdf.sh"
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- os: linux
|
- os: linux
|
||||||
- os: osx
|
- os: osx
|
||||||
install: HOMEBREW_NO_AUTO_UPDATE=1 brew install jq
|
install: HOMEBREW_NO_AUTO_UPDATE=1 brew install jq
|
||||||
|
env:
|
||||||
|
global:
|
||||||
|
secure: bkAmm4x8tN/J9iC35Gh+qlyfve5DjsxivSrEIMGf2tTla0hDbV/j02eIbMgib+MprRGW7HtMqO0P29UtCrdr6qE8CdkEaqf2d2H99Fw1W3OAHNaMgt50nSEQcm/c5Ypnb5JYCXxzkbyLYc2i3pQCYi1B2BzHKEcqGwmqwduFcZfBu0+g4ngPKZszf4P32KGb+/Z5xqqOCtrpLsPWtFbJ7zq8qLrtm6Xmp9qwMmaQRic2CuUjgFvmLegTOCSBkiILRJ85GNnTR+01gTb/o20F2Q+P343uBsbmLAQW5xLNzf2Zc1g6wfW2jgPxDSJuHVI1Zf+z1VOv7WKX6xvocYkXhQejaHpgE6NxQiE+5+qquZb+Pa7LnyWXTeC3QroHkhRlXJfA8bRr1E23F18FIFu9jRpMppTlVp63Z43lPvcLJgDpHF/J8lrDED5H2qTHMZnLUUzBJ+U65TL6bSJJ+5VV16IZgG6O12RYShw9y7V1wPcniSZbF3ER0+krNtfTZoh71wifCniTFq/OsCX4cA5pjKFVN52NoL57XwPX+u6ndys7nYhBKRCKhsA4lniDDUGB4UAcMTaa9xkMtlGTTFExxSoB+xgwmZnmxDcP+5Jo6q7QYOmQNyrBzrbuj1J2DGM8ZcxFKNPpSBDVaX22yEMXFnOxnDRHtHGX7r9N5Cygb4A=
|
||||||
|
@ -50,7 +50,7 @@ function retrieve-adoptopenjdk() {
|
|||||||
then
|
then
|
||||||
for url in "${URLS[@]}"
|
for url in "${URLS[@]}"
|
||||||
do
|
do
|
||||||
curl -f -s -H "Accept: application/json" -L "${url}" -# -w "%{filename_effective}\n" -o "${CACHE_DIR}/adopt-#1.json" > /dev/null 2>&1
|
curl -fsL "${url}" -# -w "%{filename_effective}\n" -o "${CACHE_DIR}/adopt-#1.json" > /dev/null 2>&1
|
||||||
done
|
done
|
||||||
for i in "${CACHE_DIR}"/adopt-*.json
|
for i in "${CACHE_DIR}"/adopt-*.json
|
||||||
do
|
do
|
||||||
@ -63,9 +63,9 @@ function retrieve-adoptopenjdk() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function retrieve-sapmachine() {
|
function retrieve-sapmachine() {
|
||||||
args=('-s' '-f')
|
curl_args='-sfL'
|
||||||
if [[ -n "${GITHUB_API_TOKEN:-}" ]]; then
|
if [[ -n "${GITHUB_API_TOKEN:-}" ]]; then
|
||||||
args+=('-H' "Authorization: token $GITHUB_API_TOKEN")
|
curl_args="${curl_args} -H 'Authorization: token $GITHUB_API_TOKEN'"
|
||||||
fi
|
fi
|
||||||
local cache_file="${CACHE_DIR}/sapmachine.json"
|
local cache_file="${CACHE_DIR}/sapmachine.json"
|
||||||
local filter='[
|
local filter='[
|
||||||
@ -91,7 +91,7 @@ function retrieve-sapmachine() {
|
|||||||
# shellcheck disable=SC2046
|
# shellcheck disable=SC2046
|
||||||
if [[ ! -r "${cache_file}" ]] || [[ $(set -- $(${STAT}) && echo "${1}") -le $(( $(date +%s) - 3600)) ]]
|
if [[ ! -r "${cache_file}" ]] || [[ $(set -- $(${STAT}) && echo "${1}") -le $(( $(date +%s) - 3600)) ]]
|
||||||
then
|
then
|
||||||
curl "${args[@]}" -L 'https://api.github.com/repos/SAP/SapMachine/releases' -o "${cache_file}"
|
curl "${curl_args}" 'https://api.github.com/repos/SAP/SapMachine/releases' -o "${cache_file}"
|
||||||
jq "${filter}" "${cache_file}" > "${cache_file}.temp"
|
jq "${filter}" "${cache_file}" > "${cache_file}.temp"
|
||||||
mv "${cache_file}.temp" "${cache_file}"
|
mv "${cache_file}.temp" "${cache_file}"
|
||||||
fi
|
fi
|
||||||
@ -145,12 +145,16 @@ function install {
|
|||||||
checksum_link=$(set -- "$(echo "${binary}" | jq -r ".package.checksum_link")" ; echo "${1}")
|
checksum_link=$(set -- "$(echo "${binary}" | jq -r ".package.checksum_link")" ; echo "${1}")
|
||||||
|
|
||||||
cd "${TEMP_DIR}"
|
cd "${TEMP_DIR}"
|
||||||
if ! curl -LO -# -w "%{filename_effective}\n" "${binary_link}";
|
curl_args='-LO'
|
||||||
|
if [[ -n "${GITHUB_API_TOKEN:-}" ]]; then
|
||||||
|
curl_args="${curl_args} -H 'Authorization: token $GITHUB_API_TOKEN'"
|
||||||
|
fi
|
||||||
|
if ! curl "${curl_args}" -# -w "%{filename_effective}\n" "${binary_link}";
|
||||||
then
|
then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! curl -LO -# -w "%{filename_effective}\n" "${checksum_link}";
|
if ! curl "${curl_args}" -# -w "%{filename_effective}\n" "${checksum_link}";
|
||||||
then
|
then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user