Skip to content

Commit

Permalink
feat: update Linux build and add rpm
Browse files Browse the repository at this point in the history
  • Loading branch information
TomBursch committed Jan 9, 2022
1 parent 8784510 commit 21e893a
Show file tree
Hide file tree
Showing 6 changed files with 102 additions and 5 deletions.
27 changes: 25 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,10 @@ jobs:
create-build:
name: Create ${{ matrix.target }} build
runs-on: ${{ matrix.os }}
container: ${{ matrix.container }}
strategy:
matrix:
target: [macOS, Windows, Linux, Android, Debian]
target: [macOS, Windows, Linux, Android, Debian, Fedora]
include:
- os: macos-10.15 # Catalina
target: macOS
Expand Down Expand Up @@ -89,6 +90,15 @@ jobs:
build_path: build/debian/release
asset_extension: .deb
asset_content_type: application/vnd.debian.binary-package
- os: ubuntu-20.04
container:
image: fedora:latest
options: --group-add 135
target: Fedora
build_target: linux
build_path: build/fedora/release
asset_extension: .rpm
asset_content_type: application/x-rpm
# Disable fail-fast as we want results from all even if one fails.
fail-fast: false
needs: draft-release
Expand All @@ -104,6 +114,11 @@ jobs:
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev libx11-dev pkg-config cmake ninja-build libblkid-dev libsecret-1-dev libjsoncpp-dev
- name: Install Fedora dependencies
if: matrix.target == 'Fedora'
run: |
sudo dnf update
sudo dnf install -y gtk3-devel libX11-devel pkg-config cmake ninja-build libblkid-devel libsecret-devel jsoncpp-devel fedora-packager fedora-review
- name: Install Android dependencies
if: matrix.target == 'Android'
uses: actions/setup-java@v1
Expand Down Expand Up @@ -175,10 +190,18 @@ jobs:
if: matrix.target == 'Debian'
run: ./build.sh
working-directory: debian
- name: Rename build for Android
- name: Rename build for debian
if: matrix.target == 'Debian'
run: mv kitchenowl.deb $GITHUB_WORKSPACE/kitchenowl_${{ matrix.target }}.deb
working-directory: ${{ matrix.build_path }}
- name: Package build for Fedora
if: matrix.target == 'Fedora'
run: ./build.sh
working-directory: fedora
- name: Rename build for fedora
if: matrix.target == 'Fedora'
run: mv x86_64/KitchenOwl-${{ github.ref }}-1.fc35.x86_64.rpm $GITHUB_WORKSPACE/kitchenowl_${{ matrix.target }}.rpm
working-directory: ${{ matrix.build_path }}

# Upload the build.
- name: Add packaged build to release draft
Expand Down
5 changes: 3 additions & 2 deletions debian/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ mkdir -p build/debian/release
cp -r debian/$NAME build/debian/release/
mkdir build/debian/release/$NAME/usr/lib
cp -r build/linux/x64/release/bundle/ build/debian/release/$NAME/usr/lib/$NAME/
cp debian/icon.png build/debian/release/$NAME/usr/lib/$NAME/
cp linux/icon.png build/debian/release/$NAME/usr/lib/$NAME/
mkdir -p build/debian/release/$NAME/usr/share/applications/

# DEB settings
Expand All @@ -33,11 +33,12 @@ cat debian/$NAME/DEBIAN/control >> $CONTROL_FILE

DESKTOP_FILE="build/debian/release/$NAME/usr/share/applications/$NAME.desktop"
echo "[Desktop Entry]" > $DESKTOP_FILE
echo "Icon=/usr/lib/$NAME/icon.png" >> $DESKTOP_FILE
echo "Exec=$NAME" >> $DESKTOP_FILE
# echo "Name=$NAME" >> $DESKTOP_FILE
echo "Comment=$DESCRIPTION" >> $DESKTOP_FILE
echo "Version=$VERSION" >> $DESKTOP_FILE
cat debian/$NAME.desktop >> $DESKTOP_FILE
cat linux/$NAME.desktop >> $DESKTOP_FILE


# Build and cleanup
Expand Down
39 changes: 39 additions & 0 deletions fedora/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/sh

# Test requirements
if ! type "shyaml" > /dev/null; then
echo "shyaml is required, install with pip3 install shyaml"
fi

# Go to project folder
cd $(dirname $0)
cd ../

# Read project information
NAME=$(cat pubspec.yaml | shyaml get-value name)
VERSION=$(cat pubspec.yaml | shyaml get-value version | grep -oE "^[^+]+")
DESCRIPTION=$(cat pubspec.yaml | shyaml get-value description)

# Build project and create structure
flutter build linux --release
mkdir -p build/fedora/release
cp -r build/linux/x64/release/bundle/ build/fedora/release/kitchenowl
cp linux/icon.png build/fedora/release/kitchenowl

SPEC_FILE="build/fedora/release/$NAME.spec"
echo "Version: v$VERSION" > $SPEC_FILE
cat fedora/$NAME.spec >> $SPEC_FILE

DESKTOP_FILE="build/fedora/release/$NAME.desktop"
echo "[Desktop Entry]" > $DESKTOP_FILE
echo "Exec=$NAME" >> $DESKTOP_FILE
echo "Icon=/usr/$NAME/icon.png" >> $DESKTOP_FILE
# echo "Name=$NAME" >> $DESKTOP_FILE
echo "Comment=$DESCRIPTION" >> $DESKTOP_FILE
echo "Version=$VERSION" >> $DESKTOP_FILE
cat linux/$NAME.desktop >> $DESKTOP_FILE


# Build and cleanup
cd build/fedora/release/
QA_RPATHS=0x0002 fedpkg --release f35 local
35 changes: 35 additions & 0 deletions fedora/kitchenowl.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
Name: KitchenOwl
Release: 1%{?dist}
Summary: KitchenOwl helps you organize your grocery life
License: Apache 2.0
Source0: kitchenowl
Source1: kitchenowl.desktop
Requires: jsoncpp
Requires: libsecret

%description
KitchenOwl helps you organize your grocery life.

%install
mkdir -p %{buildroot}%{_datadir}/kitchenowl
mkdir -p %{buildroot}%{_datadir}/applications
mkdir -p %{buildroot}%{_bindir}
cp -R %{SOURCE0} %{buildroot}%{_datadir}
chmod +x %{buildroot}%{_datadir}/kitchenowl/kitchenowl
ln -s %{_datadir}/kitchenowl/kitchenowl %{buildroot}%{_bindir}
install -p -m 755 %{SOURCE1} %{buildroot}%{_datadir}/applications

%files
%defattr(-,root,root)
%dir %{_datadir}/kitchenowl
%{_datadir}/applications/kitchenowl.desktop
%{_datadir}/kitchenowl
%{_bindir}/kitchenowl

%clean
rm -rf %{buildroot}

%changelog
* Tue Mar 30 2021 Tom Bursch <[email protected]> - 22
- Initial Release

File renamed without changes
1 change: 0 additions & 1 deletion debian/kitchenowl.desktop → linux/kitchenowl.desktop
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
Name=KitchenOwl
Icon=/usr/lib/kitchenowl/icon.png
Terminal=false
Type=Application
Categories=Utility;X-Productivity;

0 comments on commit 21e893a

Please sign in to comment.