Update action.yml to use pre-built binary ailog-linux-x86_64
This commit is contained in:
55
action.yml
55
action.yml
@@ -55,49 +55,26 @@ runs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
ailog-bin-${{ runner.os }}
|
ailog-bin-${{ runner.os }}
|
||||||
|
|
||||||
- name: Check and update ailog binary
|
- name: Setup ailog binary
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
# Get latest release version (for Gitea, adjust API endpoint if needed)
|
# Check if pre-built binary exists
|
||||||
if command -v curl >/dev/null 2>&1; then
|
if [ -f "./bin/ailog-linux-x86_64" ]; 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")
|
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
|
else
|
||||||
LATEST_VERSION="v0.1.1" # fallback version
|
echo "No pre-built binary found, trying to build from source..."
|
||||||
fi
|
if command -v cargo >/dev/null 2>&1; then
|
||||||
echo "Target version: $LATEST_VERSION"
|
cargo build --release
|
||||||
|
mkdir -p ./bin
|
||||||
# Check current binary version if exists
|
cp ./target/release/ailog ./bin/ailog-linux-x86_64
|
||||||
mkdir -p ./bin
|
echo "Built from source: $(./bin/ailog-linux-x86_64 --version 2>/dev/null)"
|
||||||
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)"
|
|
||||||
else
|
else
|
||||||
echo "Download failed, building from source..."
|
echo "Error: No binary found and cargo not available"
|
||||||
if command -v cargo >/dev/null 2>&1; then
|
exit 1
|
||||||
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
|
|
||||||
fi
|
fi
|
||||||
else
|
|
||||||
echo "Binary is up to date"
|
|
||||||
chmod +x ./bin/ailog
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Setup Node.js for OAuth app
|
- name: Setup Node.js for OAuth app
|
||||||
@@ -123,7 +100,7 @@ runs:
|
|||||||
run: |
|
run: |
|
||||||
start_time=$(date +%s)
|
start_time=$(date +%s)
|
||||||
|
|
||||||
./bin/ailog build \
|
./bin/ailog-linux-x86_64 build \
|
||||||
--content ${{ inputs.content-dir }} \
|
--content ${{ inputs.content-dir }} \
|
||||||
--output ${{ inputs.output-dir }} \
|
--output ${{ inputs.output-dir }} \
|
||||||
--templates ${{ inputs.template-dir }} \
|
--templates ${{ inputs.template-dir }} \
|
||||||
|
Reference in New Issue
Block a user