From 4ad1d3edf66a408cf256b15505635d2f47b41d65 Mon Sep 17 00:00:00 2001 From: syui Date: Sat, 14 Jun 2025 16:26:36 +0900 Subject: [PATCH] Fix cross-compilation issues and private repo access MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Replace native-tls with rustls-tls for cross-platform compatibility - Add vendored OpenSSL/libgit2 features for static linking - Add connect feature to tokio-tungstenite - Add GITHUB_TOKEN authentication for private repo access - Add smart binary caching with version checking workflow 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- .claude/settings.local.json | 5 +++- .github/workflows/gh-pages-fast.yml | 45 +++++++++++++++++++++++------ .github/workflows/release.yml | 2 ++ Cargo.toml | 8 ++--- 4 files changed, 46 insertions(+), 14 deletions(-) diff --git a/.claude/settings.local.json b/.claude/settings.local.json index 16b7954..ce70d71 100644 --- a/.claude/settings.local.json +++ b/.claude/settings.local.json @@ -42,7 +42,10 @@ "WebFetch(domain:syui.ai)", "Bash(rustup target list:*)", "Bash(rustup target:*)", - "Bash(git add:*)" + "Bash(git add:*)", + "Bash(git commit:*)", + "Bash(git push:*)", + "Bash(git tag:*)" ], "deny": [] } diff --git a/.github/workflows/gh-pages-fast.yml b/.github/workflows/gh-pages-fast.yml index d9bc488..b64ade9 100644 --- a/.github/workflows/gh-pages-fast.yml +++ b/.github/workflows/gh-pages-fast.yml @@ -15,18 +15,45 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Get latest release - id: latest_release + - name: Cache ailog binary + uses: actions/cache@v4 + with: + path: ./bin + key: ailog-bin-${{ runner.os }} + restore-keys: | + ailog-bin-${{ runner.os }} + + - name: Check and update ailog binary + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - LATEST_TAG=$(curl -s https://api.github.com/repos/${{ github.repository }}/releases/latest | jq -r .tag_name) - echo "tag=$LATEST_TAG" >> $GITHUB_OUTPUT + # Get latest release version + LATEST_VERSION=$(curl -s -H "Authorization: Bearer $GITHUB_TOKEN" \ + https://api.github.com/repos/${{ github.repository }}/releases/latest | jq -r .tag_name) + echo "Latest version: $LATEST_VERSION" - - name: Download pre-built binary from release - run: | - curl -sL https://github.com/${{ github.repository }}/releases/download/${{ steps.latest_release.outputs.tag }}/ailog-linux-x86_64.tar.gz | tar -xzf - - chmod +x ailog + # Check current binary version if exists mkdir -p ./bin - mv ailog ./bin/ + if [ -f "./bin/ailog" ]; then + CURRENT_VERSION=$(./bin/ailog --version | awk '{print $2}' || 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..." + curl -sL -H "Authorization: Bearer $GITHUB_TOKEN" \ + 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)" + else + echo "Binary is up to date" + chmod +x ./bin/ailog + fi - name: Setup Hugo uses: peaceiris/actions-hugo@v3 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3a7e86e..5f2da99 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,6 +13,8 @@ on: env: CARGO_TERM_COLOR: always + OPENSSL_STATIC: true + OPENSSL_VENDOR: true jobs: build: diff --git a/Cargo.toml b/Cargo.toml index 10b870a..967ebfd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,7 +26,7 @@ fs_extra = "1.3" colored = "2.1" serde_yaml = "0.9" syntect = "5.2" -reqwest = { version = "0.12", features = ["json"] } +reqwest = { version = "0.12", features = ["json", "rustls-tls"], default-features = false } rand = "0.8" sha2 = "0.10" base64 = "0.22" @@ -43,12 +43,12 @@ cookie = "0.18" syn = { version = "2.0", features = ["full", "parsing", "visit"] } quote = "1.0" ignore = "0.4" -git2 = "0.18" +git2 = { version = "0.18", features = ["vendored-openssl", "vendored-libgit2", "ssh"], default-features = false } regex = "1.0" # 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" -tungstenite = { version = "0.21", features = ["native-tls"] } +tungstenite = { version = "0.21", features = ["rustls-tls-webpki-roots"], default-features = false } [dev-dependencies] tempfile = "3.14"