ci: publish an Arch package to the Gitea registry so pacman users can install while the AUR is closed (#19)
CI / build (push) Successful in 4m45s
CI / build (push) Successful in 4m45s
Co-authored-by: Tri Vo Khac <git@trivk.dev>
This commit was merged in pull request #19.
This commit is contained in:
1 parent
35cc4eb39b
commit
c449402b04
2 files changed
+93
No files matched your search
@@ -0,0 +1,57 @@
|
||||
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
|
||||
packages: write
|
||||
|
||||
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:
|
||||
TOKEN: ${{ secrets.GITHUB_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
|
||||
Reference in new issue
Block a user