Use pre-packaged tar.gz binary from repository
- Check Cargo.toml version vs binary version - Extract from ./bin/ailog-linux-x86_64.tar.gz if needed - No external downloads required - Support for GitHub Actions cache - Verify OS compatibility (Linux only) 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
69
.github/workflows/cloudflare-pages.yml
vendored
69
.github/workflows/cloudflare-pages.yml
vendored
@@ -46,59 +46,46 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
ailog-bin-${{ runner.os }}
|
ailog-bin-${{ runner.os }}
|
||||||
|
|
||||||
- name: Check and update ailog binary
|
- name: Setup ailog binary
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
run: |
|
run: |
|
||||||
# Get latest release version
|
# Get expected version from Cargo.toml
|
||||||
LATEST_VERSION=$(curl -s -H "Authorization: Bearer $GITHUB_TOKEN" \
|
EXPECTED_VERSION=$(grep '^version' Cargo.toml | cut -d'"' -f2)
|
||||||
https://api.github.com/repos/${{ github.repository }}/releases/latest | jq -r .tag_name)
|
echo "Expected version from Cargo.toml: $EXPECTED_VERSION"
|
||||||
echo "Latest version: $LATEST_VERSION"
|
|
||||||
|
|
||||||
# Check current binary version if exists
|
# Check current binary version if exists
|
||||||
mkdir -p ./bin
|
|
||||||
if [ -f "./bin/ailog" ]; then
|
if [ -f "./bin/ailog" ]; then
|
||||||
CURRENT_VERSION=$(./bin/ailog --version 2>/dev/null || echo "unknown")
|
CURRENT_VERSION=$(./bin/ailog --version 2>/dev/null || echo "unknown")
|
||||||
echo "Current version: $CURRENT_VERSION"
|
echo "Current binary version: $CURRENT_VERSION"
|
||||||
else
|
else
|
||||||
CURRENT_VERSION="none"
|
CURRENT_VERSION="none"
|
||||||
echo "No binary found"
|
echo "No binary found"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Download if version is different or binary doesn't exist
|
# Check OS
|
||||||
if [ "$CURRENT_VERSION" != "${LATEST_VERSION#v}" ]; then
|
OS="${{ runner.os }}"
|
||||||
echo "Downloading ailog $LATEST_VERSION..."
|
echo "Runner OS: $OS"
|
||||||
# Get download URL for the asset
|
|
||||||
DOWNLOAD_URL=$(curl -s -H "Authorization: Bearer $GITHUB_TOKEN" \
|
# Use pre-packaged binary if version matches or extract from tar.gz
|
||||||
https://api.github.com/repos/${{ github.repository }}/releases/tags/$LATEST_VERSION | \
|
if [ "$CURRENT_VERSION" = "$EXPECTED_VERSION" ]; then
|
||||||
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
|
|
||||||
chmod +x ./bin/ailog
|
|
||||||
rm ailog-linux-x86_64.tar.gz
|
|
||||||
echo "Updated to version: $(./bin/ailog --version 2>/dev/null)"
|
|
||||||
else
|
|
||||||
echo "Binary is up to date"
|
echo "Binary is up to date"
|
||||||
chmod +x ./bin/ailog
|
chmod +x ./bin/ailog
|
||||||
|
elif [ "$OS" = "Linux" ] && [ -f "./bin/ailog-linux-x86_64.tar.gz" ]; then
|
||||||
|
echo "Extracting ailog from pre-packaged tar.gz..."
|
||||||
|
cd bin
|
||||||
|
tar -xzf ailog-linux-x86_64.tar.gz
|
||||||
|
chmod +x ailog
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
# Verify extracted version
|
||||||
|
EXTRACTED_VERSION=$(./bin/ailog --version 2>/dev/null || echo "unknown")
|
||||||
|
echo "Extracted binary version: $EXTRACTED_VERSION"
|
||||||
|
|
||||||
|
if [ "$EXTRACTED_VERSION" != "$EXPECTED_VERSION" ]; then
|
||||||
|
echo "Warning: Binary version mismatch. Expected $EXPECTED_VERSION but got $EXTRACTED_VERSION"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Error: No suitable binary found for OS: $OS"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Build site with ailog
|
- name: Build site with ailog
|
||||||
|
69
.github/workflows/gh-pages-fast.yml
vendored
69
.github/workflows/gh-pages-fast.yml
vendored
@@ -23,59 +23,46 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
ailog-bin-${{ runner.os }}
|
ailog-bin-${{ runner.os }}
|
||||||
|
|
||||||
- name: Check and update ailog binary
|
- name: Setup ailog binary
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
run: |
|
run: |
|
||||||
# Get latest release version
|
# Get expected version from Cargo.toml
|
||||||
LATEST_VERSION=$(curl -s -H "Authorization: Bearer $GITHUB_TOKEN" \
|
EXPECTED_VERSION=$(grep '^version' Cargo.toml | cut -d'"' -f2)
|
||||||
https://api.github.com/repos/${{ github.repository }}/releases/latest | jq -r .tag_name)
|
echo "Expected version from Cargo.toml: $EXPECTED_VERSION"
|
||||||
echo "Latest version: $LATEST_VERSION"
|
|
||||||
|
|
||||||
# Check current binary version if exists
|
# Check current binary version if exists
|
||||||
mkdir -p ./bin
|
|
||||||
if [ -f "./bin/ailog" ]; then
|
if [ -f "./bin/ailog" ]; then
|
||||||
CURRENT_VERSION=$(./bin/ailog --version 2>/dev/null || echo "unknown")
|
CURRENT_VERSION=$(./bin/ailog --version 2>/dev/null || echo "unknown")
|
||||||
echo "Current version: $CURRENT_VERSION"
|
echo "Current binary version: $CURRENT_VERSION"
|
||||||
else
|
else
|
||||||
CURRENT_VERSION="none"
|
CURRENT_VERSION="none"
|
||||||
echo "No binary found"
|
echo "No binary found"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Download if version is different or binary doesn't exist
|
# Check OS
|
||||||
if [ "$CURRENT_VERSION" != "${LATEST_VERSION#v}" ]; then
|
OS="${{ runner.os }}"
|
||||||
echo "Downloading ailog $LATEST_VERSION..."
|
echo "Runner OS: $OS"
|
||||||
# Get download URL for the asset
|
|
||||||
DOWNLOAD_URL=$(curl -s -H "Authorization: Bearer $GITHUB_TOKEN" \
|
# Use pre-packaged binary if version matches or extract from tar.gz
|
||||||
https://api.github.com/repos/${{ github.repository }}/releases/tags/$LATEST_VERSION | \
|
if [ "$CURRENT_VERSION" = "$EXPECTED_VERSION" ]; then
|
||||||
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
|
|
||||||
chmod +x ./bin/ailog
|
|
||||||
rm ailog-linux-x86_64.tar.gz
|
|
||||||
echo "Updated to version: $(./bin/ailog --version 2>/dev/null)"
|
|
||||||
else
|
|
||||||
echo "Binary is up to date"
|
echo "Binary is up to date"
|
||||||
chmod +x ./bin/ailog
|
chmod +x ./bin/ailog
|
||||||
|
elif [ "$OS" = "Linux" ] && [ -f "./bin/ailog-linux-x86_64.tar.gz" ]; then
|
||||||
|
echo "Extracting ailog from pre-packaged tar.gz..."
|
||||||
|
cd bin
|
||||||
|
tar -xzf ailog-linux-x86_64.tar.gz
|
||||||
|
chmod +x ailog
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
# Verify extracted version
|
||||||
|
EXTRACTED_VERSION=$(./bin/ailog --version 2>/dev/null || echo "unknown")
|
||||||
|
echo "Extracted binary version: $EXTRACTED_VERSION"
|
||||||
|
|
||||||
|
if [ "$EXTRACTED_VERSION" != "$EXPECTED_VERSION" ]; then
|
||||||
|
echo "Warning: Binary version mismatch. Expected $EXPECTED_VERSION but got $EXTRACTED_VERSION"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Error: No suitable binary found for OS: $OS"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Setup Hugo
|
- name: Setup Hugo
|
||||||
|
Binary file not shown.
BIN
bin/ailog-linux-x86_64.tar.gz
Normal file
BIN
bin/ailog-linux-x86_64.tar.gz
Normal file
Binary file not shown.
Reference in New Issue
Block a user