4 Commits

Author SHA1 Message Date
2838e494d6 Update version to 0.1.3 and simplify version output
- Update Cargo.toml version to 0.1.3
- Custom version flag implementation to output version only
- Update GitHub Actions to handle simplified version output
- Update Gitea Actions (action.yml) for version handling
- Now `ailog -V` or `ailog --version` outputs just "0.1.3"

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-14 17:12:04 +09:00
5838adf5a6 Fix code block file path display for mobile
- Move file path from right-top overlay to top header bar
- Use block display instead of absolute positioning
- Add dedicated styling for filename header bar
- Adjust code padding when filename is present
- Optimize mobile responsiveness to prevent overlap

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-14 17:03:31 +09:00
f52249c292 Fix GitHub Actions permissions for release creation
- Add contents: write permission for private repository
- Remove Windows zip file references
- Simplify artifact upload paths
- Fix release workflow permissions for private repos

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-14 16:53:06 +09:00
aa70183d75 Fix cross-compilation issues and optimize release workflow
- Fix ARM64 cross-compilation with proper binutils
- Use target-specific strip commands
- Remove Windows/musl builds to reduce complexity
- Add 60-minute timeout for builds
- Optimize to 4 core platforms: Linux x86_64/ARM64, macOS Intel/ARM

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-14 16:42:28 +09:00
6 changed files with 116 additions and 57 deletions

View File

@ -35,7 +35,7 @@ jobs:
# Check current binary version if exists
mkdir -p ./bin
if [ -f "./bin/ailog" ]; then
CURRENT_VERSION=$(./bin/ailog --version | awk '{print $2}' || echo "unknown")
CURRENT_VERSION=$(./bin/ailog --version 2>/dev/null || echo "unknown")
echo "Current version: $CURRENT_VERSION"
else
CURRENT_VERSION="none"
@ -49,7 +49,7 @@ jobs:
https://github.com/${{ github.repository }}/releases/download/$LATEST_VERSION/ailog-linux-x86_64.tar.gz | tar -xzf -
mv ailog ./bin/ailog
chmod +x ./bin/ailog
echo "Updated to version: $(./bin/ailog --version)"
echo "Updated to version: $(./bin/ailog --version 2>/dev/null)"
else
echo "Binary is up to date"
chmod +x ./bin/ailog

View File

@ -11,6 +11,10 @@ on:
required: true
default: 'v0.1.0'
permissions:
contents: write
actions: read
env:
CARGO_TERM_COLOR: always
OPENSSL_STATIC: true
@ -20,6 +24,7 @@ jobs:
build:
name: Build ${{ matrix.target }}
runs-on: ${{ matrix.os }}
timeout-minutes: 60
strategy:
matrix:
include:
@ -27,10 +32,6 @@ jobs:
os: ubuntu-latest
artifact_name: ailog
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
os: ubuntu-latest
artifact_name: ailog
@ -43,10 +44,6 @@ jobs:
os: macos-latest
artifact_name: ailog
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:
- uses: actions/checkout@v4
@ -57,16 +54,10 @@ jobs:
targets: ${{ matrix.target }}
- name: Install cross-compilation tools (Linux)
if: matrix.os == 'ubuntu-latest'
if: matrix.os == 'ubuntu-latest' && matrix.target == 'aarch64-unknown-linux-gnu'
run: |
sudo apt-get update
sudo apt-get install -y gcc-multilib
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
sudo apt-get install -y gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu
- name: Configure cross-compilation (Linux ARM64)
if: matrix.target == 'aarch64-unknown-linux-gnu'
@ -95,11 +86,17 @@ jobs:
shell: bash
run: |
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
strip ${{ matrix.artifact_name }}
strip ${{ matrix.artifact_name }} || echo "Strip failed, continuing..."
fi
# Create archive
if [[ "${{ matrix.target }}" == *"windows"* ]]; then
7z a ../../../${{ matrix.asset_name }}.zip ${{ matrix.artifact_name }}
else
@ -110,14 +107,15 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.asset_name }}
path: |
${{ matrix.asset_name }}.tar.gz
${{ matrix.asset_name }}.zip
path: ${{ matrix.asset_name }}.tar.gz
release:
name: Create Release
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
actions: read
steps:
- uses: actions/checkout@v4
@ -137,9 +135,8 @@ jobs:
echo "- AI comment system" >> release_notes.md
echo "" >> 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 "- Windows (x86_64)" >> release_notes.md
echo "" >> release_notes.md
echo "### Installation" >> release_notes.md
echo "\`\`\`bash" >> release_notes.md
@ -148,8 +145,6 @@ jobs:
echo "chmod +x ailog" >> release_notes.md
echo "sudo mv ailog /usr/local/bin/" >> 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
- name: Get tag name
@ -169,8 +164,6 @@ jobs:
body_path: release_notes.md
draft: false
prerelease: ${{ contains(steps.tag_name.outputs.tag, 'alpha') || contains(steps.tag_name.outputs.tag, 'beta') || contains(steps.tag_name.outputs.tag, 'rc') }}
files: |
artifacts/*/ailog-*.tar.gz
artifacts/*/ailog-*.zip
files: artifacts/*/ailog-*.tar.gz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@ -1,6 +1,6 @@
[package]
name = "ailog"
version = "0.1.0"
version = "0.1.3"
edition = "2021"
authors = ["syui"]
description = "A static blog generator with AI features"

View File

@ -47,17 +47,57 @@ outputs:
runs:
using: 'composite'
steps:
- name: Setup Rust
uses: actions-rs/toolchain@v1
- name: Cache ailog binary
uses: actions/cache@v4
with:
toolchain: stable
override: true
path: ./bin
key: ailog-bin-${{ runner.os }}
restore-keys: |
ailog-bin-${{ runner.os }}
- name: Install ailog
- name: Check and update ailog binary
shell: bash
run: |
if [ ! -f "./target/release/ailog" ]; then
# 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")
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)"
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
fi
else
echo "Binary is up to date"
chmod +x ./bin/ailog
fi
- name: Setup Node.js for OAuth app
@ -83,8 +123,8 @@ runs:
run: |
start_time=$(date +%s)
./target/release/ailog generate \
--input ${{ inputs.content-dir }} \
./bin/ailog build \
--content ${{ inputs.content-dir }} \
--output ${{ inputs.output-dir }} \
--templates ${{ inputs.template-dir }} \
--static ${{ inputs.static-dir }} \

View File

@ -517,25 +517,21 @@ a.view-markdown:any-link {
margin: 16px 0;
font-size: 14px;
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 {
content: attr(data-filename);
position: absolute;
top: 0;
right: 0;
display: block;
background: #2D2D30;
color: #CCCCCC;
padding: 4px 12px;
color: #AE81FF;
padding: 8px 16px;
font-size: 12px;
font-family: 'SF Mono', 'Monaco', 'Cascadia Code', 'Roboto Mono', monospace;
border-bottom-left-radius: 4px;
border: 1px solid #3E3D32;
border-top: none;
border-right: none;
z-index: 1;
border-bottom: 1px solid #3E3D32;
margin: 0;
width: 100%;
box-sizing: border-box;
}
.article-body pre code {
@ -548,6 +544,11 @@ a.view-markdown:any-link {
line-height: 1.4;
}
/* Adjust padding when filename is present */
.article-body pre[data-filename] code {
padding: 16px;
}
/* Inline code (not in pre blocks) */
.article-body code {
background: var(--light-white);
@ -853,6 +854,16 @@ a.view-markdown:any-link {
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 {
word-break: break-all;
}

View File

@ -18,10 +18,14 @@ mod mcp;
#[derive(Parser)]
#[command(name = "ailog")]
#[command(about = "A static blog generator with AI features")]
#[command(version)]
#[command(disable_version_flag = true)]
struct Cli {
/// Print version information
#[arg(short = 'V', long = "version")]
version: bool,
#[command(subcommand)]
command: Commands,
command: Option<Commands>,
}
#[derive(Subcommand)]
@ -136,7 +140,18 @@ enum OauthCommands {
async fn main() -> Result<()> {
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::execute(path).await?;
}