feat: add Arch Linux package and CI workflow
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
52
.gitea/workflows/arch-publish.yml
Normal file
52
.gitea/workflows/arch-publish.yml
Normal file
@@ -0,0 +1,52 @@
|
||||
name: Build and Publish Arch Package
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
|
||||
jobs:
|
||||
build-arch:
|
||||
runs-on:
|
||||
- ubuntu-24.04
|
||||
container:
|
||||
image: archlinux:latest
|
||||
steps:
|
||||
- name: Install build dependencies
|
||||
run: pacman -Syu --noconfirm git nodejs go base-devel curl
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Create build user
|
||||
run: |
|
||||
useradd -m build
|
||||
echo "build ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
|
||||
chown -R build:build .
|
||||
|
||||
- name: Configure git safe directory
|
||||
run: git config --global --add safe.directory "$PWD"
|
||||
|
||||
- name: Prepare source
|
||||
run: |
|
||||
pkgver=$(echo "${{ github.ref_name }}" | sed 's/^v//')
|
||||
pkgname="axolotl"
|
||||
|
||||
sed -i "s/pkgver=.*/pkgver=$pkgver/" packaging/arch/PKGBUILD
|
||||
|
||||
git archive --format=tar.gz --prefix="$pkgname-$pkgver/" -o "packaging/arch/$pkgname-$pkgver.tar.gz" HEAD
|
||||
|
||||
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 && makepkg -s --noconfirm"
|
||||
|
||||
- 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" \
|
||||
"${{ github.server_url }}/api/packages/${{ github.repository_owner }}/arch/push"
|
||||
23
packaging/arch/PKGBUILD
Normal file
23
packaging/arch/PKGBUILD
Normal file
@@ -0,0 +1,23 @@
|
||||
# Maintainer: Elias Kohout <elias@kohout.de>
|
||||
pkgname=axolotl
|
||||
pkgver=0.1.0
|
||||
pkgrel=1
|
||||
pkgdesc="CLI-native issue tracker using SQLite"
|
||||
arch=('x86_64' 'aarch64')
|
||||
url="https://g.eliaskohout.de/eliaskohout/axolotl"
|
||||
license=('MIT')
|
||||
makedepends=('go')
|
||||
source=("$pkgname-$pkgver.tar.gz::https://g.eliaskohout.de/eliaskohout/axolotl/archive/v$pkgver.tar.gz")
|
||||
sha512sums=('SKIP')
|
||||
|
||||
export GOTOOLCHAIN=auto
|
||||
|
||||
build() {
|
||||
cd "$srcdir/$pkgname-$pkgver/src"
|
||||
go build -ldflags="-s -w" -trimpath -o "$pkgname" .
|
||||
}
|
||||
|
||||
package() {
|
||||
install -Dm755 "$srcdir/$pkgname-$pkgver/src/$pkgname" "$pkgdir/usr/bin/$pkgname"
|
||||
ln -s "$pkgname" "$pkgdir/usr/bin/ax"
|
||||
}
|
||||
Reference in New Issue
Block a user