Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e9a5f0a57e | ||
|
|
075eedc13b | ||
|
|
5b3d1af415 | ||
|
|
41508bcc7f | ||
|
|
7af1c37577 | ||
|
|
f8cd6b1d17 | ||
|
|
df48965e02 | ||
|
|
cd19407f29 | ||
|
|
e321271734 | ||
|
|
0dd7c30b62 | ||
|
|
7cc5e141c7 |
99
.gitea/workflows/build.yml
Normal file
99
.gitea/workflows/build.yml
Normal file
@@ -0,0 +1,99 @@
|
|||||||
|
name: Build Windows
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- 'v*'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: Build Windows
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
# 使用 git clone 而非 actions/checkout
|
||||||
|
- name: Clone repository
|
||||||
|
run: |
|
||||||
|
URL="${GITEA_SERVER_URL}/${GITEA_REPOSITORY}.git"
|
||||||
|
git clone $URL .
|
||||||
|
git checkout ${{ gitea.sha }}
|
||||||
|
|
||||||
|
- name: Install Rust
|
||||||
|
run: |
|
||||||
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal
|
||||||
|
source $HOME/.cargo/env
|
||||||
|
# 添加 Windows MSVC 目标(xwin 需要)
|
||||||
|
rustup target add x86_64-pc-windows-msvc
|
||||||
|
|
||||||
|
- name: Install xwin (MinGW CRT)
|
||||||
|
run: |
|
||||||
|
source $HOME/.cargo/env
|
||||||
|
# 安装 xwin(需要 x86_64-pc-windows-msvc 目标)
|
||||||
|
cargo install xwin
|
||||||
|
|
||||||
|
- name: Download MinGW CRT
|
||||||
|
run: |
|
||||||
|
source $HOME/.cargo/env
|
||||||
|
# 下载预编译的 MinGW CRT
|
||||||
|
xwin download --accept-license
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: |
|
||||||
|
source $HOME/.cargo/env
|
||||||
|
|
||||||
|
# 设置 xwin 环境变量
|
||||||
|
export CARGO_TARGET_X86_64_PC_WINDOWS_MSVC_LINKER=xwin-link
|
||||||
|
export CARGO_TARGET_X86_64_PC_WINDOWS_MSVC_AR=xwin-lib
|
||||||
|
export CARGO_TARGET_X86_64_PC_WINDOWS_MSVC_RANLIB=true
|
||||||
|
|
||||||
|
# 使用 xwin 提供的 SDK
|
||||||
|
export XWIN_PATH=$HOME/.cache/xwin
|
||||||
|
|
||||||
|
cargo build --release --target x86_64-pc-windows-msvc
|
||||||
|
|
||||||
|
- name: Package
|
||||||
|
run: |
|
||||||
|
mkdir -p dist
|
||||||
|
cp target/x86_64-pc-windows-msvc/release/readflow.exe dist/
|
||||||
|
cd dist
|
||||||
|
echo "ReadFlow for Windows" > README.txt
|
||||||
|
echo "Version: ${GITEA_REF_NAME}" >> README.txt
|
||||||
|
echo "Built with: xwin + MSVC" >> README.txt
|
||||||
|
echo "Date: $(date)" >> README.txt
|
||||||
|
zip -r readflow-windows-x86_64.zip readflow.exe README.txt
|
||||||
|
|
||||||
|
- name: Upload to Release
|
||||||
|
run: |
|
||||||
|
TAG="${GITEA_REF_NAME}"
|
||||||
|
TOKEN="${GITEA_TOKEN}"
|
||||||
|
URL="${GITEA_SERVER_URL}"
|
||||||
|
REPO="${GITEA_REPOSITORY}"
|
||||||
|
|
||||||
|
# Get or create release
|
||||||
|
RELEASE=$(curl -s "${URL}/api/v1/repos/${REPO}/releases/tags/${TAG}" \
|
||||||
|
-H "Authorization: token ${TOKEN}")
|
||||||
|
|
||||||
|
RELEASE_ID=$(echo $RELEASE | jq -r '.id')
|
||||||
|
|
||||||
|
if [ "$RELEASE_ID" == "null" ] || [ -z "$RELEASE_ID" ]; then
|
||||||
|
RELEASE_ID=$(curl -s -X POST "${URL}/api/v1/repos/${REPO}/releases" \
|
||||||
|
-H "Authorization: token ${TOKEN}" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d "{\"tag_name\": \"${TAG}\", \"name\": \"ReadFlow ${TAG}\", \"body\": \"Release ${TAG}\\n\\nBuilt with xwin (预编译 MinGW CRT)\", \"draft\": false}" \
|
||||||
|
| jq -r '.id')
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Release ID: ${RELEASE_ID}"
|
||||||
|
|
||||||
|
# Upload asset
|
||||||
|
curl -s -X POST "${URL}/api/v1/repos/${REPO}/releases/${RELEASE_ID}/assets?name=readflow-windows-x86_64.zip" \
|
||||||
|
-H "Authorization: token ${TOKEN}" \
|
||||||
|
-H "Content-Type: application/zip" \
|
||||||
|
--data-binary @dist/readflow-windows-x86_64.zip
|
||||||
|
|
||||||
|
echo "✅ Upload completed!"
|
||||||
|
env:
|
||||||
|
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||||
|
GITEA_SERVER_URL: http://192.168.120.110:4000
|
||||||
|
GITEA_REPOSITORY: damai/readflow
|
||||||
|
GITEA_REF_NAME: ${{ gitea.ref_name }}
|
||||||
@@ -1,197 +0,0 @@
|
|||||||
name: Release Build
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- 'v*'
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
env:
|
|
||||||
CARGO_TERM_COLOR: always
|
|
||||||
RUST_BACKTRACE: 1
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build-windows:
|
|
||||||
name: Build Windows
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Setup Rust toolchain
|
|
||||||
uses: actions-rs/toolchain@v1
|
|
||||||
with:
|
|
||||||
target: x86_64-pc-windows-gnu
|
|
||||||
profile: minimal
|
|
||||||
components: rustfmt, clippy
|
|
||||||
|
|
||||||
- name: Install MinGW
|
|
||||||
run: sudo apt-get update && sudo apt-get install -y mingw-w64
|
|
||||||
|
|
||||||
- name: Cache cargo registry
|
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
path: ~/.cargo/registry
|
|
||||||
key: ubuntu-cargo-registry-windows-${{ hashFiles('**/Cargo.lock') }}
|
|
||||||
|
|
||||||
- name: Build release
|
|
||||||
run: cargo build --release --target x86_64-pc-windows-gnu
|
|
||||||
|
|
||||||
- name: Package Windows
|
|
||||||
run: |
|
|
||||||
mkdir -p release
|
|
||||||
cp target/x86_64-pc-windows-gnu/release/readflow.exe release/
|
|
||||||
# Create README
|
|
||||||
cat > release/README.txt << 'EOF'
|
|
||||||
ReadFlow v${{ github.ref_name }} for Windows
|
|
||||||
|
|
||||||
快速开始:
|
|
||||||
1. 解压到任意目录
|
|
||||||
2. 双击运行 readflow.exe
|
|
||||||
|
|
||||||
功能:
|
|
||||||
- EPUB/MOBI/Markdown/PDF 阅读
|
|
||||||
- 20+ 编程语言语法高亮
|
|
||||||
- 双语翻译对照
|
|
||||||
- 笔记与书签系统
|
|
||||||
- 插件系统
|
|
||||||
- 主题商店
|
|
||||||
|
|
||||||
技术支持:damai@foshanhuiya.com
|
|
||||||
EOF
|
|
||||||
cd release
|
|
||||||
zip -r ../readflow-${{ github.ref_name }}-windows-x86_64.zip .
|
|
||||||
|
|
||||||
- name: Upload to Release
|
|
||||||
uses: softprops/action-gh-release@v2
|
|
||||||
with:
|
|
||||||
name: Windows x86_64
|
|
||||||
files: readflow-${{ github.ref_name }}-windows-x86_64.zip
|
|
||||||
tag_name: ${{ github.ref_name }}
|
|
||||||
token: ${{ secrets.GITEA_TOKEN }}
|
|
||||||
fail_on_unmatched_files: true
|
|
||||||
env:
|
|
||||||
GITHUB_SERVER_URL: http://192.168.120.110:4000
|
|
||||||
GITHUB_REPOSITORY: damai/readflow
|
|
||||||
|
|
||||||
build-linux:
|
|
||||||
name: Build Linux
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Setup Rust toolchain
|
|
||||||
uses: actions-rs/toolchain@v1
|
|
||||||
with:
|
|
||||||
target: x86_64-unknown-linux-gnu
|
|
||||||
profile: minimal
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: sudo apt-get update && sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf
|
|
||||||
|
|
||||||
- name: Build release
|
|
||||||
run: cargo build --release --target x86_64-unknown-linux-gnu
|
|
||||||
|
|
||||||
- name: Package Linux
|
|
||||||
run: |
|
|
||||||
mkdir -p release
|
|
||||||
cp target/x86_64-unknown-linux-gnu/release/readflow release/
|
|
||||||
chmod +x release/readflow
|
|
||||||
# Create .desktop file
|
|
||||||
cat > release/readflow.desktop << 'EOF'
|
|
||||||
[Desktop Entry]
|
|
||||||
Name=ReadFlow
|
|
||||||
Comment=ReadFlow - 面向开发者和知识工作者的阅读工具
|
|
||||||
Exec=readflow
|
|
||||||
Icon=readflow
|
|
||||||
Terminal=false
|
|
||||||
Type=Application
|
|
||||||
Categories=Utility;Reading;
|
|
||||||
EOF
|
|
||||||
cd release
|
|
||||||
tar -czf ../readflow-${{ github.ref_name }}-linux-x86_64.tar.gz readflow readflow.desktop
|
|
||||||
|
|
||||||
- name: Upload to Release
|
|
||||||
uses: softprops/action-gh-release@v2
|
|
||||||
with:
|
|
||||||
name: Linux x86_64
|
|
||||||
files: readflow-${{ github.ref_name }}-linux-x86_64.tar.gz
|
|
||||||
tag_name: ${{ github.ref_name }}
|
|
||||||
token: ${{ secrets.GITEA_TOKEN }}
|
|
||||||
fail_on_unmatched_files: true
|
|
||||||
env:
|
|
||||||
GITHUB_SERVER_URL: http://192.168.120.110:4000
|
|
||||||
GITHUB_REPOSITORY: damai/readflow
|
|
||||||
|
|
||||||
build-macos:
|
|
||||||
name: Build macOS
|
|
||||||
runs-on: macos-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Setup Rust toolchain
|
|
||||||
uses: actions-rs/toolchain@v1
|
|
||||||
with:
|
|
||||||
target: x86_64-apple-darwin
|
|
||||||
profile: minimal
|
|
||||||
|
|
||||||
- name: Build release
|
|
||||||
run: cargo build --release --target x86_64-apple-darwin
|
|
||||||
|
|
||||||
- name: Package macOS
|
|
||||||
run: |
|
|
||||||
mkdir -p release/ReadFlow.app/Contents/MacOS
|
|
||||||
mkdir -p release/ReadFlow.app/Contents/Resources
|
|
||||||
cp target/release/readflow release/ReadFlow.app/Contents/MacOS/
|
|
||||||
chmod +x release/ReadFlow.app/Contents/MacOS/readflow
|
|
||||||
|
|
||||||
# Create Info.plist
|
|
||||||
cat > release/ReadFlow.app/Contents/Info.plist << 'EOF'
|
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
||||||
<plist version="1.0">
|
|
||||||
<dict>
|
|
||||||
<key>CFBundleExecutable</key>
|
|
||||||
<string>readflow</string>
|
|
||||||
<key>CFBundleIdentifier</key>
|
|
||||||
<string>com.readflow.app</string>
|
|
||||||
<key>CFBundleName</key>
|
|
||||||
<string>ReadFlow</string>
|
|
||||||
<key>CFBundleDisplayName</key>
|
|
||||||
<string>ReadFlow</string>
|
|
||||||
<key>CFBundleShortVersionString</key>
|
|
||||||
<string>${{ github.ref_name }}</string>
|
|
||||||
<key>CFBundleVersion</key>
|
|
||||||
<string>${{ github.ref_name }}</string>
|
|
||||||
<key>CFBundlePackageType</key>
|
|
||||||
<string>APPL</string>
|
|
||||||
<key>NSHighResolutionCapable</key>
|
|
||||||
<true/>
|
|
||||||
</dict>
|
|
||||||
</plist>
|
|
||||||
EOF
|
|
||||||
|
|
||||||
# Copy assets
|
|
||||||
if [ -d "assets" ]; then
|
|
||||||
cp -r assets release/ReadFlow.app/Contents/Resources/
|
|
||||||
fi
|
|
||||||
|
|
||||||
cd release
|
|
||||||
zip -r -X ../readflow-${{ github.ref_name }}-macos-x86_64.zip ReadFlow.app
|
|
||||||
|
|
||||||
- name: Upload to Release
|
|
||||||
uses: softprops/action-gh-release@v2
|
|
||||||
with:
|
|
||||||
name: macOS x86_64
|
|
||||||
files: readflow-${{ github.ref_name }}-macos-x86_64.zip
|
|
||||||
tag_name: ${{ github.ref_name }}
|
|
||||||
token: ${{ secrets.GITEA_TOKEN }}
|
|
||||||
fail_on_unmatched_files: true
|
|
||||||
env:
|
|
||||||
GITHUB_SERVER_URL: http://192.168.120.110:4000
|
|
||||||
GITHUB_REPOSITORY: damai/readflow
|
|
||||||
35
.gitea/workflows/test.yml
Normal file
35
.gitea/workflows/test.yml
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
name: Test Workflow
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- 'v*'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
name: Test Environment
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Print environment variables
|
||||||
|
run: |
|
||||||
|
echo "=== Environment Variables ==="
|
||||||
|
echo "GITEA_REF_NAME: ${{ gitea.ref_name }}"
|
||||||
|
echo "GITEA_SHA: ${{ gitea.sha }}"
|
||||||
|
echo "GITEA_REPOSITORY: ${{ gitea.repository }}"
|
||||||
|
echo "GITEA_TOKEN: ${GITEA_TOKEN:0:10}..."
|
||||||
|
echo "GITEA_SERVER_URL: $GITEA_SERVER_URL"
|
||||||
|
echo "GITEA_REPOSITORY: $GITEA_REPOSITORY"
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
# 检查可用命令
|
||||||
|
echo "=== Available Commands ==="
|
||||||
|
which git && echo "✅ git available" || echo "❌ git not found"
|
||||||
|
which curl && echo "✅ curl available" || echo "❌ curl not found"
|
||||||
|
which zip && echo "✅ zip available" || echo "❌ zip not found"
|
||||||
|
which jq && echo "✅ jq available" || echo "❌ jq not found"
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
# 检查网络
|
||||||
|
echo "=== Network Test ==="
|
||||||
|
curl -I https://sh.rustup.rs | head -1
|
||||||
Reference in New Issue
Block a user