From 778be93a39216dbbacd6ee4ebf8f752e9ad60d26 Mon Sep 17 00:00:00 2001 From: Julian Chang Date: Sun, 19 Jul 2026 10:05:19 +0900 Subject: [PATCH] Add aur publish --- .github/workflows/aur_publish.yml | 97 +++++++++++++++++++++++++ .github/workflows/oneclient_release.yml | 14 +++- distribution/aur/oneclient-bin/PKGBUILD | 36 +++++++++ distribution/aur/oneclient/PKGBUILD | 68 +++++++++++++++++ 4 files changed, 213 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/aur_publish.yml create mode 100644 distribution/aur/oneclient-bin/PKGBUILD create mode 100644 distribution/aur/oneclient/PKGBUILD diff --git a/.github/workflows/aur_publish.yml b/.github/workflows/aur_publish.yml new file mode 100644 index 00000000..cef6d6d5 --- /dev/null +++ b/.github/workflows/aur_publish.yml @@ -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" diff --git a/.github/workflows/oneclient_release.yml b/.github/workflows/oneclient_release.yml index f9526ce1..df05cf05 100644 --- a/.github/workflows/oneclient_release.yml +++ b/.github/workflows/oneclient_release.yml @@ -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__amd64.deb). + # Rename it to the same OneClient___ 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 diff --git a/distribution/aur/oneclient-bin/PKGBUILD b/distribution/aur/oneclient-bin/PKGBUILD new file mode 100644 index 00000000..93a4c87c --- /dev/null +++ b/distribution/aur/oneclient-bin/PKGBUILD @@ -0,0 +1,36 @@ +# Maintainer: Polyfrost +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" +} diff --git a/distribution/aur/oneclient/PKGBUILD b/distribution/aur/oneclient/PKGBUILD new file mode 100644 index 00000000..13315293 --- /dev/null +++ b/distribution/aur/oneclient/PKGBUILD @@ -0,0 +1,68 @@ +# Maintainer: Polyfrost +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" +}