Skip to content

Commit a5e72ff

Browse files
author
pompurin404
committed
add aur updater
1 parent 935b95b commit a5e72ff

File tree

11 files changed

+261
-0
lines changed

11 files changed

+261
-0
lines changed

.github/workflows/aur.yml

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: aur-updater
2+
on:
3+
push:
4+
branches:
5+
- master
6+
7+
jobs:
8+
update:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
with:
13+
fetch-depth: 0
14+
- name: update version
15+
run: |
16+
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
17+
- name: Publish AUR package
18+
uses: KSXGitHub/github-actions-deploy-aur@v2.7.2
19+
with:
20+
pkgname: mihomo-party-git
21+
pkgbuild: aur/mihomo-party-git/PKGBUILD
22+
commit_username: pompurin404
23+
commit_email: pompurin404@mihomo.party
24+
ssh_private_key: ${{ secrets.PRIVATE_KEY }}
25+
commit_message: Update AUR package
26+
ssh_keyscan_types: rsa,ed25519
27+
allow_empty_commits: false

.github/workflows/build.yml

+39
Original file line numberDiff line numberDiff line change
@@ -153,3 +153,42 @@ jobs:
153153
with:
154154
files: dist/*.dmg
155155
token: ${{ secrets.GITHUB_TOKEN }}
156+
157+
aur-updater:
158+
strategy:
159+
fail-fast: false
160+
matrix:
161+
pkgname:
162+
- mihomo-party-bin
163+
- mihomo-party
164+
if: startsWith(github.ref, 'refs/tags/v')
165+
needs: linux
166+
runs-on: ubuntu-latest
167+
steps:
168+
- name: Update Version
169+
run: |
170+
sed -i "s/pkgver=.*/pkgver=$(echo ${{ github.ref }} | tr -d 'refs/tags/v')/" aur/mihomo-party-bin/PKGBUILD
171+
sed -i "s/pkgver=.*/pkgver=$(echo ${{ github.ref }} | tr -d 'refs/tags/v')/" aur/mihomo-party/PKGBUILD
172+
- name: Update Checksums
173+
if: ${{ matrix.pkgname == 'mihomo-party' }}
174+
run: |
175+
wget https://github.com/pompurin404/mihomo-party/archive/refs/tags/$(echo ${{ github.ref }} | tr -d 'refs/tags/').tar.gz -O release.tar.gz
176+
sed -i "s/sha256sums=.*/sha256sums=(\"$(sha256sum ./release.tar.gz | awk '{print $1}')\")/" aur/mihomo-party/PKGBUILD
177+
- name: Update Checksums
178+
if: ${{ matrix.pkgname == 'mihomo-party-bin' }}
179+
run: |
180+
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
181+
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
182+
sed -i "s/sha256sums_x86_64=.*/sha256sums_x86_64=(\"$(sha256sum ./amd64.deb | awk '{print $1}')\")/" aur/mihomo-party-bin/PKGBUILD
183+
sed -i "s/sha256sums_aarch64=.*/sha256sums_aarch64=(\"$(sha256sum ./arm64.deb | awk '{print $1}')\")/" aur/mihomo-party-bin/PKGBUILD
184+
- name: Publish AUR package
185+
uses: KSXGitHub/github-actions-deploy-aur@v2.7.2
186+
with:
187+
pkgname: ${{ matrix.pkgname }}
188+
pkgbuild: aur/${{ matrix.pkgname }}/PKGBUILD
189+
commit_username: pompurin404
190+
commit_email: pompurin404@mihomo.party
191+
ssh_private_key: ${{ secrets.PRIVATE_KEY }}
192+
commit_message: Update AUR package
193+
ssh_keyscan_types: rsa,ed25519
194+
allow_empty_commits: false

aur/mihomo-party-bin/PKGBUILD

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
pkgname=mihomo-party-bin
2+
_pkgname=mihomo-party
3+
pkgver=0.1.3
4+
pkgrel=1
5+
pkgdesc="Another Mihomo GUI."
6+
arch=('x86_64' 'aarch64')
7+
url="https://github.com/pompurin404/mihomo-party"
8+
license=('GPL3')
9+
conflicts=("mihomo-party-git" 'mihomo-party')
10+
depends=('gtk3' 'libnotify' 'nss' 'libxss' 'libxtst' 'xdg-utils' 'at-spi2-core' 'util-linux-libs' 'at-spi2-core' 'libsecret')
11+
optdepends=('libappindicator-gtk3: Allow mihomo-party to extend a menu via Ayatana indicators in Unity, KDE or Systray (GTK+ 3 library).')
12+
makedepends=('nodejs' 'pnpm' 'jq' 'libxcrypt-compat')
13+
install=$_pkgname.install
14+
source_x86_64=("${_pkgname}-${pkgver}-x86_64.deb::${url}/releases/download/v${pkgver}/mihomo-party-linux-${pkgver}-amd64.deb")
15+
source_aarch64=("${_pkgname}-${pkgver}-aarch64.deb::${url}/releases/download/v${pkgver}/mihomo-party-linux-${pkgver}-arm64.deb")
16+
sha256sums_x86_64=('b8d166f1134573336aaae1866d25262284b0cbabbf393684226aca0fd8d1bd83')
17+
sha256sums_aarch64=('8cd7398b8fc1cd70d41e386af9995cbddc1043d9018391c29f056f1435712a10')
18+
19+
package() {
20+
bsdtar -xf data.tar.xz -C "${pkgdir}/"
21+
chmod +x ${pkgdir}/opt/mihomo-party/mihomo-party
22+
chmod +x ${pkgdir}/opt/mihomo-party/resources/sidecar/mihomo
23+
chmod +x ${pkgdir}/opt/mihomo-party/resources/sidecar/mihomo-alpha
24+
cd ${pkgdir}/../..
25+
install -Dm755 "${_pkgname}.sh" "${pkgdir}/usr/bin/${_pkgname}"
26+
sed -i '3s!/opt/mihomo-party/mihomo-party!mihomo-party!' "${pkgdir}/usr/share/applications/${_pkgname}.desktop"
27+
28+
chown -R root:root ${pkgdir}
29+
}
+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Colored makepkg-like functions
2+
note() {
3+
printf "${_blue}==>${_yellow} NOTE:${_bold} %s${_all_off}\n" "$1"
4+
}
5+
6+
_all_off="$(tput sgr0)"
7+
_bold="${_all_off}$(tput bold)"
8+
_blue="${_bold}$(tput setaf 4)"
9+
_yellow="${_bold}$(tput setaf 3)"
10+
11+
post_install() {
12+
note "Custom flags should be put directly in: ~/.config/mihomo-party-flags.conf"
13+
note "The launcher is called: 'mihomo-party'"
14+
}

aur/mihomo-party-bin/mihomo-party.sh

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/bash
2+
3+
XDG_CONFIG_HOME=${XDG_CONFIG_HOME:-~/.config}
4+
5+
# Allow users to override command-line options
6+
if [[ -f "${XDG_CONFIG_HOME}/mihomo-party-flags.conf" ]]; then
7+
mapfile -t MIHOMO_PARTY_USER_FLAGS <<<"$(grep -v '^#' "${XDG_CONFIG_HOME}/mihomo-party-flags.conf")"
8+
echo "User flags:" ${MIHOMO_PARTY_USER_FLAGS[@]}
9+
fi
10+
11+
# Launch
12+
exec /opt/mihomo-party/mihomo-party ${MIHOMO_PARTY_USER_FLAGS[@]} "$@"

aur/mihomo-party-git/PKGBUILD

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
pkgname=mihomo-party-git
2+
_pkgname=${pkgname%-git}
3+
pkgver=0.1.3.r5.g5f5d6dd
4+
pkgrel=1
5+
pkgdesc="Another Mihomo GUI."
6+
arch=('x86_64' 'aarch64')
7+
url="https://github.com/pompurin404/mihomo-party"
8+
license=('GPL3')
9+
conflicts=("mihomo-party" 'mihomo-party-bin')
10+
depends=('gtk3' 'libnotify' 'nss' 'libxss' 'libxtst' 'xdg-utils' 'at-spi2-core' 'util-linux-libs' 'at-spi2-core' 'libsecret')
11+
optdepends=('libappindicator-gtk3: Allow mihomo-party to extend a menu via Ayatana indicators in Unity, KDE or Systray (GTK+ 3 library).')
12+
makedepends=('nodejs' 'pnpm' 'jq' 'libxcrypt-compat')
13+
install=$_pkgname.install
14+
source=("git+$url.git")
15+
sha256sums=("SKIP")
16+
options=('!lto')
17+
18+
pkgver() {
19+
cd $srcdir/${_pkgname}
20+
( set -o pipefail
21+
git describe --long 2>/dev/null | sed 's/\([^-]*-g\)/r\1/;s/-/./g' | tr -d 'v' ||
22+
printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
23+
)
24+
}
25+
26+
prepare(){
27+
cd $srcdir/${_pkgname}
28+
pnpm install
29+
}
30+
31+
build(){
32+
cd $srcdir/${_pkgname}
33+
pnpm build:linux deb
34+
}
35+
36+
package() {
37+
cd $srcdir/${_pkgname}/dist
38+
bsdtar -xf mihomo-party-linux-$(jq '.version' $srcdir/${_pkgname}/package.json | tr -d 'v"')*.deb
39+
bsdtar -xf data.tar.xz -C "${pkgdir}/"
40+
chmod +x ${pkgdir}/opt/mihomo-party/mihomo-party
41+
chmod +x ${pkgdir}/opt/mihomo-party/resources/sidecar/mihomo
42+
chmod +x ${pkgdir}/opt/mihomo-party/resources/sidecar/mihomo-alpha
43+
cd ${pkgdir}/../..
44+
install -Dm755 "${_pkgname}.sh" "${pkgdir}/usr/bin/${_pkgname}"
45+
46+
sed -i '3s!/opt/mihomo-party/mihomo-party!mihomo-party!' "${pkgdir}/usr/share/applications/${_pkgname}.desktop"
47+
48+
chown -R root:root ${pkgdir}
49+
}
+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Colored makepkg-like functions
2+
note() {
3+
printf "${_blue}==>${_yellow} NOTE:${_bold} %s${_all_off}\n" "$1"
4+
}
5+
6+
_all_off="$(tput sgr0)"
7+
_bold="${_all_off}$(tput bold)"
8+
_blue="${_bold}$(tput setaf 4)"
9+
_yellow="${_bold}$(tput setaf 3)"
10+
11+
post_install() {
12+
note "Custom flags should be put directly in: ~/.config/mihomo-party-flags.conf"
13+
note "The launcher is called: 'mihomo-party'"
14+
}

aur/mihomo-party-git/mihomo-party.sh

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/bash
2+
3+
XDG_CONFIG_HOME=${XDG_CONFIG_HOME:-~/.config}
4+
5+
# Allow users to override command-line options
6+
if [[ -f "${XDG_CONFIG_HOME}/mihomo-party-flags.conf" ]]; then
7+
mapfile -t MIHOMO_PARTY_USER_FLAGS <<<"$(grep -v '^#' "${XDG_CONFIG_HOME}/mihomo-party-flags.conf")"
8+
echo "User flags:" ${MIHOMO_PARTY_USER_FLAGS[@]}
9+
fi
10+
11+
# Launch
12+
exec /opt/mihomo-party/mihomo-party ${MIHOMO_PARTY_USER_FLAGS[@]} "$@"

aur/mihomo-party/PKGBUILD

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
pkgname=mihomo-party
2+
pkgver=0.1.3
3+
pkgrel=1
4+
pkgdesc="Another Mihomo GUI."
5+
arch=('x86_64' 'aarch64')
6+
url="https://github.com/pompurin404/mihomo-party"
7+
license=('GPL3')
8+
conflicts=("mihomo-party-git" 'mihomo-party-bin')
9+
depends=('gtk3' 'libnotify' 'nss' 'libxss' 'libxtst' 'xdg-utils' 'at-spi2-core' 'util-linux-libs' 'at-spi2-core' 'libsecret')
10+
optdepends=('libappindicator-gtk3: Allow mihomo-party to extend a menu via Ayatana indicators in Unity, KDE or Systray (GTK+ 3 library).')
11+
makedepends=('nodejs' 'pnpm' 'libxcrypt-compat')
12+
install=$pkgname.install
13+
source=("${pkgname}-${pkgver}.tar.gz::${url}/archive/refs/tags/v${pkgver}.tar.gz")
14+
sha256sums=("52d761e9432e17477acb8adb5744676df946476e0eb5210fee2b6d45f497f218")
15+
options=('!lto')
16+
17+
prepare(){
18+
cd $srcdir/${pkgname}-${pkgver}
19+
pnpm install
20+
}
21+
22+
build(){
23+
cd $srcdir/${pkgname}-${pkgver}
24+
pnpm build:linux deb
25+
}
26+
27+
package() {
28+
cd $srcdir/${pkgname}-${pkgver}/dist
29+
bsdtar -xf mihomo-party-linux-${pkgver}*.deb
30+
bsdtar -xf data.tar.xz -C "${pkgdir}/"
31+
chmod +x ${pkgdir}/opt/mihomo-party/mihomo-party
32+
chmod +x ${pkgdir}/opt/mihomo-party/resources/sidecar/mihomo
33+
chmod +x ${pkgdir}/opt/mihomo-party/resources/sidecar/mihomo-alpha
34+
cd ${pkgdir}/../..
35+
install -Dm755 "${pkgname}.sh" "${pkgdir}/usr/bin/${pkgname}"
36+
sed -i '3s!/opt/mihomo-party/mihomo-party!mihomo-party!' "${pkgdir}/usr/share/applications/${pkgname}.desktop"
37+
38+
chown -R root:root ${pkgdir}
39+
}

aur/mihomo-party/mihomo-party.install

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Colored makepkg-like functions
2+
note() {
3+
printf "${_blue}==>${_yellow} NOTE:${_bold} %s${_all_off}\n" "$1"
4+
}
5+
6+
_all_off="$(tput sgr0)"
7+
_bold="${_all_off}$(tput bold)"
8+
_blue="${_bold}$(tput setaf 4)"
9+
_yellow="${_bold}$(tput setaf 3)"
10+
11+
post_install() {
12+
note "Custom flags should be put directly in: ~/.config/mihomo-party-flags.conf"
13+
note "The launcher is called: 'mihomo-party'"
14+
}

aur/mihomo-party/mihomo-party.sh

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/bash
2+
3+
XDG_CONFIG_HOME=${XDG_CONFIG_HOME:-~/.config}
4+
5+
# Allow users to override command-line options
6+
if [[ -f "${XDG_CONFIG_HOME}/mihomo-party-flags.conf" ]]; then
7+
mapfile -t MIHOMO_PARTY_USER_FLAGS <<<"$(grep -v '^#' "${XDG_CONFIG_HOME}/mihomo-party-flags.conf")"
8+
echo "User flags:" ${MIHOMO_PARTY_USER_FLAGS[@]}
9+
fi
10+
11+
# Launch
12+
exec /opt/mihomo-party/mihomo-party ${MIHOMO_PARTY_USER_FLAGS[@]} "$@"

0 commit comments

Comments
 (0)