mirror of
https://github.com/moku-project/Moku.git
synced 2026-06-13 01:09:56 -05:00
144 lines
4.0 KiB
YAML
144 lines
4.0 KiB
YAML
name: Build Windows
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
version:
|
|
description: "Version to build (e.g. 0.4.0)"
|
|
required: true
|
|
branch:
|
|
description: "Branch to build (e.g. svelte-rewrite)"
|
|
required: false
|
|
default: "main"
|
|
|
|
jobs:
|
|
frontend:
|
|
name: Build frontend
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
ref: ${{ github.event.inputs.branch }}
|
|
|
|
- uses: pnpm/action-setup@v4
|
|
with:
|
|
version: latest
|
|
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 22
|
|
cache: pnpm
|
|
|
|
- name: Install dependencies
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
- name: Build
|
|
run: pnpm build
|
|
|
|
- name: Upload dist
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: frontend-dist-windows
|
|
path: dist/
|
|
retention-days: 1
|
|
|
|
tauri:
|
|
name: Tauri (Windows x64)
|
|
needs: frontend
|
|
runs-on: windows-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
ref: ${{ github.event.inputs.branch }}
|
|
|
|
- name: Download frontend dist
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: frontend-dist-windows
|
|
path: dist/
|
|
|
|
- name: Install Rust
|
|
uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
targets: x86_64-pc-windows-msvc
|
|
|
|
- name: Rust cache
|
|
uses: Swatinem/rust-cache@v2
|
|
with:
|
|
workspaces: src-tauri
|
|
|
|
- uses: pnpm/action-setup@v4
|
|
with:
|
|
version: latest
|
|
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 22
|
|
cache: pnpm
|
|
|
|
- name: Install JS dependencies
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
- name: Download Suwayomi (Windows x64)
|
|
shell: bash
|
|
run: |
|
|
curl -fsSL \
|
|
"https://github.com/Suwayomi/Suwayomi-Server/releases/download/v2.1.1867/Suwayomi-Server-v2.1.1867-windows-x64.zip" \
|
|
-o suwayomi-windows.zip
|
|
|
|
echo "ab6687d278e0dd0984f67abbc853511a7e764f84b126a35d09bfd9b0307321ff suwayomi-windows.zip" | sha256sum -c -
|
|
|
|
unzip -q suwayomi-windows.zip -d suwayomi-raw
|
|
|
|
TOP_DIRS=$(find suwayomi-raw -mindepth 1 -maxdepth 1 -type d)
|
|
TOP_FILES=$(find suwayomi-raw -mindepth 1 -maxdepth 1 -type f)
|
|
TOP_DIR_COUNT=$(echo "$TOP_DIRS" | grep -c . || true)
|
|
|
|
mkdir -p suwayomi-extracted
|
|
if [ "$TOP_DIR_COUNT" -eq 1 ] && [ -z "$TOP_FILES" ]; then
|
|
mv "$TOP_DIRS"/* suwayomi-extracted/
|
|
else
|
|
mv suwayomi-raw/* suwayomi-extracted/
|
|
fi
|
|
|
|
- name: Stage Suwayomi bundle
|
|
shell: bash
|
|
run: |
|
|
mkdir -p src-tauri/binaries
|
|
|
|
JAVAW=$(find suwayomi-extracted -path "*/jre/bin/javaw.exe" | head -1)
|
|
|
|
if [ -z "$JAVAW" ]; then
|
|
echo "ERROR: could not find jre/bin/javaw.exe — bundle contents:"
|
|
find suwayomi-extracted -type f | head -40
|
|
exit 1
|
|
fi
|
|
|
|
echo "Found javaw: $JAVAW"
|
|
|
|
# Copy full bundle so jar + jre tree are available at runtime.
|
|
# lib.rs looks for suwayomi-bundle/jre/bin/javaw.exe in the resource dir.
|
|
cp -r suwayomi-extracted src-tauri/binaries/suwayomi-bundle
|
|
|
|
- name: Patch tauri.conf.json for CI
|
|
shell: bash
|
|
run: |
|
|
sed -i 's/"beforeBuildCommand": "pnpm build"/"beforeBuildCommand": ""/' src-tauri/tauri.conf.json
|
|
|
|
- name: Build Tauri app (Windows x64)
|
|
uses: tauri-apps/tauri-action@v0
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
args: >-
|
|
--target x86_64-pc-windows-msvc
|
|
--config '{"bundle":{"resources":["binaries/suwayomi-bundle/**"]}}'
|
|
|
|
- name: Upload Windows installer
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: moku-windows-x64
|
|
path: src-tauri/target/x86_64-pc-windows-msvc/release/bundle/nsis/*.exe
|
|
retention-days: 7
|