Skip to content

Commit

Permalink
add aur updater
Browse files Browse the repository at this point in the history
  • Loading branch information
pompurin404 committed Aug 7, 2024
1 parent 935b95b commit 22578f7
Show file tree
Hide file tree
Showing 10 changed files with 228 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/aur.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: aur-updater
on:
push:
branches:
- master

jobs:
update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: update version
if: startsWith(github.ref, 'refs/tags/v')
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
29 changes: 29 additions & 0 deletions aur/mihomo-party-bin/PKGBUILD
Original file line number Diff line number Diff line change
@@ -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_x86_64=("${_pkgname}-${pkgver}-aarch64.deb::${url}/releases/download/v${pkgver}/mihomo-party-linux-${pkgver}-arm64.deb")
sha256sums_x86_64=('b8d166f1134573336aaae1866d25262284b0cbabbf393684226aca0fd8d1bd83')
sha256sums_aarch64=('8cd7398b8fc1cd70d41e386af9995cbddc1043d9018391c29f056f1435712a10')

package() {
tar xpf data.tar.gz -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}
}
14 changes: 14 additions & 0 deletions aur/mihomo-party-bin/mihomo-party.install
Original file line number Diff line number Diff line change
@@ -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'"
}
12 changes: 12 additions & 0 deletions aur/mihomo-party-bin/mihomo-party.sh
Original file line number Diff line number Diff line change
@@ -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[@]} "$@"
52 changes: 52 additions & 0 deletions aur/mihomo-party-git/PKGBUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
pkgname=mihomo-party-git
_pkgname=${pkgname%-git}
pkgver=0.1.3.r4.g935b95b
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() {
version = jq '.version'|tr -d 'v"'
cd $srcdir/${_pkgname}/dist
bsdtar -xf mihomo-party-linux-${version}*.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}/../..
# Launcher
install -Dm755 "${_pkgname}.sh" "${pkgdir}/usr/bin/${_pkgname}"

# Launcher Fix
sed -i '3s!/opt/mihomo-party/mihomo-party!mihomo-party!' "${pkgdir}/usr/share/applications/${_pkgname}.desktop"

chown -R root:root ${pkgdir}
}
14 changes: 14 additions & 0 deletions aur/mihomo-party-git/mihomo-party.install
Original file line number Diff line number Diff line change
@@ -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'"
}
12 changes: 12 additions & 0 deletions aur/mihomo-party-git/mihomo-party.sh
Original file line number Diff line number Diff line change
@@ -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[@]} "$@"
43 changes: 43 additions & 0 deletions aur/mihomo-party/PKGBUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
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' 'jq' '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}
pnpm install
}

build(){
cd $srcdir/${pkgname}
pnpm build:linux deb
}

package() {
version = jq '.version'|tr -d 'v"'
cd $srcdir/${pkgname}/dist
bsdtar -xf mihomo-party-linux-${version}*.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}/../..
# Launcher
install -Dm755 "${pkgname}.sh" "${pkgdir}/usr/bin/${pkgname}"

# Launcher Fix
sed -i '3s!/opt/mihomo-party/mihomo-party!mihomo-party!' "${pkgdir}/usr/share/applications/${pkgname}.desktop"

chown -R root:root ${pkgdir}
}
14 changes: 14 additions & 0 deletions aur/mihomo-party/mihomo-party.install
Original file line number Diff line number Diff line change
@@ -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'"
}
12 changes: 12 additions & 0 deletions aur/mihomo-party/mihomo-party.sh
Original file line number Diff line number Diff line change
@@ -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[@]} "$@"

0 comments on commit 22578f7

Please sign in to comment.