fix: build Arch packages without archlinux container
Some checks failed
Build and Publish APK Package / build-apk (amd64, x86_64) (push) Failing after 0s
Build and Publish APK Package / build-apk (arm64, aarch64) (push) Failing after 0s
Build and Publish Arch Package / build-arch (amd64, x86_64) (push) Failing after 39s
Build and Publish Arch Package / build-arch (arm64, aarch64) (push) Failing after 24s
Build and Push Docker Container / build-and-push (push) Successful in 1m49s

The Gitea runner is ARM64 and archlinux:latest has no ARM64 image.
Drop the container entirely and build .pkg.tar.zst manually:
cross-compile with Go and assemble the package archive directly,
so no makepkg or Arch Linux toolchain is needed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-02 04:15:52 +02:00
parent a1104f199f
commit f1f8cb5757

View File

@@ -8,9 +8,6 @@ jobs:
build-arch:
runs-on:
- ubuntu-24.04
container:
image: archlinux:latest
options: --platform linux/amd64
strategy:
matrix:
include:
@@ -20,42 +17,54 @@ jobs:
pkgarch: aarch64
steps:
- name: Install build dependencies
run: pacman -Syu --noconfirm git nodejs go base-devel curl
run: sudo apt-get update -qq && sudo apt-get install -y --no-install-recommends zstd curl
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: src/go.mod
- name: Checkout repository
uses: actions/checkout@v4
- name: Create build user
- name: Build binary
run: |
useradd -m build
echo "build ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
chown -R build:build .
cd src
GOARCH=${{ matrix.goarch }} GOOS=linux GOTOOLCHAIN=auto \
go build -ldflags="-s -w" -trimpath -o axolotl .
- name: Configure git safe directory
run: git config --global --add safe.directory "$PWD"
- name: Prepare source
- name: Create package
run: |
pkgver=$(echo "${{ github.ref_name }}" | sed 's/^v//')
pkgname="axolotl"
pkgrel=1
pkgarch="${{ matrix.pkgarch }}"
sed -i "s/pkgver=.*/pkgver=$pkgver/" packaging/arch/PKGBUILD
sed -i "s/^arch=.*/arch=('${{ matrix.pkgarch }}')/" packaging/arch/PKGBUILD
pkgdir=$(mktemp -d)/pkg
mkdir -p "$pkgdir/usr/bin"
install -Dm755 src/axolotl "$pkgdir/usr/bin/axolotl"
ln -s axolotl "$pkgdir/usr/bin/ax"
git archive --format=tar.gz --prefix="$pkgname-$pkgver/" -o "packaging/arch/$pkgname-$pkgver.tar.gz" HEAD
size=$(du -sb "$pkgdir/usr" | awk '{print $1}')
cat > "$pkgdir/.PKGINFO" <<EOF
pkgname = $pkgname
pkgver = $pkgver-$pkgrel
pkgdesc = CLI-native issue tracker using SQLite
url = https://g.eliaskohout.de/eliaskohout/axolotl
builddate = $(date +%s)
packager = Gitea Actions
size = $size
arch = $pkgarch
license = MIT
EOF
sha=$(sha512sum "packaging/arch/$pkgname-$pkgver.tar.gz" | awk '{print $1}')
sed -i "s|source=.*|source=(\"$pkgname-$pkgver.tar.gz\")|" packaging/arch/PKGBUILD
sed -i "s|sha512sums=.*|sha512sums=('$sha')|" packaging/arch/PKGBUILD
chown -R build:build .
- name: Build package
run: su build -c "cd $PWD/packaging/arch && GOARCH=${{ matrix.goarch }} CARCH=${{ matrix.pkgarch }} makepkg -s --noconfirm"
pkg_file="$PWD/${pkgname}-${pkgver}-${pkgrel}-${pkgarch}.pkg.tar.zst"
tar -C "$pkgdir" -c --zstd -f "$pkg_file" .
echo "PKG_FILE=$pkg_file" >> "$GITHUB_ENV"
- name: Publish to Gitea Registry
run: |
pkg_file=$(find $PWD/packaging/arch -name "*.pkg.tar.zst" -type f | head -1)
curl --fail-with-body \
--user "${{ github.repository_owner }}:${{ secrets.ACCESS_TOKEN }}" \
--upload-file "$pkg_file" \
--upload-file "$PKG_FILE" \
"${{ github.server_url }}/api/packages/${{ github.repository_owner }}/arch/push"