diff --git a/.github/workflows/aur.yml b/.github/workflows/aur.yml new file mode 100644 index 0000000..58efc85 --- /dev/null +++ b/.github/workflows/aur.yml @@ -0,0 +1,27 @@ +name: aur-updater +on: + push: + branches: + - master + +jobs: + update: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: update version + run: | + sed -i "s/pkgver=.*/pkgver=$(git describe --long 2>/dev/null | sed 's/\([^-]*-g\)/r\1/;s/-/./g' | tr -d 'v')/" aur/mihomo-party-git/PKGBUILD + - name: Publish AUR package + uses: KSXGitHub/github-actions-deploy-aur@v2.7.2 + with: + pkgname: mihomo-party-git + pkgbuild: aur/mihomo-party-git/PKGBUILD + commit_username: pompurin404 + commit_email: pompurin404@mihomo.party + ssh_private_key: ${{ secrets.PRIVATE_KEY }} + commit_message: Update AUR package + ssh_keyscan_types: rsa,ed25519 + allow_empty_commits: false diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 73f034b..9e2b222 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -153,3 +153,42 @@ jobs: with: files: dist/*.dmg token: ${{ secrets.GITHUB_TOKEN }} + + aur-updater: + strategy: + fail-fast: false + matrix: + pkgname: + - mihomo-party-bin + - mihomo-party + if: startsWith(github.ref, 'refs/tags/v') + needs: linux + runs-on: ubuntu-latest + steps: + - name: Update Version + run: | + sed -i "s/pkgver=.*/pkgver=$(echo ${{ github.ref }} | tr -d 'refs/tags/v')/" aur/mihomo-party-bin/PKGBUILD + sed -i "s/pkgver=.*/pkgver=$(echo ${{ github.ref }} | tr -d 'refs/tags/v')/" aur/mihomo-party/PKGBUILD + - name: Update Checksums + if: ${{ matrix.pkgname == 'mihomo-party' }} + run: | + wget https://github.com/pompurin404/mihomo-party/archive/refs/tags/$(echo ${{ github.ref }} | tr -d 'refs/tags/').tar.gz -O release.tar.gz + sed -i "s/sha256sums=.*/sha256sums=(\"$(sha256sum ./release.tar.gz | awk '{print $1}')\")/" aur/mihomo-party/PKGBUILD + - name: Update Checksums + if: ${{ matrix.pkgname == 'mihomo-party-bin' }} + run: | + wget https://github.com/pompurin404/mihomo-party/releases/download/$(echo ${{ github.ref }} | tr -d 'refs/tags/')/mihomo-party-linux$(echo ${{ github.ref }} | tr -d 'refs/tags/v')-amd64.deb -O amd64.deb + wget https://github.com/pompurin404/mihomo-party/releases/download/$(echo ${{ github.ref }} | tr -d 'refs/tags/')/mihomo-party-linux$(echo ${{ github.ref }} | tr -d 'refs/tags/v')-arm64.deb -O arm64.deb + sed -i "s/sha256sums_x86_64=.*/sha256sums_x86_64=(\"$(sha256sum ./amd64.deb | awk '{print $1}')\")/" aur/mihomo-party-bin/PKGBUILD + sed -i "s/sha256sums_aarch64=.*/sha256sums_aarch64=(\"$(sha256sum ./arm64.deb | awk '{print $1}')\")/" aur/mihomo-party-bin/PKGBUILD + - name: Publish AUR package + uses: KSXGitHub/github-actions-deploy-aur@v2.7.2 + with: + pkgname: ${{ matrix.pkgname }} + pkgbuild: aur/${{ matrix.pkgname }}/PKGBUILD + commit_username: pompurin404 + commit_email: pompurin404@mihomo.party + ssh_private_key: ${{ secrets.PRIVATE_KEY }} + commit_message: Update AUR package + ssh_keyscan_types: rsa,ed25519 + allow_empty_commits: false diff --git a/aur/mihomo-party-bin/PKGBUILD b/aur/mihomo-party-bin/PKGBUILD new file mode 100644 index 0000000..0692c1c --- /dev/null +++ b/aur/mihomo-party-bin/PKGBUILD @@ -0,0 +1,29 @@ +pkgname=mihomo-party-bin +_pkgname=mihomo-party +pkgver=0.1.3 +pkgrel=1 +pkgdesc="Another Mihomo GUI." +arch=('x86_64' 'aarch64') +url="https://github.com/pompurin404/mihomo-party" +license=('GPL3') +conflicts=("mihomo-party-git" 'mihomo-party') +depends=('gtk3' 'libnotify' 'nss' 'libxss' 'libxtst' 'xdg-utils' 'at-spi2-core' 'util-linux-libs' 'at-spi2-core' 'libsecret') +optdepends=('libappindicator-gtk3: Allow mihomo-party to extend a menu via Ayatana indicators in Unity, KDE or Systray (GTK+ 3 library).') +makedepends=('nodejs' 'pnpm' 'jq' 'libxcrypt-compat') +install=$_pkgname.install +source_x86_64=("${_pkgname}-${pkgver}-x86_64.deb::${url}/releases/download/v${pkgver}/mihomo-party-linux-${pkgver}-amd64.deb") +source_aarch64=("${_pkgname}-${pkgver}-aarch64.deb::${url}/releases/download/v${pkgver}/mihomo-party-linux-${pkgver}-arm64.deb") +sha256sums_x86_64=('b8d166f1134573336aaae1866d25262284b0cbabbf393684226aca0fd8d1bd83') +sha256sums_aarch64=('8cd7398b8fc1cd70d41e386af9995cbddc1043d9018391c29f056f1435712a10') + +package() { + bsdtar -xf data.tar.xz -C "${pkgdir}/" + chmod +x ${pkgdir}/opt/mihomo-party/mihomo-party + chmod +x ${pkgdir}/opt/mihomo-party/resources/sidecar/mihomo + chmod +x ${pkgdir}/opt/mihomo-party/resources/sidecar/mihomo-alpha + cd ${pkgdir}/../.. + install -Dm755 "${_pkgname}.sh" "${pkgdir}/usr/bin/${_pkgname}" + sed -i '3s!/opt/mihomo-party/mihomo-party!mihomo-party!' "${pkgdir}/usr/share/applications/${_pkgname}.desktop" + + chown -R root:root ${pkgdir} +} \ No newline at end of file diff --git a/aur/mihomo-party-bin/mihomo-party.install b/aur/mihomo-party-bin/mihomo-party.install new file mode 100644 index 0000000..218d794 --- /dev/null +++ b/aur/mihomo-party-bin/mihomo-party.install @@ -0,0 +1,14 @@ +# Colored makepkg-like functions +note() { + printf "${_blue}==>${_yellow} NOTE:${_bold} %s${_all_off}\n" "$1" +} + +_all_off="$(tput sgr0)" +_bold="${_all_off}$(tput bold)" +_blue="${_bold}$(tput setaf 4)" +_yellow="${_bold}$(tput setaf 3)" + +post_install() { + note "Custom flags should be put directly in: ~/.config/mihomo-party-flags.conf" + note "The launcher is called: 'mihomo-party'" +} \ No newline at end of file diff --git a/aur/mihomo-party-bin/mihomo-party.sh b/aur/mihomo-party-bin/mihomo-party.sh new file mode 100644 index 0000000..6304ccb --- /dev/null +++ b/aur/mihomo-party-bin/mihomo-party.sh @@ -0,0 +1,12 @@ +#!/usr/bin/bash + +XDG_CONFIG_HOME=${XDG_CONFIG_HOME:-~/.config} + +# Allow users to override command-line options +if [[ -f "${XDG_CONFIG_HOME}/mihomo-party-flags.conf" ]]; then + mapfile -t MIHOMO_PARTY_USER_FLAGS <<<"$(grep -v '^#' "${XDG_CONFIG_HOME}/mihomo-party-flags.conf")" + echo "User flags:" ${MIHOMO_PARTY_USER_FLAGS[@]} +fi + +# Launch +exec /opt/mihomo-party/mihomo-party ${MIHOMO_PARTY_USER_FLAGS[@]} "$@" diff --git a/aur/mihomo-party-git/PKGBUILD b/aur/mihomo-party-git/PKGBUILD new file mode 100644 index 0000000..90e5ad4 --- /dev/null +++ b/aur/mihomo-party-git/PKGBUILD @@ -0,0 +1,49 @@ +pkgname=mihomo-party-git +_pkgname=${pkgname%-git} +pkgver=0.1.3.r5.g5f5d6dd +pkgrel=1 +pkgdesc="Another Mihomo GUI." +arch=('x86_64' 'aarch64') +url="https://github.com/pompurin404/mihomo-party" +license=('GPL3') +conflicts=("mihomo-party" 'mihomo-party-bin') +depends=('gtk3' 'libnotify' 'nss' 'libxss' 'libxtst' 'xdg-utils' 'at-spi2-core' 'util-linux-libs' 'at-spi2-core' 'libsecret') +optdepends=('libappindicator-gtk3: Allow mihomo-party to extend a menu via Ayatana indicators in Unity, KDE or Systray (GTK+ 3 library).') +makedepends=('nodejs' 'pnpm' 'jq' 'libxcrypt-compat') +install=$_pkgname.install +source=("git+$url.git") +sha256sums=("SKIP") +options=('!lto') + +pkgver() { + cd $srcdir/${_pkgname} + ( set -o pipefail + git describe --long 2>/dev/null | sed 's/\([^-]*-g\)/r\1/;s/-/./g' | tr -d 'v' || + printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)" + ) +} + +prepare(){ + cd $srcdir/${_pkgname} + pnpm install +} + +build(){ + cd $srcdir/${_pkgname} + pnpm build:linux deb +} + +package() { + cd $srcdir/${_pkgname}/dist + bsdtar -xf mihomo-party-linux-$(jq '.version' $srcdir/${_pkgname}/package.json | tr -d 'v"')*.deb + bsdtar -xf data.tar.xz -C "${pkgdir}/" + chmod +x ${pkgdir}/opt/mihomo-party/mihomo-party + chmod +x ${pkgdir}/opt/mihomo-party/resources/sidecar/mihomo + chmod +x ${pkgdir}/opt/mihomo-party/resources/sidecar/mihomo-alpha + cd ${pkgdir}/../.. + install -Dm755 "${_pkgname}.sh" "${pkgdir}/usr/bin/${_pkgname}" + + sed -i '3s!/opt/mihomo-party/mihomo-party!mihomo-party!' "${pkgdir}/usr/share/applications/${_pkgname}.desktop" + + chown -R root:root ${pkgdir} +} \ No newline at end of file diff --git a/aur/mihomo-party-git/mihomo-party.install b/aur/mihomo-party-git/mihomo-party.install new file mode 100644 index 0000000..218d794 --- /dev/null +++ b/aur/mihomo-party-git/mihomo-party.install @@ -0,0 +1,14 @@ +# Colored makepkg-like functions +note() { + printf "${_blue}==>${_yellow} NOTE:${_bold} %s${_all_off}\n" "$1" +} + +_all_off="$(tput sgr0)" +_bold="${_all_off}$(tput bold)" +_blue="${_bold}$(tput setaf 4)" +_yellow="${_bold}$(tput setaf 3)" + +post_install() { + note "Custom flags should be put directly in: ~/.config/mihomo-party-flags.conf" + note "The launcher is called: 'mihomo-party'" +} \ No newline at end of file diff --git a/aur/mihomo-party-git/mihomo-party.sh b/aur/mihomo-party-git/mihomo-party.sh new file mode 100644 index 0000000..6304ccb --- /dev/null +++ b/aur/mihomo-party-git/mihomo-party.sh @@ -0,0 +1,12 @@ +#!/usr/bin/bash + +XDG_CONFIG_HOME=${XDG_CONFIG_HOME:-~/.config} + +# Allow users to override command-line options +if [[ -f "${XDG_CONFIG_HOME}/mihomo-party-flags.conf" ]]; then + mapfile -t MIHOMO_PARTY_USER_FLAGS <<<"$(grep -v '^#' "${XDG_CONFIG_HOME}/mihomo-party-flags.conf")" + echo "User flags:" ${MIHOMO_PARTY_USER_FLAGS[@]} +fi + +# Launch +exec /opt/mihomo-party/mihomo-party ${MIHOMO_PARTY_USER_FLAGS[@]} "$@" diff --git a/aur/mihomo-party/PKGBUILD b/aur/mihomo-party/PKGBUILD new file mode 100644 index 0000000..48014a9 --- /dev/null +++ b/aur/mihomo-party/PKGBUILD @@ -0,0 +1,39 @@ +pkgname=mihomo-party +pkgver=0.1.3 +pkgrel=1 +pkgdesc="Another Mihomo GUI." +arch=('x86_64' 'aarch64') +url="https://github.com/pompurin404/mihomo-party" +license=('GPL3') +conflicts=("mihomo-party-git" 'mihomo-party-bin') +depends=('gtk3' 'libnotify' 'nss' 'libxss' 'libxtst' 'xdg-utils' 'at-spi2-core' 'util-linux-libs' 'at-spi2-core' 'libsecret') +optdepends=('libappindicator-gtk3: Allow mihomo-party to extend a menu via Ayatana indicators in Unity, KDE or Systray (GTK+ 3 library).') +makedepends=('nodejs' 'pnpm' 'libxcrypt-compat') +install=$pkgname.install +source=("${pkgname}-${pkgver}.tar.gz::${url}/archive/refs/tags/v${pkgver}.tar.gz") +sha256sums=("52d761e9432e17477acb8adb5744676df946476e0eb5210fee2b6d45f497f218") +options=('!lto') + +prepare(){ + cd $srcdir/${pkgname}-${pkgver} + pnpm install +} + +build(){ + cd $srcdir/${pkgname}-${pkgver} + pnpm build:linux deb +} + +package() { + cd $srcdir/${pkgname}-${pkgver}/dist + bsdtar -xf mihomo-party-linux-${pkgver}*.deb + bsdtar -xf data.tar.xz -C "${pkgdir}/" + chmod +x ${pkgdir}/opt/mihomo-party/mihomo-party + chmod +x ${pkgdir}/opt/mihomo-party/resources/sidecar/mihomo + chmod +x ${pkgdir}/opt/mihomo-party/resources/sidecar/mihomo-alpha + cd ${pkgdir}/../.. + install -Dm755 "${pkgname}.sh" "${pkgdir}/usr/bin/${pkgname}" + sed -i '3s!/opt/mihomo-party/mihomo-party!mihomo-party!' "${pkgdir}/usr/share/applications/${pkgname}.desktop" + + chown -R root:root ${pkgdir} +} \ No newline at end of file diff --git a/aur/mihomo-party/mihomo-party.install b/aur/mihomo-party/mihomo-party.install new file mode 100644 index 0000000..218d794 --- /dev/null +++ b/aur/mihomo-party/mihomo-party.install @@ -0,0 +1,14 @@ +# Colored makepkg-like functions +note() { + printf "${_blue}==>${_yellow} NOTE:${_bold} %s${_all_off}\n" "$1" +} + +_all_off="$(tput sgr0)" +_bold="${_all_off}$(tput bold)" +_blue="${_bold}$(tput setaf 4)" +_yellow="${_bold}$(tput setaf 3)" + +post_install() { + note "Custom flags should be put directly in: ~/.config/mihomo-party-flags.conf" + note "The launcher is called: 'mihomo-party'" +} \ No newline at end of file diff --git a/aur/mihomo-party/mihomo-party.sh b/aur/mihomo-party/mihomo-party.sh new file mode 100644 index 0000000..6304ccb --- /dev/null +++ b/aur/mihomo-party/mihomo-party.sh @@ -0,0 +1,12 @@ +#!/usr/bin/bash + +XDG_CONFIG_HOME=${XDG_CONFIG_HOME:-~/.config} + +# Allow users to override command-line options +if [[ -f "${XDG_CONFIG_HOME}/mihomo-party-flags.conf" ]]; then + mapfile -t MIHOMO_PARTY_USER_FLAGS <<<"$(grep -v '^#' "${XDG_CONFIG_HOME}/mihomo-party-flags.conf")" + echo "User flags:" ${MIHOMO_PARTY_USER_FLAGS[@]} +fi + +# Launch +exec /opt/mihomo-party/mihomo-party ${MIHOMO_PARTY_USER_FLAGS[@]} "$@"