From 9957d5efc12f5533115a12ba2cec2e51f2ed0fdc Mon Sep 17 00:00:00 2001 From: syui Date: Sat, 14 Jun 2025 17:19:26 +0900 Subject: [PATCH] Update action.yml to use pre-built binary ailog-linux-x86_64 --- action.yml | 55 ++++++++++++++++-------------------------------------- 1 file changed, 16 insertions(+), 39 deletions(-) diff --git a/action.yml b/action.yml index 566e722..6355d88 100644 --- a/action.yml +++ b/action.yml @@ -55,49 +55,26 @@ runs: restore-keys: | ailog-bin-${{ runner.os }} - - name: Check and update ailog binary + - name: Setup ailog binary shell: bash run: | - # Get latest release version (for Gitea, adjust API endpoint if needed) - if command -v curl >/dev/null 2>&1; then - LATEST_VERSION=$(curl -s https://api.github.com/repos/syui/ailog/releases/latest | jq -r .tag_name 2>/dev/null || echo "v0.1.1") + # Check if pre-built binary exists + if [ -f "./bin/ailog-linux-x86_64" ]; then + echo "Using pre-built binary from repository" + chmod +x ./bin/ailog-linux-x86_64 + CURRENT_VERSION=$(./bin/ailog-linux-x86_64 --version 2>/dev/null || echo "unknown") + echo "Binary version: $CURRENT_VERSION" else - LATEST_VERSION="v0.1.1" # fallback version - fi - echo "Target version: $LATEST_VERSION" - - # Check current binary version if exists - mkdir -p ./bin - if [ -f "./bin/ailog" ]; then - CURRENT_VERSION=$(./bin/ailog --version 2>/dev/null || echo "unknown") - echo "Current version: $CURRENT_VERSION" - else - CURRENT_VERSION="none" - echo "No binary found" - fi - - # Download if version is different or binary doesn't exist - if [ "$CURRENT_VERSION" != "${LATEST_VERSION#v}" ]; then - echo "Downloading ailog $LATEST_VERSION..." - # Try GitHub first, then fallback to local build - if curl -sL https://github.com/syui/ailog/releases/download/$LATEST_VERSION/ailog-linux-x86_64.tar.gz | tar -xzf - 2>/dev/null; then - mv ailog ./bin/ailog - chmod +x ./bin/ailog - echo "Downloaded binary: $(./bin/ailog --version 2>/dev/null)" + echo "No pre-built binary found, trying to build from source..." + if command -v cargo >/dev/null 2>&1; then + cargo build --release + mkdir -p ./bin + cp ./target/release/ailog ./bin/ailog-linux-x86_64 + echo "Built from source: $(./bin/ailog-linux-x86_64 --version 2>/dev/null)" else - echo "Download failed, building from source..." - if command -v cargo >/dev/null 2>&1; then - cargo build --release - cp ./target/release/ailog ./bin/ailog - echo "Built from source: $(./bin/ailog --version 2>/dev/null)" - else - echo "Error: Neither download nor cargo build available" - exit 1 - fi + echo "Error: No binary found and cargo not available" + exit 1 fi - else - echo "Binary is up to date" - chmod +x ./bin/ailog fi - name: Setup Node.js for OAuth app @@ -123,7 +100,7 @@ runs: run: | start_time=$(date +%s) - ./bin/ailog build \ + ./bin/ailog-linux-x86_64 build \ --content ${{ inputs.content-dir }} \ --output ${{ inputs.output-dir }} \ --templates ${{ inputs.template-dir }} \