chore(release): support rpm
This commit is contained in:
@@ -105,6 +105,9 @@ jobs:
|
||||
mv Ciyue-x86_64.AppImage Ciyue-latest-x86_64.AppImage
|
||||
mv Ciyue-x86_64.AppImage.zsync Ciyue-latest-x86_64.AppImage.zsync
|
||||
|
||||
- name: Install fastforge
|
||||
run: dart pub global activate fastforge
|
||||
|
||||
- name: Build Deb
|
||||
if: ${{ inputs.package_release_artifacts }}
|
||||
run: |
|
||||
@@ -112,6 +115,13 @@ jobs:
|
||||
mv dist/*/*.deb .
|
||||
mv *.deb ciyue-x86_64.deb
|
||||
|
||||
- name: Build rpm
|
||||
if: ${{ inputs.package_release_artifacts }}
|
||||
run: |
|
||||
pacman -S --noconfirm rpmdevtools
|
||||
./tools/build_rpm.sh
|
||||
mv ciyue-*.x86_64.rpm ciyue.x86_64.rpm
|
||||
|
||||
- name: Upload bundle
|
||||
if: ${{ !inputs.package_release_artifacts }}
|
||||
uses: actions/upload-artifact@v4
|
||||
@@ -129,3 +139,4 @@ jobs:
|
||||
Ciyue-latest-x86_64.AppImage
|
||||
*.zsync
|
||||
ciyue-x86_64.deb
|
||||
ciyue-x86_64.rpm
|
||||
|
||||
@@ -59,3 +59,6 @@ appimagetool
|
||||
|
||||
# fastforge
|
||||
dist/
|
||||
|
||||
# rpm
|
||||
*.rpm
|
||||
|
||||
@@ -40,6 +40,8 @@ The project uses `justfile` to manage common development tasks.
|
||||
| **Migrations** | `just make-migrations` | Generates database migrations using Drift. |
|
||||
| **Icons** | `just icon` | Generates app launcher icons. |
|
||||
| **Count Code** | `just count-codes` | Counts lines of code excluding generated files. |
|
||||
| **Package AppImage** | `just build-appimage` | Builds a Linux AppImage. |
|
||||
| **Package RPM** | `just build-rpm` | Builds a Linux RPM package. |
|
||||
|
||||
### Standard Flutter Commands
|
||||
* **Run:** `flutter run`
|
||||
|
||||
@@ -12,3 +12,6 @@ count-codes:
|
||||
|
||||
build-appimage:
|
||||
./tools/build_appimage.sh
|
||||
|
||||
build-rpm:
|
||||
./tools/build_rpm.sh
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<component type="desktop-application">
|
||||
<id>org.eu.mumulhl.ciyue</id>
|
||||
|
||||
<name>Ciyue</name>
|
||||
<summary>A simple mdict dictionary</summary>
|
||||
|
||||
<metadata_license>CC0-1.0</metadata_license>
|
||||
<project_license>MIT</project_license>
|
||||
|
||||
<developer id="org.eu.mumulhl">
|
||||
<name>mumu-lhl</name>
|
||||
</developer>
|
||||
|
||||
<url type="homepage">https://github.com/mumu-lhl/Ciyue</url>
|
||||
<url type="bugtracker">https://github.com/mumu-lhl/Ciyue/issues</url>
|
||||
<url type="vcs-browser">https://github.com/mumu-lhl/Ciyue</url>
|
||||
|
||||
<description>
|
||||
<p>
|
||||
Ciyue is a comprehensive dictionary application built with Flutter. It supports MDX/MDD dictionary formats and offers a modern user experience with Material You design.
|
||||
</p>
|
||||
<ul>
|
||||
<li>Support MDX/MDD dictionary formats</li>
|
||||
<li>Multiple dictionaries search and display</li>
|
||||
<li>Material You dynamic colors support</li>
|
||||
<li>AI-powered translation and word explanation</li>
|
||||
<li>Text-to-speech (TTS) support</li>
|
||||
<li>Word book and history management</li>
|
||||
</ul>
|
||||
</description>
|
||||
|
||||
<launchable type="desktop-id">org.eu.mumulhl.ciyue.desktop</launchable>
|
||||
|
||||
<icon type="stock">ciyue</icon>
|
||||
|
||||
<categories>
|
||||
<category>Education</category>
|
||||
<category>Languages</category>
|
||||
</categories>
|
||||
|
||||
<provides>
|
||||
<binary>ciyue</binary>
|
||||
</provides>
|
||||
|
||||
<content_rating type="oars-1.1" />
|
||||
</component>
|
||||
@@ -20,6 +20,5 @@ categories:
|
||||
- Languages
|
||||
|
||||
startup_notify: true
|
||||
# You can also specify [metainfo](https://freedesktop.org/software/appstream/docs/chap-Quickstart.html) file
|
||||
# which contains metadata of the app.
|
||||
|
||||
metainfo: linux/packaging/org.eu.mumulhl.ciyue.metainfo.xml
|
||||
|
||||
@@ -7,11 +7,27 @@
|
||||
|
||||
<metadata_license>CC0-1.0</metadata_license>
|
||||
<project_license>MIT</project_license>
|
||||
|
||||
<developer id="org.eu.mumulhl">
|
||||
<name>mumu-lhl</name>
|
||||
</developer>
|
||||
|
||||
<url type="homepage">https://github.com/mumu-lhl/Ciyue</url>
|
||||
<url type="bugtracker">https://github.com/mumu-lhl/Ciyue/issues</url>
|
||||
<url type="vcs-browser">https://github.com/mumu-lhl/Ciyue</url>
|
||||
|
||||
<description>
|
||||
<p>
|
||||
📄 Support MDX/MDD (not on Linux yet) 🔍 Support multiple dictionaries search and display 🎨 Support Material You 🌐 AI Translate (Support OpenAI, Gemini, Deepseek...) 🔈 Support reading aloud 🔖 Bookmarking words to the word book
|
||||
Ciyue is a comprehensive dictionary application built with Flutter. It supports MDX/MDD dictionary formats and offers a modern user experience with Material You design.
|
||||
</p>
|
||||
<ul>
|
||||
<li>Support MDX/MDD dictionary formats</li>
|
||||
<li>Multiple dictionaries search and display</li>
|
||||
<li>Material You dynamic colors support</li>
|
||||
<li>AI-powered translation and word explanation</li>
|
||||
<li>Text-to-speech (TTS) support</li>
|
||||
<li>Word book and history management</li>
|
||||
</ul>
|
||||
</description>
|
||||
|
||||
<launchable type="desktop-id">org.eu.mumulhl.ciyue.desktop</launchable>
|
||||
@@ -26,4 +42,6 @@
|
||||
<provides>
|
||||
<binary>ciyue</binary>
|
||||
</provides>
|
||||
|
||||
<content_rating type="oars-1.1" />
|
||||
</component>
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
Name: ciyue
|
||||
Version: @VERSION@
|
||||
Release: @RELEASE@
|
||||
Summary: A simple mdict dictionary
|
||||
License: MIT
|
||||
URL: https://github.com/mumu-lhl/Ciyue
|
||||
|
||||
%description
|
||||
A simple mdict dictionary with Android/Windows/Linux support.
|
||||
Multi-dictionary support, AI integration, and Material You design.
|
||||
|
||||
%install
|
||||
mkdir -p %{buildroot}/usr/bin
|
||||
mkdir -p %{buildroot}/opt/%{name}
|
||||
cp -r @BUNDLE_DIR@/* %{buildroot}/opt/%{name}/
|
||||
ln -s /opt/%{name}/%{name} %{buildroot}/usr/bin/%{name}
|
||||
|
||||
# Desktop file
|
||||
mkdir -p %{buildroot}/usr/share/applications
|
||||
cp @DESKTOP_FILE@ %{buildroot}/usr/share/applications/
|
||||
|
||||
# Icon
|
||||
mkdir -p %{buildroot}/usr/share/icons/hicolor/256x256/apps
|
||||
cp @ICON_PATH@ %{buildroot}/usr/share/icons/hicolor/256x256/apps/%{name}.png
|
||||
|
||||
# Metainfo
|
||||
mkdir -p %{buildroot}/usr/share/metainfo
|
||||
cp @METAINFO_FILE@ %{buildroot}/usr/share/metainfo/org.eu.mumulhl.ciyue.appdata.xml
|
||||
|
||||
%files
|
||||
/opt/%{name}/
|
||||
/usr/bin/%{name}
|
||||
/usr/share/applications/org.eu.mumulhl.ciyue.desktop
|
||||
/usr/share/icons/hicolor/256x256/apps/%{name}.png
|
||||
/usr/share/metainfo/org.eu.mumulhl.ciyue.appdata.xml
|
||||
|
||||
%changelog
|
||||
* @DATE@ Ciyue Maintainers - @VERSION@-@RELEASE@
|
||||
- Automated RPM build
|
||||
@@ -9,7 +9,8 @@ ICON_PATH="assets/icon.png"
|
||||
BUILD_DIR="build/linux/x64/release"
|
||||
BUNDLE_DIR="$BUILD_DIR/bundle"
|
||||
APPDIR="$BUILD_DIR/AppDir"
|
||||
ASSETS_DIR="linux/appimage"
|
||||
ASSETS_DIR="linux/packaging/appimage"
|
||||
PACKAGING_DIR="linux/packaging"
|
||||
|
||||
# Ensure we are in the project root
|
||||
cd "$(dirname "$0")/.."
|
||||
@@ -28,12 +29,12 @@ cp -r "$BUNDLE_DIR/"* "$APPDIR/"
|
||||
|
||||
echo "=== 2. Copying Metadata Files ==="
|
||||
# Desktop file (Root for AppImage)
|
||||
cp "$ASSETS_DIR/$APP_ID.desktop" "$APPDIR/"
|
||||
cp "$PACKAGING_DIR/$APP_ID.desktop" "$APPDIR/"
|
||||
ln -sf "$APP_ID.desktop" "$APPDIR/$BINARY_NAME.desktop"
|
||||
|
||||
# Desktop file (Standard path for AppStream validation)
|
||||
mkdir -p "$APPDIR/usr/share/applications"
|
||||
cp "$ASSETS_DIR/$APP_ID.desktop" "$APPDIR/usr/share/applications/"
|
||||
cp "$PACKAGING_DIR/$APP_ID.desktop" "$APPDIR/usr/share/applications/"
|
||||
|
||||
# Icon (Standard path)
|
||||
mkdir -p "$APPDIR/usr/share/icons/hicolor/256x256/apps"
|
||||
@@ -47,7 +48,7 @@ chmod +x "$APPDIR/AppRun"
|
||||
|
||||
# Metainfo
|
||||
mkdir -p "$APPDIR/usr/share/metainfo"
|
||||
cp "$ASSETS_DIR/org.eu.mumulhl.ciyue.metainfo.xml" "$APPDIR/usr/share/metainfo/org.eu.mumulhl.ciyue.appdata.xml"
|
||||
cp "linux/packaging/org.eu.mumulhl.ciyue.metainfo.xml" "$APPDIR/usr/share/metainfo/org.eu.mumulhl.ciyue.appdata.xml"
|
||||
|
||||
echo "=== 3. Getting appimagetool ==="
|
||||
if [ ! -x "appimagetool" ]; then
|
||||
@@ -58,7 +59,7 @@ fi
|
||||
|
||||
echo "=== 4. Building AppImage ==="
|
||||
export ARCH=x86_64
|
||||
# -u defines the update information.
|
||||
# -u defines the update information.
|
||||
# You can change this string to your actual update server/GitHub repo.
|
||||
UPDATE_INFO="gh-releases-zsync|mumu-lhl|Ciyue|latest|Ciyue-latest-x86_64.AppImage.zsync"
|
||||
|
||||
|
||||
Executable
+76
@@ -0,0 +1,76 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Configuration
|
||||
BINARY_NAME="ciyue"
|
||||
APP_NAME="Ciyue"
|
||||
APP_ID="org.eu.mumulhl.ciyue"
|
||||
ICON_PATH="assets/icon.png"
|
||||
BUILD_DIR="build/linux/x64/release"
|
||||
BUNDLE_DIR="$BUILD_DIR/bundle"
|
||||
RPM_ROOT="build/rpm"
|
||||
RPM_ASSETS_DIR="linux/packaging/rpm"
|
||||
DESKTOP_FILE="linux/packaging/org.eu.mumulhl.ciyue.desktop"
|
||||
METAINFO_FILE="linux/packaging/org.eu.mumulhl.ciyue.metainfo.xml"
|
||||
|
||||
# Ensure we are in the project root
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
# Check if flutter build has been run
|
||||
if [ ! -d "$BUNDLE_DIR" ]; then
|
||||
echo "Error: Bundle directory not found at $BUNDLE_DIR"
|
||||
echo "Please run 'flutter build linux --release' first."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Extract version from pubspec.yaml
|
||||
VERSION_RAW=$(grep 'version: ' pubspec.yaml | sed 's/version: //')
|
||||
# Normalize version for RPM (replace + with _, - with ~)
|
||||
VERSION=$(echo $VERSION_RAW | cut -d'+' -f1 | sed 's/-/~/g')
|
||||
RELEASE=$(echo $VERSION_RAW | cut -d'+' -f2)
|
||||
[ "$RELEASE" == "$VERSION_RAW" ] && RELEASE=1
|
||||
|
||||
echo "=== 1. Preparing RPM Build Environment ==="
|
||||
rm -rf "$RPM_ROOT"
|
||||
mkdir -p "$RPM_ROOT"/{BUILD,RPMS,SOURCES,SPECS,SRPMS,BUILDROOT}
|
||||
|
||||
echo "=== 2. Generating SPEC File from Template ==="
|
||||
SPEC_TEMPLATE="$RPM_ASSETS_DIR/$BINARY_NAME.spec"
|
||||
SPEC_FILE="$RPM_ROOT/SPECS/$BINARY_NAME.spec"
|
||||
DESKTOP_FILE="$DESKTOP_FILE"
|
||||
# Use C locale for standard date format in changelog (e.g., Sat Feb 14 2026)
|
||||
CURRENT_DATE=$(LC_ALL=C date +"%a %b %d %Y")
|
||||
|
||||
# Use absolute paths for the spec file replacements to avoid issues during rpmbuild
|
||||
ABS_BUNDLE_DIR="$(pwd)/$BUNDLE_DIR"
|
||||
ABS_DESKTOP_FILE="$(pwd)/$DESKTOP_FILE"
|
||||
ABS_ICON_PATH="$(pwd)/$ICON_PATH"
|
||||
ABS_METAINFO_FILE="$(pwd)/$METAINFO_FILE"
|
||||
|
||||
sed -e "s|@VERSION@|$VERSION|g" \
|
||||
-e "s|@RELEASE@|$RELEASE|g" \
|
||||
-e "s|@BUNDLE_DIR@|$ABS_BUNDLE_DIR|g" \
|
||||
-e "s|@DESKTOP_FILE@|$ABS_DESKTOP_FILE|g" \
|
||||
-e "s|@ICON_PATH@|$ABS_ICON_PATH|g" \
|
||||
-e "s|@METAINFO_FILE@|$ABS_METAINFO_FILE|g" \
|
||||
-e "s|@DATE@|$CURRENT_DATE|g" \
|
||||
"$SPEC_TEMPLATE" > "$SPEC_FILE"
|
||||
|
||||
echo "=== 3. Building RPM Package ==="
|
||||
if ! command -v rpmbuild &> /dev/null; then
|
||||
echo "Error: 'rpmbuild' not found. Please install 'rpm-build' (Fedora/RHEL) or equivalent."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Define QA_RPATHS to ignore invalid RPATH errors (0x0002) which are common in Flutter builds
|
||||
export QA_RPATHS=$(( 0x0002 ))
|
||||
|
||||
rpmbuild --define "_topdir $(pwd)/$RPM_ROOT" -bb "$SPEC_FILE"
|
||||
|
||||
echo "=== 4. Finalizing ==="
|
||||
# Move resulting RPMs to root and cleanup
|
||||
mv "$RPM_ROOT"/RPMS/*/*.rpm .
|
||||
rm -rf "$RPM_ROOT"
|
||||
|
||||
echo "=== Done! ==="
|
||||
echo "RPM created: $(ls *.rpm)"
|
||||
Reference in New Issue
Block a user