Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ jobs:
mv ghr*linux_amd64/ghr .
find . -name artifacts.tgz | xargs -n1 tar xzf
####
sudo apt install nsis
sudo apt install nsis rpm
cp ./script/windows_installer.nsi .
TAG="${{ github.event.inputs.tag }}"
APP_VERSION="${TAG#v}"
Expand Down Expand Up @@ -390,6 +390,22 @@ jobs:
mv Throne.deb Throne-${{ github.event.inputs.tag }}-debian-arm64-system-qt.deb
rm -rf Throne
####
bash ../script/pack_rpm.sh ${{ github.event.inputs.tag }} amd64
mv Throne.rpm Throne-${{ github.event.inputs.tag }}-fedora-amd64.rpm
rm -rf Throne rpmwork
####
bash ../script/pack_rpm.sh ${{ github.event.inputs.tag }} amd64 systemqt
mv Throne.rpm Throne-${{ github.event.inputs.tag }}-fedora-amd64-system-qt.rpm
rm -rf Throne rpmwork
####
bash ../script/pack_rpm.sh ${{ github.event.inputs.tag }} arm64
mv Throne.rpm Throne-${{ github.event.inputs.tag }}-fedora-arm64.rpm
rm -rf Throne rpmwork
####
bash ../script/pack_rpm.sh ${{ github.event.inputs.tag }} arm64 systemqt
mv Throne.rpm Throne-${{ github.event.inputs.tag }}-fedora-arm64-system-qt.rpm
rm -rf Throne rpmwork
####
mv linux-amd64 Throne
mv Throne/Throne.debug debug/Throne-${{ github.event.inputs.tag }}-linux-amd64.debug
zip -9 -r Throne-${{ github.event.inputs.tag }}-linux-amd64.zip Throne
Expand Down Expand Up @@ -477,4 +493,4 @@ jobs:
- name: Release
if: github.event.inputs.publish == 'r'
run: |
./ghr -delete -c ${{ github.sha }} -t "${{ github.token }}" -n "${{ github.event.inputs.tag }}" "${{ github.event.inputs.tag }}" deployment
./ghr -delete -c ${{ github.sha }} -t "${{ github.token }}" -n "${{ github.event.inputs.tag }}" "${{ github.event.inputs.tag }}" deployment
79 changes: 79 additions & 0 deletions script/pack_rpm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#!/bin/bash
set -e

TAG="$1"
ARCH="$2"
VARIANT="$3"

RPM_VERSION="${TAG#v}"
RPM_VERSION="${RPM_VERSION#V}"
#RPM release fields reject '-'
RPM_VERSION="${RPM_VERSION//-/_}"

# rpm and this project name arches differently from the amd64/arm64 used elsewhere.
RPM_ARCH=$([[ "$ARCH" == "amd64" ]] && echo "x86_64" || echo "aarch64")

SUFFIX=""
[[ "$VARIANT" == "systemqt" ]] && SUFFIX="-system-qt"
SRC_DIR="$PWD/linux-$ARCH$SUFFIX"

DEPENDS=""
[[ "$VARIANT" == "systemqt" ]] && DEPENDS="Requires: qt6-qtbase qt6-qtbase-gui qt6-qtwayland xcb-util-cursor google-noto-emoji-color-fonts"

WORK="$PWD/rpmwork"
rm -rf "$WORK"
mkdir -p "$WORK/RPMS"

cat >"$WORK/Throne.desktop" <<-EOF
[Desktop Entry]
Name=Throne
Comment=Qt based cross-platform GUI proxy configuration manager (backend: sing-box)
Exec=sh -c "PATH=/opt/Throne:\$PATH /opt/Throne/Throne -appdata"
Icon=/opt/Throne/Throne.png
Terminal=false
Type=Application
Categories=Network;Application;
EOF

cat >"$WORK/Throne.spec" <<-EOF
Name: Throne
Version: ${RPM_VERSION}
Release: 1
Summary: Qt based cross-platform GUI proxy configuration manager (backend: sing-box)
License: GPL-3.0-or-later
%define debug_package %{nil}
%define __os_install_post %{nil}
%define __strip /bin/true
${DEPENDS}
Requires(post): desktop-file-utils
Requires(postun): desktop-file-utils

%description
Qt based cross-platform GUI proxy configuration manager (backend: sing-box).

%install
rm -rf %{buildroot}
mkdir -p %{buildroot}/opt/Throne
cp -a ${SRC_DIR}/. %{buildroot}/opt/Throne/
rm -f %{buildroot}/opt/Throne/Throne.debug
mkdir -p %{buildroot}/usr/share/applications
cp ${WORK}/Throne.desktop %{buildroot}/usr/share/applications/Throne.desktop

%files
/opt/Throne
/usr/share/applications/Throne.desktop

%post
update-desktop-database &> /dev/null || :

%postun
update-desktop-database &> /dev/null || :
EOF

rpmbuild -bb \
--define "_topdir $WORK" \
--define "_rpmdir $WORK/RPMS" \
--target "$RPM_ARCH" \
"$WORK/Throne.spec"

find "$WORK/RPMS" -name '*.rpm' -exec mv {} ./Throne.rpm \;