Files
SeeMD/.github/workflows/package.yml
T
2026-07-01 14:33:04 -04:00

139 lines
4.0 KiB
YAML

name: Package
permissions:
contents: write
on:
workflow_dispatch:
release:
types: [published, prereleased, released]
jobs:
deb:
# Pin to the oldest supported Ubuntu to avoid producing a .deb that
# accidentally depends on newer GLib/GTK symbols than users have.
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Install build dependencies
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
build-essential pkg-config \
libgtk-3-dev
- name: Build
run: make -j
- name: ABI check (GLib)
run: |
set -euo pipefail
if nm -D seemd | grep -q ' g_string_free_and_steal$'; then
echo "Error: seemd links against g_string_free_and_steal (too-new GLib ABI for jammy/mint 21.x)" >&2
exit 1
fi
- name: Build .deb
run: |
TAG="${{ github.event.release.tag_name || github.ref_name }}"
VERSION="${TAG#v}"
ARCH="$(dpkg --print-architecture)"
MAINTAINER="${GITHUB_REPOSITORY_OWNER} <noreply@github.com>"
PKGDIR="dist/deb/seemd_${VERSION}_${ARCH}"
rm -rf "$PKGDIR"
mkdir -p "$PKGDIR/DEBIAN"
sed \
-e "s/@VERSION@/${VERSION}/g" \
-e "s/@ARCH@/${ARCH}/g" \
-e "s/@MAINTAINER@/${MAINTAINER}/g" \
packaging/deb/control.in > "$PKGDIR/DEBIAN/control"
make install DESTDIR="$PKGDIR" PREFIX=/usr
dpkg-deb --build "$PKGDIR"
- uses: actions/upload-artifact@v4
with:
name: seemd-deb
path: dist/deb/*.deb
rpm:
runs-on: ubuntu-latest
container: fedora:40
steps:
- name: Install tooling
run: |
dnf -y install \
git make gcc rpm-build \
gtk3-devel pkgconf-pkg-config
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Mark workspace as safe for git
run: |
set -euo pipefail
repo="${GITHUB_REPOSITORY##*/}"
git config --global --add safe.directory "$GITHUB_WORKSPACE"
git config --global --add safe.directory "$(pwd)"
git config --global --add safe.directory "/__w/${repo}/${repo}"
- name: Build source tarball
run: |
TAG="${{ github.event.release.tag_name || github.ref_name }}"
VERSION="${TAG#v}"
mkdir -p dist
git archive --format=tar.gz --prefix="seemd-${VERSION}/" -o "dist/seemd-${VERSION}.tar.gz" HEAD
- name: Build .rpm
run: |
TAG="${{ github.event.release.tag_name || github.ref_name }}"
VERSION="${TAG#v}"
URL="https://github.com/${GITHUB_REPOSITORY}"
TOPDIR="$PWD/dist/rpmbuild"
mkdir -p "$TOPDIR"/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}
cp "dist/seemd-${VERSION}.tar.gz" "$TOPDIR/SOURCES/"
sed \
-e "s/@VERSION@/${VERSION}/g" \
-e "s|@URL@|${URL}|g" \
packaging/rpm/seemd.spec.in > "$TOPDIR/SPECS/seemd.spec"
rpmbuild \
--define "_topdir ${TOPDIR}" \
-bb "$TOPDIR/SPECS/seemd.spec"
mkdir -p dist/rpm
# Only publish the main runtime RPM (exclude -debuginfo/-debugsource).
find "$TOPDIR/RPMS" -type f -name 'seemd-[0-9]*.rpm' -exec cp -v -t dist/rpm {} +
- uses: actions/upload-artifact@v4
with:
name: seemd-rpm
path: dist/rpm/seemd-[0-9]*.rpm
release-assets:
runs-on: ubuntu-latest
needs: [deb, rpm]
if: github.event_name == 'release'
steps:
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
pattern: seemd-*
merge-multiple: true
path: dist
- name: Attach packages to GitHub Release
uses: softprops/action-gh-release@v2
with:
files: |
dist/*.deb
dist/seemd-[0-9]*.rpm