Add aur publish

This commit is contained in:
Julian Chang 2026-07-19 10:05:19 +09:00
parent 445ad49ec8
commit 778be93a39
No known key found for this signature in database
4 changed files with 213 additions and 2 deletions

97
.github/workflows/aur_publish.yml vendored Normal file
View file

@ -0,0 +1,97 @@
name: Publish AUR Packages
on:
release:
types: [published]
workflow_dispatch:
inputs:
tag:
description: 'Release tag (e.g. oneclient-2.0.1)'
required: true
jobs:
resolve:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.parse.outputs.version }}
steps:
- name: Parse release tag
id: parse
run: |
TAG="${{ github.event.release.tag_name || inputs.tag }}"
if [[ "$TAG" =~ ^oneclient-(.+)$ ]]; then
echo "version=${BASH_REMATCH[1]}" >> "$GITHUB_OUTPUT"
else
echo "::error::Tag '$TAG' does not match oneclient-*"
exit 1
fi
publish-source:
needs: resolve
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Compute source sha256
id: hash
env:
VERSION: ${{ needs.resolve.outputs.version }}
run: |
URL="https://github.com/${{ github.repository }}/archive/refs/tags/oneclient-${VERSION}.tar.gz"
SHA=$(curl -sL "$URL" | sha256sum | cut -d' ' -f1)
echo "sha256=$SHA" >> "$GITHUB_OUTPUT"
- name: Prepare PKGBUILD
env:
VERSION: ${{ needs.resolve.outputs.version }}
SHA256: ${{ steps.hash.outputs.sha256 }}
run: |
PKGBUILD="distribution/aur/oneclient/PKGBUILD"
sed -i "s/^pkgver=.*/pkgver=${VERSION}/" "$PKGBUILD"
sed -i "s/^pkgrel=.*/pkgrel=1/" "$PKGBUILD"
sed -i "s/^sha256sums=.*/sha256sums=('${SHA256}')/" "$PKGBUILD"
- name: Publish to AUR
uses: KSXGitHub/github-actions-deploy-aur@v3
with:
pkgname: oneclient
pkgbuild: distribution/aur/oneclient/PKGBUILD
commit_username: ${{ secrets.AUR_USERNAME }}
commit_email: ${{ secrets.AUR_EMAIL }}
ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
commit_message: "oneclient ${{ needs.resolve.outputs.version }}-1"
publish-bin:
needs: resolve
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Compute deb sha256
id: hash
env:
VERSION: ${{ needs.resolve.outputs.version }}
run: |
URL="https://github.com/${{ github.repository }}/releases/download/oneclient-${VERSION}/OneClient_${VERSION}_linux_x86_64.deb"
SHA=$(curl -sL "$URL" | sha256sum | cut -d' ' -f1)
echo "sha256=$SHA" >> "$GITHUB_OUTPUT"
- name: Prepare PKGBUILD
env:
VERSION: ${{ needs.resolve.outputs.version }}
SHA256: ${{ steps.hash.outputs.sha256 }}
run: |
PKGBUILD="distribution/aur/oneclient-bin/PKGBUILD"
sed -i "s/^pkgver=.*/pkgver=${VERSION}/" "$PKGBUILD"
sed -i "s/^pkgrel=.*/pkgrel=1/" "$PKGBUILD"
sed -i "s/^sha256sums=.*/sha256sums=('${SHA256}')/" "$PKGBUILD"
- name: Publish to AUR
uses: KSXGitHub/github-actions-deploy-aur@v3
with:
pkgname: oneclient-bin
pkgbuild: distribution/aur/oneclient-bin/PKGBUILD
commit_username: ${{ secrets.AUR_USERNAME }}
commit_email: ${{ secrets.AUR_EMAIL }}
ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
commit_message: "oneclient-bin ${{ needs.resolve.outputs.version }}-1"

View file

@ -244,9 +244,19 @@ jobs:
cp "$updater_file" "$OUT_DIR/$unique"
cp "$updater_file.sig" "$OUT_DIR/$unique.sig"
# Upload human-facing installers (dmg/deb/AppImage/signed exe) + the renamed
# cargo-packager names the .deb after the binary (oneclient_app_<ver>_amd64.deb).
# Rename it to the same OneClient_<ver>_<os>_<arch> scheme as the other assets so
# the AUR oneclient-bin package can point at a stable, predictable URL.
deb_unique=""
deb_matches=("$OUT_DIR"/*.deb)
if [ -e "${deb_matches[0]}" ]; then
deb_unique="OneClient_${VERSION}_${OS_KEY}_${ARCH}.deb"
cp "${deb_matches[0]}" "$OUT_DIR/$deb_unique"
fi
# Upload human-facing installers (dmg/renamed deb/AppImage/signed exe) + the renamed
# updater bundle and its .sig. Skip the un-renamed updater bundle to avoid clashes.
for f in "$OUT_DIR"/*.dmg "$OUT_DIR"/*.deb "$OUT_DIR"/*.AppImage "$OUT_DIR"/*-setup.exe "$OUT_DIR/$unique" "$OUT_DIR/$unique.sig"; do
for f in "$OUT_DIR"/*.dmg ${deb_unique:+"$OUT_DIR/$deb_unique"} "$OUT_DIR"/*.AppImage "$OUT_DIR"/*-setup.exe "$OUT_DIR/$unique" "$OUT_DIR/$unique.sig"; do
[ -e "$f" ] || continue
gh release upload "$TAG" "$f" --clobber
done

View file

@ -0,0 +1,36 @@
# Maintainer: Polyfrost <contact@atmofrost.org>
pkgname=oneclient-bin
_appname=OneClient
pkgver=2.0.1
pkgrel=1
pkgdesc="Next-generation open source Minecraft launcher (prebuilt)"
arch=('x86_64')
url="https://github.com/Polyfrost/OneLauncher"
license=('GPL-3.0-only')
depends=(
'fontconfig'
'freetype2'
'libglvnd'
'libxcursor'
'libxrandr'
'libxi'
'libxkbcommon'
'wayland'
'dbus'
'gtk3'
)
provides=('oneclient')
conflicts=('oneclient')
options=('!strip')
_debfile="${_appname}_${pkgver}_linux_x86_64.deb"
source=("${_debfile}::${url}/releases/download/oneclient-${pkgver}/${_debfile}")
sha256sums=('SKIP')
package() {
cd "$pkgdir"
bsdtar -xf "$srcdir/$_debfile"
bsdtar -xf data.tar.*
rm -f debian-binary control.tar.* data.tar.*
ln -s oneclient_app "$pkgdir/usr/bin/oneclient"
}

View file

@ -0,0 +1,68 @@
# Maintainer: Polyfrost <contact@atmofrost.org>
pkgname=oneclient
pkgver=2.0.1
pkgrel=1
pkgdesc="Next-generation open source Minecraft launcher (built from source)"
arch=('x86_64')
url="https://github.com/Polyfrost/OneLauncher"
license=('GPL-3.0-only')
depends=(
'fontconfig'
'freetype2'
'libglvnd'
'libxcursor'
'libxrandr'
'libxi'
'libxkbcommon'
'wayland'
'dbus'
'gtk3'
)
makedepends=(
'rust'
'cargo'
'cmake'
'clang'
'pkgconf'
'python'
)
provides=('oneclient')
conflicts=('oneclient-bin')
options=('!lto')
source=("$pkgname-$pkgver.tar.gz::${url}/archive/refs/tags/oneclient-${pkgver}.tar.gz")
sha256sums=('SKIP')
_srcdir="OneLauncher-oneclient-${pkgver}"
prepare() {
cd "$srcdir/$_srcdir"
export CARGO_HOME="$srcdir/cargo-home"
cargo fetch --locked --target "$(rustc -vV | sed -n 's/host: //p')"
}
build() {
cd "$srcdir/$_srcdir"
export CARGO_HOME="$srcdir/cargo-home"
export RUSTUP_TOOLCHAIN=stable
export CARGO_TARGET_DIR=target
cargo build --release --frozen --bin oneclient_app
}
package() {
cd "$srcdir/$_srcdir"
local appdir="packages/oneclient_app"
install -Dm755 "target/release/oneclient_app" "$pkgdir/usr/bin/oneclient_app"
ln -s oneclient_app "$pkgdir/usr/bin/oneclient"
install -dm755 "$pkgdir/usr/share/applications"
sed -e 's|{{exec}}|oneclient_app|g' \
-e 's|{{icon}}|org.polyfrost.OneClient|g' \
"$appdir/distribution/linux/org.polyfrost.oneclient.template" \
> "$pkgdir/usr/share/applications/org.polyfrost.OneClient.desktop"
install -Dm644 "$appdir/icons/32x32.png" "$pkgdir/usr/share/icons/hicolor/32x32/apps/org.polyfrost.OneClient.png"
install -Dm644 "$appdir/icons/128x128.png" "$pkgdir/usr/share/icons/hicolor/128x128/apps/org.polyfrost.OneClient.png"
install -Dm644 "$appdir/icons/128x128@2x.png" "$pkgdir/usr/share/icons/hicolor/256x256/apps/org.polyfrost.OneClient.png"
install -Dm644 "$appdir/icons/512x512.png" "$pkgdir/usr/share/icons/hicolor/512x512/apps/org.polyfrost.OneClient.png"
}