59 lines
2.2 KiB
YAML
59 lines
2.2 KiB
YAML
name: Arch package
|
|
|
|
# Builds the qtpotato package from a release tag and publishes it to this Gitea's Arch
|
|
# registry, so users can install it with pacman until it is on the AUR.
|
|
on:
|
|
push:
|
|
tags: ['v*']
|
|
workflow_dispatch:
|
|
inputs:
|
|
tag:
|
|
description: Release tag to package, e.g. v0.1.0
|
|
required: true
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
package:
|
|
# Arch Linux only ships x86_64 images, so pick an amd64 runner.
|
|
runs-on: amd64
|
|
container: archlinux:latest
|
|
env:
|
|
TAG: ${{ inputs.tag || github.ref_name }}
|
|
steps:
|
|
- name: Install dependencies
|
|
run: |
|
|
pacman -Syu --noconfirm --needed git nodejs base-devel cmake ninja extra-cmake-modules \
|
|
qt6-base qt6-declarative kirigami ki18n kcoreaddons kcrash kconfig \
|
|
mpvqt qcoro qtkeychain-qt6 ffmpeg hicolor-icon-theme
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
ref: ${{ inputs.tag || github.ref }}
|
|
- name: Build
|
|
run: |
|
|
version="${TAG#v}"
|
|
dir=/tmp/pkg
|
|
mkdir -p "$dir"
|
|
git config --global --add safe.directory "$PWD"
|
|
git archive --format=tar --prefix="qtpotato-$version/" HEAD | gzip -n > "$dir/qtpotato-$version.tar.gz"
|
|
sum="$(sha256sum "$dir/qtpotato-$version.tar.gz" | cut -d' ' -f1)"
|
|
sed -e "s/^pkgver=.*/pkgver=$version/" -e "s/^pkgrel=.*/pkgrel=1/" \
|
|
-e 's/^source=.*/source=("$pkgname-$pkgver.tar.gz")/' \
|
|
-e "s/^sha256sums=.*/sha256sums=('$sum')/" \
|
|
packaging/aur/qtpotato/PKGBUILD > "$dir/PKGBUILD"
|
|
# makepkg refuses to run as root.
|
|
useradd -m builder
|
|
chown -R builder "$dir"
|
|
su builder -c "cd $dir && makepkg --noconfirm"
|
|
- name: Publish
|
|
env:
|
|
# The package registry rejects the job token, so this is a personal access token
|
|
# with the write:package scope.
|
|
TOKEN: ${{ secrets.PACKAGE_TOKEN }}
|
|
run: |
|
|
for f in /tmp/pkg/qtpotato-[0-9]*.pkg.tar.zst; do
|
|
curl -fsS -X PUT -H "Authorization: token $TOKEN" --upload-file "$f" \
|
|
"$GITHUB_SERVER_URL/api/packages/${GITHUB_REPOSITORY%%/*}/arch/qtpotato"
|
|
done
|