Packaging: release CI (both arch, sccache, AUR, Arch registry), PKGBUILD, MIT LICENSE
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GLUwWE2KmFPzhKaf67tWbx
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
4af8ef88b2
commit
784cc41ad4
@@ -0,0 +1,172 @@
|
||||
name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- arch: x86_64
|
||||
target: x86_64-unknown-linux-gnu
|
||||
runs-on: ubuntu-latest
|
||||
sccache_dir: /sccache
|
||||
- arch: aarch64
|
||||
target: aarch64-unknown-linux-gnu
|
||||
runs-on: aarch64
|
||||
sccache_dir: /var/lib/gitea-runner/sccache
|
||||
|
||||
runs-on: ${{ matrix.runs-on }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install Rust stable
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
targets: ${{ matrix.target }}
|
||||
|
||||
- name: Set up sccache
|
||||
run: |
|
||||
echo "RUSTC_WRAPPER=sccache" >> "$GITHUB_ENV"
|
||||
echo "SCCACHE_DIR=${{ matrix.sccache_dir }}" >> "$GITHUB_ENV"
|
||||
mkdir -p "${{ matrix.sccache_dir }}"
|
||||
if ! command -v sccache >/dev/null 2>&1; then
|
||||
V=0.8.2
|
||||
curl -sSL "https://github.com/mozilla/sccache/releases/download/v${V}/sccache-v${V}-x86_64-unknown-linux-musl.tar.gz" | tar -xz
|
||||
sudo install -m0755 "sccache-v${V}-x86_64-unknown-linux-musl/sccache" /usr/local/bin/sccache
|
||||
fi
|
||||
sccache --version
|
||||
|
||||
- name: Ensure build deps (libpipewire + clang for bindgen, C++ for ssstretch)
|
||||
run: |
|
||||
if command -v apt-get >/dev/null; then
|
||||
# Ephemeral container runner: safe to install into it.
|
||||
SUDO=""; command -v sudo >/dev/null && SUDO=sudo
|
||||
$SUDO apt-get update
|
||||
$SUDO apt-get install -y libpipewire-0.3-dev libspa-0.2-dev clang libclang-dev build-essential pkg-config
|
||||
else
|
||||
# Bare/host runner: never mutate it - require deps preinstalled.
|
||||
missing=""
|
||||
pkg-config --exists libpipewire-0.3 2>/dev/null || missing="$missing libpipewire(+dev headers)"
|
||||
command -v clang >/dev/null || missing="$missing clang"
|
||||
command -v c++ >/dev/null || command -v g++ >/dev/null || missing="$missing c++"
|
||||
if [ -n "$missing" ]; then
|
||||
echo "::error::bare runner missing build deps:$missing — install once on the host; CI does not modify bare runners"
|
||||
exit 1
|
||||
fi
|
||||
echo "bare runner already has libpipewire + clang + a C++ compiler"
|
||||
fi
|
||||
|
||||
- name: Test
|
||||
run: cargo test --release --locked --target ${{ matrix.target }}
|
||||
|
||||
- name: Build
|
||||
run: cargo build --release --locked --target ${{ matrix.target }}
|
||||
|
||||
- name: Package
|
||||
run: |
|
||||
TAG=${{ gitea.ref_name }}
|
||||
TARBALL="djdeck-${TAG}-${{ matrix.arch }}.tar.gz"
|
||||
mkdir pkg
|
||||
cp target/${{ matrix.target }}/release/djdeck pkg/
|
||||
cp LICENSE pkg/
|
||||
tar -czf "${TARBALL}" -C pkg .
|
||||
sha256sum "${TARBALL}" > "${TARBALL}.sha256"
|
||||
echo "TARBALL=${TARBALL}" >> $GITHUB_ENV
|
||||
|
||||
- name: Create release
|
||||
run: |
|
||||
curl -sX POST \
|
||||
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
||||
-H "Content-Type: application/json" \
|
||||
"${{ gitea.server_url }}/api/v1/repos/${{ gitea.repository }}/releases" \
|
||||
-d "{\"tag_name\":\"${{ gitea.ref_name }}\",\"name\":\"${{ gitea.ref_name }}\"}" \
|
||||
--fail-with-body || true
|
||||
|
||||
- name: Upload assets
|
||||
run: |
|
||||
RELEASE_ID=$(curl -s \
|
||||
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
||||
"${{ gitea.server_url }}/api/v1/repos/${{ gitea.repository }}/releases/tags/${{ gitea.ref_name }}" \
|
||||
| jq -r '.id')
|
||||
|
||||
for FILE in "${{ env.TARBALL }}" "${{ env.TARBALL }}.sha256"; do
|
||||
EXISTING=$(curl -s \
|
||||
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
||||
"${{ gitea.server_url }}/api/v1/repos/${{ gitea.repository }}/releases/${RELEASE_ID}/assets" \
|
||||
| jq -r ".[] | select(.name == \"${FILE}\") | .id")
|
||||
for AID in $EXISTING; do
|
||||
curl -sX DELETE \
|
||||
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
||||
"${{ gitea.server_url }}/api/v1/repos/${{ gitea.repository }}/releases/${RELEASE_ID}/assets/${AID}"
|
||||
done
|
||||
|
||||
curl -sX POST \
|
||||
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
||||
-H "Content-Type: application/octet-stream" \
|
||||
"${{ gitea.server_url }}/api/v1/repos/${{ gitea.repository }}/releases/${RELEASE_ID}/assets?name=${FILE}" \
|
||||
--data-binary "@${FILE}" --fail-with-body
|
||||
done
|
||||
|
||||
update-aur:
|
||||
needs: build
|
||||
runs-on: aarch64
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Compute checksums and update PKGBUILD
|
||||
run: |
|
||||
TAG=${{ gitea.ref_name }}
|
||||
BASE="${{ gitea.server_url }}/${{ gitea.repository }}/releases/download/${TAG}"
|
||||
SUM_X86=$(curl -sL "${BASE}/djdeck-${TAG}-x86_64.tar.gz" | sha256sum | cut -d' ' -f1)
|
||||
SUM_AARCH=$(curl -sL "${BASE}/djdeck-${TAG}-aarch64.tar.gz" | sha256sum | cut -d' ' -f1)
|
||||
sed -i "s/sha256sums_x86_64=('.*')/sha256sums_x86_64=('${SUM_X86}')/" aur/PKGBUILD
|
||||
sed -i "s/sha256sums_aarch64=('.*')/sha256sums_aarch64=('${SUM_AARCH}')/" aur/PKGBUILD
|
||||
|
||||
- name: Publish to the Arch package registry
|
||||
continue-on-error: true
|
||||
run: |
|
||||
set -euo pipefail
|
||||
if [ -z "${{ secrets.REGISTRY_TOKEN }}" ]; then
|
||||
echo "::warning::REGISTRY_TOKEN not set — skipping Arch registry publish"
|
||||
exit 0
|
||||
fi
|
||||
cd aur
|
||||
for carch in aarch64 x86_64; do
|
||||
pkgfile=$(CARCH="$carch" makepkg --packagelist | tail -1)
|
||||
CARCH="$carch" makepkg -f --nodeps --noconfirm --skipinteg
|
||||
curl --fail-with-body --user "bl:${{ secrets.REGISTRY_TOKEN }}" \
|
||||
--upload-file "$pkgfile" \
|
||||
"${{ gitea.server_url }}/api/packages/${{ gitea.repository_owner }}/arch/uhhm"
|
||||
done
|
||||
|
||||
- name: Push to AUR
|
||||
env:
|
||||
AUR_SSH_KEY: ${{ secrets.AUR_SSH_KEY }}
|
||||
run: |
|
||||
install -dm700 ~/.ssh
|
||||
echo "$AUR_SSH_KEY" > ~/.ssh/aur
|
||||
chmod 600 ~/.ssh/aur
|
||||
echo "Host aur.archlinux.org" >> ~/.ssh/config
|
||||
echo " IdentityFile ~/.ssh/aur" >> ~/.ssh/config
|
||||
echo " User aur" >> ~/.ssh/config
|
||||
ssh-keyscan aur.archlinux.org >> ~/.ssh/known_hosts 2>/dev/null
|
||||
|
||||
rm -rf /tmp/aur-djdeck
|
||||
git clone ssh://aur@aur.archlinux.org/djdeck.git /tmp/aur-djdeck
|
||||
cp aur/PKGBUILD /tmp/aur-djdeck/
|
||||
cd /tmp/aur-djdeck
|
||||
makepkg --printsrcinfo > .SRCINFO
|
||||
git config user.name "Bendik Aagaard Lynghaug"
|
||||
git config user.email "bendik.lynghaug@gmail.com"
|
||||
git add PKGBUILD .SRCINFO
|
||||
git commit -m "Update to ${{ gitea.ref_name }}"
|
||||
git push origin master
|
||||
@@ -2,6 +2,7 @@
|
||||
name = "djdeck"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
license = "MIT"
|
||||
|
||||
[[bin]]
|
||||
name = "djdeck"
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2026 Bendik Aagaard Lynghaug
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -0,0 +1,21 @@
|
||||
# Maintainer: Bendik Aagaard Lynghaug <bendik.lynghaug@gmail.com>
|
||||
pkgname=djdeck
|
||||
pkgver=0.1.0
|
||||
pkgrel=1
|
||||
pkgdesc="Terminal DJ deck: multi-deck player with beat-sync, pitch/tempo stretch and effects, low-latency to PipeWire"
|
||||
arch=('x86_64' 'aarch64')
|
||||
options=('!strip')
|
||||
url="https://project.uhhm.no/bl/djdeck"
|
||||
license=('MIT')
|
||||
depends=('libpipewire')
|
||||
provides=('djdeck')
|
||||
conflicts=('djdeck-git' 'djdeck-bin')
|
||||
source_x86_64=("djdeck-v${pkgver}-x86_64.tar.gz::https://project.uhhm.no/bl/djdeck/releases/download/v${pkgver}/djdeck-v${pkgver}-x86_64.tar.gz")
|
||||
source_aarch64=("djdeck-v${pkgver}-aarch64.tar.gz::https://project.uhhm.no/bl/djdeck/releases/download/v${pkgver}/djdeck-v${pkgver}-aarch64.tar.gz")
|
||||
sha256sums_x86_64=('SKIP')
|
||||
sha256sums_aarch64=('SKIP')
|
||||
|
||||
package() {
|
||||
install -Dm755 djdeck "$pkgdir/usr/bin/djdeck"
|
||||
install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
publish = false
|
||||
allow-branch = ["main"]
|
||||
|
||||
[[pre-release-replacements]]
|
||||
file = "aur/PKGBUILD"
|
||||
search = "pkgver=.*"
|
||||
replace = "pkgver={{version}}"
|
||||
|
||||
[[pre-release-replacements]]
|
||||
file = "aur/PKGBUILD"
|
||||
search = "pkgrel=.*"
|
||||
replace = "pkgrel=1"
|
||||
Reference in New Issue
Block a user