Compare commits
12 Commits
v0.1.0
...
e1eb04620e
Author | SHA1 | Date | |
---|---|---|---|
e1eb04620e
|
|||
eb3feffd70
|
|||
bb7e4ea01d
|
|||
11f1b57a2d
|
|||
e033e8cc71
|
|||
9957d5efc1
|
|||
d458e53c79
|
|||
2838e494d6
|
|||
5838adf5a6
|
|||
f52249c292
|
|||
aa70183d75
|
|||
4ad1d3edf6
|
@@ -42,7 +42,10 @@
|
|||||||
"WebFetch(domain:syui.ai)",
|
"WebFetch(domain:syui.ai)",
|
||||||
"Bash(rustup target list:*)",
|
"Bash(rustup target list:*)",
|
||||||
"Bash(rustup target:*)",
|
"Bash(rustup target:*)",
|
||||||
"Bash(git add:*)"
|
"Bash(git add:*)",
|
||||||
|
"Bash(git commit:*)",
|
||||||
|
"Bash(git push:*)",
|
||||||
|
"Bash(git tag:*)"
|
||||||
],
|
],
|
||||||
"deny": []
|
"deny": []
|
||||||
}
|
}
|
||||||
|
51
.github/workflows/build-binary.yml
vendored
51
.github/workflows/build-binary.yml
vendored
@@ -1,51 +0,0 @@
|
|||||||
name: Build Binary
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_dispatch: # Manual trigger
|
|
||||||
push:
|
|
||||||
branches: [ main ]
|
|
||||||
paths:
|
|
||||||
- 'src/**'
|
|
||||||
- 'Cargo.toml'
|
|
||||||
- 'Cargo.lock'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Setup Rust
|
|
||||||
uses: actions-rs/toolchain@v1
|
|
||||||
with:
|
|
||||||
toolchain: stable
|
|
||||||
override: true
|
|
||||||
|
|
||||||
- name: Cache cargo registry
|
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
path: ~/.cargo/registry
|
|
||||||
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
|
|
||||||
|
|
||||||
- name: Cache cargo index
|
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
path: ~/.cargo/git
|
|
||||||
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
|
|
||||||
|
|
||||||
- name: Cache target directory
|
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
path: target
|
|
||||||
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
|
|
||||||
|
|
||||||
- name: Build binary
|
|
||||||
run: cargo build --release
|
|
||||||
|
|
||||||
- name: Upload binary
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: ailog-linux
|
|
||||||
path: target/release/ailog
|
|
||||||
retention-days: 30
|
|
54
.github/workflows/cloudflare-pages.yml
vendored
54
.github/workflows/cloudflare-pages.yml
vendored
@@ -38,18 +38,60 @@ jobs:
|
|||||||
cp -r oauth/dist/assets/* my-blog/static/assets/
|
cp -r oauth/dist/assets/* my-blog/static/assets/
|
||||||
cp oauth/dist/index.html my-blog/static/oauth/index.html || true
|
cp oauth/dist/index.html my-blog/static/oauth/index.html || true
|
||||||
|
|
||||||
- name: Setup Rust
|
- name: Cache ailog binary
|
||||||
uses: actions-rs/toolchain@v1
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
toolchain: stable
|
path: ./bin
|
||||||
|
key: ailog-bin-${{ runner.os }}
|
||||||
|
restore-keys: |
|
||||||
|
ailog-bin-${{ runner.os }}
|
||||||
|
|
||||||
- name: Build ailog
|
- name: Setup ailog binary
|
||||||
run: cargo build --release
|
run: |
|
||||||
|
# Get expected version from Cargo.toml
|
||||||
|
EXPECTED_VERSION=$(grep '^version' Cargo.toml | cut -d'"' -f2)
|
||||||
|
echo "Expected version from Cargo.toml: $EXPECTED_VERSION"
|
||||||
|
|
||||||
|
# Check current binary version if exists
|
||||||
|
if [ -f "./bin/ailog" ]; then
|
||||||
|
CURRENT_VERSION=$(./bin/ailog --version 2>/dev/null || echo "unknown")
|
||||||
|
echo "Current binary version: $CURRENT_VERSION"
|
||||||
|
else
|
||||||
|
CURRENT_VERSION="none"
|
||||||
|
echo "No binary found"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check OS
|
||||||
|
OS="${{ runner.os }}"
|
||||||
|
echo "Runner OS: $OS"
|
||||||
|
|
||||||
|
# Use pre-packaged binary if version matches or extract from tar.gz
|
||||||
|
if [ "$CURRENT_VERSION" = "$EXPECTED_VERSION" ]; then
|
||||||
|
echo "Binary is up to date"
|
||||||
|
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
|
||||||
|
|
||||||
- name: Build site with ailog
|
- name: Build site with ailog
|
||||||
run: |
|
run: |
|
||||||
cd my-blog
|
cd my-blog
|
||||||
../target/release/ailog build
|
../bin/ailog build
|
||||||
|
|
||||||
- name: List public directory
|
- name: List public directory
|
||||||
run: |
|
run: |
|
||||||
|
62
.github/workflows/gh-pages-fast.yml
vendored
62
.github/workflows/gh-pages-fast.yml
vendored
@@ -15,18 +15,55 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Get latest release
|
- name: Cache ailog binary
|
||||||
id: latest_release
|
uses: actions/cache@v4
|
||||||
run: |
|
with:
|
||||||
LATEST_TAG=$(curl -s https://api.github.com/repos/${{ github.repository }}/releases/latest | jq -r .tag_name)
|
path: ./bin
|
||||||
echo "tag=$LATEST_TAG" >> $GITHUB_OUTPUT
|
key: ailog-bin-${{ runner.os }}
|
||||||
|
restore-keys: |
|
||||||
|
ailog-bin-${{ runner.os }}
|
||||||
|
|
||||||
- name: Download pre-built binary from release
|
- name: Setup ailog binary
|
||||||
run: |
|
run: |
|
||||||
curl -sL https://github.com/${{ github.repository }}/releases/download/${{ steps.latest_release.outputs.tag }}/ailog-linux-x86_64.tar.gz | tar -xzf -
|
# Get expected version from Cargo.toml
|
||||||
chmod +x ailog
|
EXPECTED_VERSION=$(grep '^version' Cargo.toml | cut -d'"' -f2)
|
||||||
mkdir -p ./bin
|
echo "Expected version from Cargo.toml: $EXPECTED_VERSION"
|
||||||
mv ailog ./bin/
|
|
||||||
|
# Check current binary version if exists
|
||||||
|
if [ -f "./bin/ailog" ]; then
|
||||||
|
CURRENT_VERSION=$(./bin/ailog --version 2>/dev/null || echo "unknown")
|
||||||
|
echo "Current binary version: $CURRENT_VERSION"
|
||||||
|
else
|
||||||
|
CURRENT_VERSION="none"
|
||||||
|
echo "No binary found"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check OS
|
||||||
|
OS="${{ runner.os }}"
|
||||||
|
echo "Runner OS: $OS"
|
||||||
|
|
||||||
|
# Use pre-packaged binary if version matches or extract from tar.gz
|
||||||
|
if [ "$CURRENT_VERSION" = "$EXPECTED_VERSION" ]; then
|
||||||
|
echo "Binary is up to date"
|
||||||
|
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
|
||||||
|
|
||||||
- name: Setup Hugo
|
- name: Setup Hugo
|
||||||
uses: peaceiris/actions-hugo@v3
|
uses: peaceiris/actions-hugo@v3
|
||||||
@@ -39,12 +76,13 @@ jobs:
|
|||||||
TZ: "Asia/Tokyo"
|
TZ: "Asia/Tokyo"
|
||||||
run: |
|
run: |
|
||||||
# Use pre-built ailog binary instead of cargo build
|
# Use pre-built ailog binary instead of cargo build
|
||||||
./bin/ailog build --output ./public
|
cd my-blog
|
||||||
|
../bin/ailog build
|
||||||
touch ./public/.nojekyll
|
touch ./public/.nojekyll
|
||||||
|
|
||||||
- name: Deploy
|
- name: Deploy
|
||||||
uses: peaceiris/actions-gh-pages@v3
|
uses: peaceiris/actions-gh-pages@v3
|
||||||
with:
|
with:
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
publish_dir: ./public
|
publish_dir: ./my-blog/public
|
||||||
publish_branch: gh-pages
|
publish_branch: gh-pages
|
53
.github/workflows/release.yml
vendored
53
.github/workflows/release.yml
vendored
@@ -11,13 +11,20 @@ on:
|
|||||||
required: true
|
required: true
|
||||||
default: 'v0.1.0'
|
default: 'v0.1.0'
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
actions: read
|
||||||
|
|
||||||
env:
|
env:
|
||||||
CARGO_TERM_COLOR: always
|
CARGO_TERM_COLOR: always
|
||||||
|
OPENSSL_STATIC: true
|
||||||
|
OPENSSL_VENDOR: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: Build ${{ matrix.target }}
|
name: Build ${{ matrix.target }}
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
|
timeout-minutes: 60
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
@@ -25,10 +32,6 @@ jobs:
|
|||||||
os: ubuntu-latest
|
os: ubuntu-latest
|
||||||
artifact_name: ailog
|
artifact_name: ailog
|
||||||
asset_name: ailog-linux-x86_64
|
asset_name: ailog-linux-x86_64
|
||||||
- target: x86_64-unknown-linux-musl
|
|
||||||
os: ubuntu-latest
|
|
||||||
artifact_name: ailog
|
|
||||||
asset_name: ailog-linux-x86_64-musl
|
|
||||||
- target: aarch64-unknown-linux-gnu
|
- target: aarch64-unknown-linux-gnu
|
||||||
os: ubuntu-latest
|
os: ubuntu-latest
|
||||||
artifact_name: ailog
|
artifact_name: ailog
|
||||||
@@ -41,10 +44,6 @@ jobs:
|
|||||||
os: macos-latest
|
os: macos-latest
|
||||||
artifact_name: ailog
|
artifact_name: ailog
|
||||||
asset_name: ailog-macos-aarch64
|
asset_name: ailog-macos-aarch64
|
||||||
- target: x86_64-pc-windows-msvc
|
|
||||||
os: windows-latest
|
|
||||||
artifact_name: ailog.exe
|
|
||||||
asset_name: ailog-windows-x86_64.exe
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
@@ -55,16 +54,10 @@ jobs:
|
|||||||
targets: ${{ matrix.target }}
|
targets: ${{ matrix.target }}
|
||||||
|
|
||||||
- name: Install cross-compilation tools (Linux)
|
- name: Install cross-compilation tools (Linux)
|
||||||
if: matrix.os == 'ubuntu-latest'
|
if: matrix.os == 'ubuntu-latest' && matrix.target == 'aarch64-unknown-linux-gnu'
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get install -y gcc-multilib
|
sudo apt-get install -y gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu
|
||||||
if [[ "${{ matrix.target }}" == "aarch64-unknown-linux-gnu" ]]; then
|
|
||||||
sudo apt-get install -y gcc-aarch64-linux-gnu
|
|
||||||
fi
|
|
||||||
if [[ "${{ matrix.target }}" == "x86_64-unknown-linux-musl" ]]; then
|
|
||||||
sudo apt-get install -y musl-tools
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Configure cross-compilation (Linux ARM64)
|
- name: Configure cross-compilation (Linux ARM64)
|
||||||
if: matrix.target == 'aarch64-unknown-linux-gnu'
|
if: matrix.target == 'aarch64-unknown-linux-gnu'
|
||||||
@@ -93,11 +86,17 @@ jobs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
cd target/${{ matrix.target }}/release
|
cd target/${{ matrix.target }}/release
|
||||||
if [[ "${{ matrix.os }}" == "windows-latest" ]]; then
|
|
||||||
strip ${{ matrix.artifact_name }} || true
|
# Use appropriate strip command for cross-compilation
|
||||||
|
if [[ "${{ matrix.target }}" == "aarch64-unknown-linux-gnu" ]]; then
|
||||||
|
aarch64-linux-gnu-strip ${{ matrix.artifact_name }} || echo "Strip failed, continuing..."
|
||||||
|
elif [[ "${{ matrix.os }}" == "windows-latest" ]]; then
|
||||||
|
strip ${{ matrix.artifact_name }} || echo "Strip failed, continuing..."
|
||||||
else
|
else
|
||||||
strip ${{ matrix.artifact_name }}
|
strip ${{ matrix.artifact_name }} || echo "Strip failed, continuing..."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Create archive
|
||||||
if [[ "${{ matrix.target }}" == *"windows"* ]]; then
|
if [[ "${{ matrix.target }}" == *"windows"* ]]; then
|
||||||
7z a ../../../${{ matrix.asset_name }}.zip ${{ matrix.artifact_name }}
|
7z a ../../../${{ matrix.asset_name }}.zip ${{ matrix.artifact_name }}
|
||||||
else
|
else
|
||||||
@@ -108,14 +107,15 @@ jobs:
|
|||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: ${{ matrix.asset_name }}
|
name: ${{ matrix.asset_name }}
|
||||||
path: |
|
path: ${{ matrix.asset_name }}.tar.gz
|
||||||
${{ matrix.asset_name }}.tar.gz
|
|
||||||
${{ matrix.asset_name }}.zip
|
|
||||||
|
|
||||||
release:
|
release:
|
||||||
name: Create Release
|
name: Create Release
|
||||||
needs: build
|
needs: build
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
actions: read
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
@@ -135,9 +135,8 @@ jobs:
|
|||||||
echo "- AI comment system" >> release_notes.md
|
echo "- AI comment system" >> release_notes.md
|
||||||
echo "" >> release_notes.md
|
echo "" >> release_notes.md
|
||||||
echo "### Platforms" >> release_notes.md
|
echo "### Platforms" >> release_notes.md
|
||||||
echo "- Linux (x86_64, aarch64, musl)" >> release_notes.md
|
echo "- Linux (x86_64, aarch64)" >> release_notes.md
|
||||||
echo "- macOS (Intel, Apple Silicon)" >> release_notes.md
|
echo "- macOS (Intel, Apple Silicon)" >> release_notes.md
|
||||||
echo "- Windows (x86_64)" >> release_notes.md
|
|
||||||
echo "" >> release_notes.md
|
echo "" >> release_notes.md
|
||||||
echo "### Installation" >> release_notes.md
|
echo "### Installation" >> release_notes.md
|
||||||
echo "\`\`\`bash" >> release_notes.md
|
echo "\`\`\`bash" >> release_notes.md
|
||||||
@@ -146,8 +145,6 @@ jobs:
|
|||||||
echo "chmod +x ailog" >> release_notes.md
|
echo "chmod +x ailog" >> release_notes.md
|
||||||
echo "sudo mv ailog /usr/local/bin/" >> release_notes.md
|
echo "sudo mv ailog /usr/local/bin/" >> release_notes.md
|
||||||
echo "" >> release_notes.md
|
echo "" >> release_notes.md
|
||||||
echo "# Windows" >> release_notes.md
|
|
||||||
echo "# Extract ailog-windows-x86_64.zip and add to PATH" >> release_notes.md
|
|
||||||
echo "\`\`\`" >> release_notes.md
|
echo "\`\`\`" >> release_notes.md
|
||||||
|
|
||||||
- name: Get tag name
|
- name: Get tag name
|
||||||
@@ -167,8 +164,6 @@ jobs:
|
|||||||
body_path: release_notes.md
|
body_path: release_notes.md
|
||||||
draft: false
|
draft: false
|
||||||
prerelease: ${{ contains(steps.tag_name.outputs.tag, 'alpha') || contains(steps.tag_name.outputs.tag, 'beta') || contains(steps.tag_name.outputs.tag, 'rc') }}
|
prerelease: ${{ contains(steps.tag_name.outputs.tag, 'alpha') || contains(steps.tag_name.outputs.tag, 'beta') || contains(steps.tag_name.outputs.tag, 'rc') }}
|
||||||
files: |
|
files: artifacts/*/ailog-*.tar.gz
|
||||||
artifacts/*/ailog-*.tar.gz
|
|
||||||
artifacts/*/ailog-*.zip
|
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
10
Cargo.toml
10
Cargo.toml
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "ailog"
|
name = "ailog"
|
||||||
version = "0.1.0"
|
version = "0.1.4"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
authors = ["syui"]
|
authors = ["syui"]
|
||||||
description = "A static blog generator with AI features"
|
description = "A static blog generator with AI features"
|
||||||
@@ -26,7 +26,7 @@ fs_extra = "1.3"
|
|||||||
colored = "2.1"
|
colored = "2.1"
|
||||||
serde_yaml = "0.9"
|
serde_yaml = "0.9"
|
||||||
syntect = "5.2"
|
syntect = "5.2"
|
||||||
reqwest = { version = "0.12", features = ["json"] }
|
reqwest = { version = "0.12", features = ["json", "rustls-tls"], default-features = false }
|
||||||
rand = "0.8"
|
rand = "0.8"
|
||||||
sha2 = "0.10"
|
sha2 = "0.10"
|
||||||
base64 = "0.22"
|
base64 = "0.22"
|
||||||
@@ -43,12 +43,12 @@ cookie = "0.18"
|
|||||||
syn = { version = "2.0", features = ["full", "parsing", "visit"] }
|
syn = { version = "2.0", features = ["full", "parsing", "visit"] }
|
||||||
quote = "1.0"
|
quote = "1.0"
|
||||||
ignore = "0.4"
|
ignore = "0.4"
|
||||||
git2 = "0.18"
|
git2 = { version = "0.18", features = ["vendored-openssl", "vendored-libgit2", "ssh"], default-features = false }
|
||||||
regex = "1.0"
|
regex = "1.0"
|
||||||
# ATProto and stream monitoring dependencies
|
# ATProto and stream monitoring dependencies
|
||||||
tokio-tungstenite = { version = "0.21", features = ["native-tls"] }
|
tokio-tungstenite = { version = "0.21", features = ["rustls-tls-webpki-roots", "connect"], default-features = false }
|
||||||
futures-util = "0.3"
|
futures-util = "0.3"
|
||||||
tungstenite = { version = "0.21", features = ["native-tls"] }
|
tungstenite = { version = "0.21", features = ["rustls-tls-webpki-roots"], default-features = false }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
tempfile = "3.14"
|
tempfile = "3.14"
|
||||||
|
46
action.yml
46
action.yml
@@ -47,17 +47,34 @@ outputs:
|
|||||||
runs:
|
runs:
|
||||||
using: 'composite'
|
using: 'composite'
|
||||||
steps:
|
steps:
|
||||||
- name: Setup Rust
|
- name: Cache ailog binary
|
||||||
uses: actions-rs/toolchain@v1
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
toolchain: stable
|
path: ./bin
|
||||||
override: true
|
key: ailog-bin-${{ runner.os }}
|
||||||
|
restore-keys: |
|
||||||
|
ailog-bin-${{ runner.os }}
|
||||||
|
|
||||||
- name: Install ailog
|
- name: Setup ailog binary
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
if [ ! -f "./target/release/ailog" ]; then
|
# Check if pre-built binary exists
|
||||||
cargo build --release
|
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
|
||||||
|
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 "Error: No binary found and cargo not available"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Setup Node.js for OAuth app
|
- name: Setup Node.js for OAuth app
|
||||||
@@ -83,12 +100,15 @@ runs:
|
|||||||
run: |
|
run: |
|
||||||
start_time=$(date +%s)
|
start_time=$(date +%s)
|
||||||
|
|
||||||
./target/release/ailog generate \
|
# Change to blog directory and run build
|
||||||
--input ${{ inputs.content-dir }} \
|
# Note: ailog build only takes a path argument, not options
|
||||||
--output ${{ inputs.output-dir }} \
|
if [ -d "my-blog" ]; then
|
||||||
--templates ${{ inputs.template-dir }} \
|
cd my-blog
|
||||||
--static ${{ inputs.static-dir }} \
|
../bin/ailog-linux-x86_64 build
|
||||||
--config ${{ inputs.config-file }}
|
else
|
||||||
|
# If no my-blog directory, use current directory
|
||||||
|
./bin/ailog-linux-x86_64 build .
|
||||||
|
fi
|
||||||
|
|
||||||
end_time=$(date +%s)
|
end_time=$(date +%s)
|
||||||
build_time=$((end_time - start_time))
|
build_time=$((end_time - start_time))
|
||||||
|
BIN
bin/ailog-linux-x86_64.tar.gz
Normal file
BIN
bin/ailog-linux-x86_64.tar.gz
Normal file
Binary file not shown.
@@ -517,25 +517,21 @@ a.view-markdown:any-link {
|
|||||||
margin: 16px 0;
|
margin: 16px 0;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
|
||||||
position: relative;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* File name display for code blocks */
|
/* File name display for code blocks - top bar style */
|
||||||
.article-body pre[data-filename]::before {
|
.article-body pre[data-filename]::before {
|
||||||
content: attr(data-filename);
|
content: attr(data-filename);
|
||||||
position: absolute;
|
display: block;
|
||||||
top: 0;
|
|
||||||
right: 0;
|
|
||||||
background: #2D2D30;
|
background: #2D2D30;
|
||||||
color: #CCCCCC;
|
color: #AE81FF;
|
||||||
padding: 4px 12px;
|
padding: 8px 16px;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
font-family: 'SF Mono', 'Monaco', 'Cascadia Code', 'Roboto Mono', monospace;
|
font-family: 'SF Mono', 'Monaco', 'Cascadia Code', 'Roboto Mono', monospace;
|
||||||
border-bottom-left-radius: 4px;
|
border-bottom: 1px solid #3E3D32;
|
||||||
border: 1px solid #3E3D32;
|
margin: 0;
|
||||||
border-top: none;
|
width: 100%;
|
||||||
border-right: none;
|
box-sizing: border-box;
|
||||||
z-index: 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.article-body pre code {
|
.article-body pre code {
|
||||||
@@ -548,6 +544,11 @@ a.view-markdown:any-link {
|
|||||||
line-height: 1.4;
|
line-height: 1.4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Adjust padding when filename is present */
|
||||||
|
.article-body pre[data-filename] code {
|
||||||
|
padding: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
/* Inline code (not in pre blocks) */
|
/* Inline code (not in pre blocks) */
|
||||||
.article-body code {
|
.article-body code {
|
||||||
background: var(--light-white);
|
background: var(--light-white);
|
||||||
@@ -853,6 +854,16 @@ a.view-markdown:any-link {
|
|||||||
white-space: pre-wrap;
|
white-space: pre-wrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Mobile filename display */
|
||||||
|
.article-body pre[data-filename]::before {
|
||||||
|
padding: 6px 12px;
|
||||||
|
font-size: 11px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.article-body pre[data-filename] code {
|
||||||
|
padding: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
.article-body code {
|
.article-body code {
|
||||||
word-break: break-all;
|
word-break: break-all;
|
||||||
}
|
}
|
||||||
|
21
src/main.rs
21
src/main.rs
@@ -18,10 +18,14 @@ mod mcp;
|
|||||||
#[derive(Parser)]
|
#[derive(Parser)]
|
||||||
#[command(name = "ailog")]
|
#[command(name = "ailog")]
|
||||||
#[command(about = "A static blog generator with AI features")]
|
#[command(about = "A static blog generator with AI features")]
|
||||||
#[command(version)]
|
#[command(disable_version_flag = true)]
|
||||||
struct Cli {
|
struct Cli {
|
||||||
|
/// Print version information
|
||||||
|
#[arg(short = 'V', long = "version")]
|
||||||
|
version: bool,
|
||||||
|
|
||||||
#[command(subcommand)]
|
#[command(subcommand)]
|
||||||
command: Commands,
|
command: Option<Commands>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Subcommand)]
|
#[derive(Subcommand)]
|
||||||
@@ -136,7 +140,18 @@ enum OauthCommands {
|
|||||||
async fn main() -> Result<()> {
|
async fn main() -> Result<()> {
|
||||||
let cli = Cli::parse();
|
let cli = Cli::parse();
|
||||||
|
|
||||||
match cli.command {
|
// Handle version flag
|
||||||
|
if cli.version {
|
||||||
|
println!("{}", env!("CARGO_PKG_VERSION"));
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Require subcommand if no version flag
|
||||||
|
let command = cli.command.ok_or_else(|| {
|
||||||
|
anyhow::anyhow!("No subcommand provided. Use --help for usage information.")
|
||||||
|
})?;
|
||||||
|
|
||||||
|
match command {
|
||||||
Commands::Init { path } => {
|
Commands::Init { path } => {
|
||||||
commands::init::execute(path).await?;
|
commands::init::execute(path).await?;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user