Fix GitHub API asset download for private repositories
This commit is contained in:
27
.github/workflows/gh-pages-fast.yml
vendored
27
.github/workflows/gh-pages-fast.yml
vendored
@@ -45,10 +45,33 @@ jobs:
|
|||||||
# Download if version is different or binary doesn't exist
|
# Download if version is different or binary doesn't exist
|
||||||
if [ "$CURRENT_VERSION" != "${LATEST_VERSION#v}" ]; then
|
if [ "$CURRENT_VERSION" != "${LATEST_VERSION#v}" ]; then
|
||||||
echo "Downloading ailog $LATEST_VERSION..."
|
echo "Downloading ailog $LATEST_VERSION..."
|
||||||
curl -sL -H "Authorization: Bearer $GITHUB_TOKEN" \
|
# Get download URL for the asset
|
||||||
https://github.com/${{ github.repository }}/releases/download/$LATEST_VERSION/ailog-linux-x86_64.tar.gz | tar -xzf -
|
DOWNLOAD_URL=$(curl -s -H "Authorization: Bearer $GITHUB_TOKEN" \
|
||||||
|
https://api.github.com/repos/${{ github.repository }}/releases/tags/$LATEST_VERSION | \
|
||||||
|
jq -r '.assets[] | select(.name == "ailog-linux-x86_64.tar.gz") | .url')
|
||||||
|
|
||||||
|
if [ -z "$DOWNLOAD_URL" ] || [ "$DOWNLOAD_URL" = "null" ]; then
|
||||||
|
echo "Error: Could not find download URL for ailog-linux-x86_64.tar.gz"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Download using GitHub API with Accept header
|
||||||
|
echo "Downloading from: $DOWNLOAD_URL"
|
||||||
|
curl -L -H "Authorization: Bearer $GITHUB_TOKEN" \
|
||||||
|
-H "Accept: application/octet-stream" \
|
||||||
|
"$DOWNLOAD_URL" -o ailog-linux-x86_64.tar.gz
|
||||||
|
|
||||||
|
# Check if download was successful
|
||||||
|
if [ ! -f "ailog-linux-x86_64.tar.gz" ] || [ ! -s "ailog-linux-x86_64.tar.gz" ]; then
|
||||||
|
echo "Error: Download failed"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Extract the binary
|
||||||
|
tar -xzf ailog-linux-x86_64.tar.gz
|
||||||
mv ailog ./bin/ailog
|
mv ailog ./bin/ailog
|
||||||
chmod +x ./bin/ailog
|
chmod +x ./bin/ailog
|
||||||
|
rm ailog-linux-x86_64.tar.gz
|
||||||
echo "Updated to version: $(./bin/ailog --version 2>/dev/null)"
|
echo "Updated to version: $(./bin/ailog --version 2>/dev/null)"
|
||||||
else
|
else
|
||||||
echo "Binary is up to date"
|
echo "Binary is up to date"
|
||||||
|
Reference in New Issue
Block a user