mirror of
https://github.com/kodjodevf/mangayomi.git
synced 2026-08-05 16:49:41 +00:00
217 lines
7.9 KiB
YAML
217 lines
7.9 KiB
YAML
name: Build & Release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- v*
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref_name }}
|
|
cancel-in-progress: true
|
|
|
|
env:
|
|
ZSIGN_VERSION: "0.7"
|
|
|
|
jobs:
|
|
build-and-release-linux-zip_AppImage_RPM:
|
|
permissions:
|
|
contents: write
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: checkout branch
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install webkit2gtk-4.1 clang cmake ninja-build pkg-config libgtk-3-dev mpv libmpv-dev dpkg-dev libblkid-dev liblzma-dev fuse rpm
|
|
wget -O /usr/local/bin/linuxdeploy "https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage"
|
|
chmod +x /usr/local/bin/linuxdeploy
|
|
|
|
- name: setup flutter
|
|
uses: subosito/flutter-action@v2
|
|
with:
|
|
channel: "stable"
|
|
|
|
- name: Setup Rust toolchain
|
|
uses: dtolnay/rust-toolchain@stable
|
|
|
|
- name: Install the CLI tool
|
|
run: cargo install 'flutter_rust_bridge_codegen'
|
|
|
|
- name: flutter pub get
|
|
run: flutter pub get
|
|
|
|
- name: build linux
|
|
run: flutter build linux --release --verbose
|
|
|
|
- name: Zip
|
|
uses: thedoctor0/zip-release@main
|
|
with:
|
|
type: "zip"
|
|
filename: Mangayomi-${{ github.ref_name }}-linux.zip
|
|
directory: build/linux/x64/release/bundle
|
|
|
|
- name: Create AppImage
|
|
run: |
|
|
# Move Zip-file outside the bundle dir to avoid including it in the AppImage
|
|
mv build/linux/x64/release/bundle/Mangayomi-*.zip build/linux/x64/release/
|
|
# Create fresh AppDir structure
|
|
rm -rf AppDir
|
|
mkdir -p AppDir/usr/bin
|
|
mkdir -p AppDir/usr/share/icons
|
|
# Copy built files
|
|
cp -r build/linux/x64/release/bundle/* AppDir/usr/bin/
|
|
cp -rL linux/packaging/icons/* AppDir/usr/share/icons
|
|
# Scan AppDir/usr/bin/lib for existing libraries to exclude them from linuxdeploy packaging
|
|
EXCLUDE_LIBS=$(find AppDir/usr/bin/lib -type f -name "*.so*" -exec basename {} \; | sort -u)
|
|
# Add --exclude-library flag to each found library
|
|
for lib in $EXCLUDE_LIBS; do
|
|
EXCLUDE_ARGS+=" --exclude-library $lib"
|
|
done
|
|
# Copy desktop file to AppDir root
|
|
cp linux/mangayomi.desktop AppDir/mangayomi.desktop
|
|
# Create AppRun file
|
|
cat <<EOF > AppDir/AppRun
|
|
#!/bin/sh
|
|
SELF=\$(readlink -f "\$0")
|
|
HERE=\${SELF%/*}
|
|
export PATH="\${HERE}/usr/bin/:\${PATH}"
|
|
export LD_LIBRARY_PATH="\${HERE}/usr/bin/lib/:\${HERE}/usr/lib/:\${LD_LIBRARY_PATH}"
|
|
exec "\${HERE}/usr/bin/mangayomi" "\$@"
|
|
EOF
|
|
chmod +x AppDir/AppRun
|
|
# Make AppImage
|
|
/usr/local/bin/linuxdeploy \
|
|
--appdir AppDir \
|
|
--desktop-file AppDir/mangayomi.desktop \
|
|
--icon-file AppDir/usr/share/icons/hicolor/512x512/apps/mangayomi.png \
|
|
--executable AppDir/usr/bin/mangayomi \
|
|
$EXCLUDE_ARGS \
|
|
--output appimage
|
|
mv $(find . -type f -name "*.AppImage") build/linux/x64/release/Mangayomi-${{ github.ref_name }}-linux.AppImage
|
|
|
|
- name: Create RPM Package
|
|
run: |
|
|
VERSION=$(grep '^version:' pubspec.yaml | sed 's/version: //; s/+.*//')
|
|
mkdir -p rpm_build/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
|
|
cp -r build/linux/x64/release/bundle rpm_build/SOURCES/mangayomi-${VERSION}
|
|
tar czf rpm_build/SOURCES/mangayomi-${VERSION}.tar.gz -C rpm_build/SOURCES mangayomi-${VERSION}
|
|
mkdir -p rpm_build/SOURCES/usr/share/icons
|
|
cp -rL linux/packaging/icons/* rpm_build/SOURCES/usr/share/icons
|
|
cp linux/mangayomi.desktop rpm_build/SOURCES/
|
|
# RPM Spec File
|
|
cat <<EOF > rpm_build/SPECS/mangayomi.spec
|
|
Name: mangayomi
|
|
Version: ${VERSION}
|
|
Release: 1%{?dist}
|
|
Summary: Mangayomi is an open-source Flutter app for reading manga, novels, and watching animes across multiple platforms
|
|
License: MIT
|
|
Source0: %{name}-%{version}.tar.gz
|
|
BuildArch: x86_64
|
|
|
|
%description
|
|
Mangayomi is an open-source Flutter app for reading manga, novels, and watching animes across multiple platforms.
|
|
|
|
%prep
|
|
%setup -q
|
|
|
|
%install
|
|
mkdir -p %{buildroot}/usr/bin
|
|
mkdir -p %{buildroot}/usr/share/applications
|
|
mkdir -p %{buildroot}/usr/share/icons/hicolor/256x256/apps
|
|
cp -r * %{buildroot}/usr/bin/
|
|
cp -r %{_sourcedir}/usr/share/* %{buildroot}/usr/share/
|
|
cp %{_sourcedir}/mangayomi.desktop %{buildroot}/usr/share/applications/mangayomi.desktop
|
|
|
|
%files
|
|
/usr/bin/*
|
|
/usr/share/applications/mangayomi.desktop
|
|
/usr/share/icons/hicolor/16x16/apps/mangayomi.png
|
|
/usr/share/icons/hicolor/32x32/apps/mangayomi.png
|
|
/usr/share/icons/hicolor/64x64/apps/mangayomi.png
|
|
/usr/share/icons/hicolor/128x128/apps/mangayomi.png
|
|
/usr/share/icons/hicolor/256x256/apps/mangayomi.png
|
|
/usr/share/icons/hicolor/512x512/apps/mangayomi.png
|
|
EOF
|
|
|
|
rpmbuild --define "_topdir $(pwd)/rpm_build" -ba rpm_build/SPECS/mangayomi.spec
|
|
mv rpm_build/RPMS/x86_64/*.rpm build/linux/x64/release/Mangayomi-${{ github.ref_name }}-linux.rpm
|
|
|
|
- name: upload artifact linux zip
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: Mangayomi-${{ github.ref_name }}-linux-zip
|
|
path: |
|
|
build/linux/x64/release/Mangayomi-*.zip
|
|
build/linux/x64/release/Mangayomi-*.AppImage
|
|
build/linux/x64/release/Mangayomi-*.rpm
|
|
- name: release packages linux zip
|
|
uses: ncipollo/release-action@v1
|
|
with:
|
|
artifacts: |
|
|
build/linux/x64/release/Mangayomi-*.zip
|
|
build/linux/x64/release/Mangayomi-*.AppImage
|
|
build/linux/x64/release/Mangayomi-*.rpm
|
|
allowUpdates: true
|
|
|
|
build-and-release-linux-deb:
|
|
permissions:
|
|
contents: write
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: checkout branch
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install webkit2gtk-4.1 clang cmake ninja-build pkg-config libgtk-3-dev mpv libmpv-dev dpkg-dev libfuse2
|
|
|
|
- name: setup flutter
|
|
uses: subosito/flutter-action@v2
|
|
with:
|
|
channel: "stable"
|
|
|
|
- name: Setup Rust toolchain
|
|
uses: dtolnay/rust-toolchain@stable
|
|
|
|
- name: Install the CLI tool
|
|
run: cargo install 'flutter_rust_bridge_codegen'
|
|
|
|
- name: flutter pub get
|
|
run: flutter pub get
|
|
|
|
- name: Enable fastforge
|
|
run: dart pub global activate fastforge
|
|
|
|
- name: Update PATH
|
|
run: echo "PATH=${HOME}/.pub-cache/bin:${PATH}" >> $GITHUB_ENV
|
|
|
|
- name: Build deb package
|
|
run: fastforge package --platform linux --targets deb
|
|
|
|
- name: Inject custom .desktop file into .deb
|
|
run: |
|
|
mkdir extracted_deb
|
|
dpkg-deb -R "$(find dist -name '*.deb' | head -n 1)" extracted_deb
|
|
# Replace desktop file
|
|
cp -f linux/mangayomi.desktop extracted_deb/usr/share/applications/mangayomi.desktop
|
|
# copy all icon sizes
|
|
cp -rLf linux/packaging/icons/* extracted_deb/usr/share/icons
|
|
# Set correct permissions
|
|
chmod 644 extracted_deb/usr/share/applications/mangayomi.desktop
|
|
# Repack the .deb
|
|
fakeroot dpkg-deb -b extracted_deb dist/Mangayomi-${{ github.ref_name }}-linux.deb
|
|
|
|
- name: upload artifact linux deb
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: Mangayomi-${{ github.ref_name }}-linux-deb
|
|
path: dist/Mangayomi-*.deb
|
|
|
|
- name: Release package deb
|
|
uses: ncipollo/release-action@v1
|
|
with:
|
|
artifacts: dist/Mangayomi-*.deb
|
|
allowUpdates: true
|