updata-aur #14
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Get Tag from desktop and Push to Aur | |
| on: | |
| repository_dispatch: | |
| types: [updata-aur] | |
| jobs: | |
| push-to-aur: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Update PKGBUILD with pkgver and fullver | |
| run: | | |
| tag="${{ github.event.client_payload.tag }}" | |
| if [[ -z "$tag" ]]; then | |
| echo "错误:dispatch 事件中没有提供 tag" | |
| exit 1 | |
| fi | |
| fullver="${tag#v}" | |
| if [[ "$fullver" != *-* ]]; then | |
| echo "错误:tag '$tag' 缺少 commit hash 后缀" | |
| echo "预期格式:vX.Y.Z-xxxxxxxx" | |
| exit 1 | |
| fi | |
| pkgver="${fullver%%-*}" | |
| echo "原始 tag: $tag" | |
| echo "fullver: $fullver" | |
| echo "pkgver: $pkgver" | |
| sed -i "s|^pkgver=.*|pkgver=$pkgver|" PKGBUILD | |
| sed -i "s|^fullver=.*|fullver=$fullver|" PKGBUILD | |
| grep -E "^(pkgver|fullver)=" PKGBUILD || true | |
| - name: Generate .SRCINFO in Arch container | |
| run: | | |
| set -euo pipefail | |
| echo "主机当前目录:$(pwd)" | |
| ls -la # 确认 PKGBUILD 在主机存在 | |
| docker pull archlinux:base-devel | |
| docker run --rm \ | |
| -v "$(pwd)":/build \ | |
| -w /build \ | |
| archlinux:base-devel \ | |
| bash -c ' | |
| echo "容器内 /build 目录内容:" | |
| ls -la /build # 确认挂载成功 | |
| pacman -Syu --noconfirm && | |
| pacman -S --noconfirm git base-devel fakeroot sudo && | |
| useradd -m -s /bin/bash builduser && | |
| echo "builduser ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/builduser && | |
| chown -R builduser:builduser /build && | |
| su - builduser -c "cd /build && makepkg --printsrcinfo > .SRCINFO" | |
| ' | |
| if [ ! -f .SRCINFO ]; then | |
| echo "错误:.SRCINFO 未生成!检查权限或挂载" | |
| ls -la | |
| exit 1 | |
| fi | |
| echo "生成成功:" | |
| ls -l .SRCINFO | |
| head -n 20 .SRCINFO | |
| - name: Publish to AUR | |
| uses: KSXGitHub/github-actions-deploy-aur@v4.1.1 | |
| with: | |
| pkgname: 02engine-bin | |
| pkgbuild: ./PKGBUILD | |
| assets: | | |
| .SRCINFO | |
| commit_username: ${{ secrets.AUR_USERNAME }} | |
| commit_email: ${{ secrets.AUR_EMAIL }} | |
| ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }} | |
| commit_message: Update to ${{ github.event.client_payload.tag }} | |
| ssh_keyscan_types: rsa,ecdsa,ed25519 | |
| allow_empty_commits: false |