Files
ax/.gitea/workflows/apk-publish.yml
Elias Kohout e6a2e01d9d
Some checks failed
Build and Publish APK Package / build-apk (push) Failing after 15s
Build and Push Docker Container / build-and-push (push) Successful in 1m48s
Fix apk-publish: add build-base dep, net option, and apk update
2026-04-02 02:58:34 +02:00

79 lines
2.5 KiB
YAML

name: Build and Publish APK Package
on:
push:
tags:
- 'v*'
jobs:
build-apk:
runs-on:
- ubuntu-24.04
container:
image: alpine:latest
steps:
- name: Install build dependencies
run: |
apk add --no-cache git go abuild make nodejs curl openssl sudo
- name: Create build user
run: |
adduser -D -G abuild build
echo "build ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
chown -R build:abuild .
- name: Checkout repository
uses: actions/checkout@v4
- name: Configure git safe directory
run: git config --global --add safe.directory "$PWD"
- name: Setup abuild for package signing
run: |
su build -c "mkdir -p ~/.abuild"
su build -c "openssl genrsa -out ~/.abuild/private_key.rsa 2048"
su build -c "openssl rsa -pubout -in ~/.abuild/private_key.rsa -out ~/.abuild/private_key.rsa.pub"
cp ~build/.abuild/private_key.rsa.pub /etc/apk/keys/
su build -c "abuild-keygen -a -n"
- name: Prepare source
run: |
pkgver=$(echo "${{ github.ref_name }}" | sed 's/^v//')
pkgname="axolotl"
cd packaging/alpine
sed -i "s/pkgver=.*/pkgver=$pkgver/" APKBUILD
cd ../..
git archive --format=tar.gz --prefix="$pkgname-$pkgver/" -o "packaging/alpine/$pkgname-$pkgver.tar.gz" HEAD
sed -i "s|source=.*|source=\"\$pkgname-\$pkgver.tar.gz\"|" packaging/alpine/APKBUILD
chown -R build:abuild .
- name: Update apk index
run: apk update
- name: Generate checksums
run: |
cd packaging/alpine
su build -c "abuild checksum"
- name: Build package
run: |
cd packaging/alpine
su build -c "abuild -r"
- name: Find built package
id: find_package
run: |
find ~build/packages -name "*.apk" -type f > packages.txt
echo "package_path=$(head -1 packages.txt)" >> $GITHUB_OUTPUT
- name: Publish to Gitea Registry
run: |
apk_file=$(find ~build/packages -name "*.apk" -type f | head -1)
branch=$(echo "${{ github.ref_name }}" | sed 's/^v//')
curl -X PUT \
-H "Authorization: token ${{ secrets.ACCESS_TOKEN }}" \
-T "$apk_file" \
"${{ github.api_url }}/packages/${{ github.repository_owner }}/apk/${{ github.repository }}/$branch"