Files
OmaPhoto/.github/workflows/release.yml
T
雷电芽衣andClaude 2d219dd115 Packages carry their ONNX Runtime; a DEB per Ubuntu LTS
ONNX Runtime stamps its symbols with each release's version, so the
1.0.0 RPM demanded Fedora 42's exact runtime (issue #5) and the Arch
package would break on the next update. The RPM and the Arch package
now bundle Microsoft's 1.21.0 build, as the DEB does, and the images
test against it. The RPM builds on Fedora 43. A DEB built on Ubuntu
26.04 joins 24.04's, and ubuntu.sh picks by codename.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-09-26 14:22:16 -04:00

92 lines
3.7 KiB
YAML

# A version tag builds the four packages, each on its own system, and publishes them.
name: Release
on:
push:
tags: ['v*']
permissions:
contents: write
jobs:
version:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v7
# The tag must name the version each build file carries.
- run: |
v=${GITHUB_REF_NAME#v}
grep -qF "project(omaphoto VERSION $v " CMakeLists.txt || { echo "CMakeLists.txt is not $v"; exit 1; }
grep -qxF "pkgver=$v" packaging/arch/PKGBUILD || { echo "PKGBUILD is not $v"; exit 1; }
grep -qF "version = \"$v\";" flake.nix || { echo "flake.nix is not $v"; exit 1; }
deb:
needs: version
runs-on: ubuntu-24.04
# One DEB per Ubuntu LTS: each names its own libraries.
strategy:
matrix:
include:
- codename: noble
base: ubuntu:24.04
- codename: resolute
base: ubuntu:26.04
steps:
- uses: actions/checkout@v7
# The dev image carries ONNX Runtime, its notices and the model.
- run: docker build -t omaphoto-dev --build-arg BASE=${{ matrix.base }} -f Dockerfile.dev .
- run: |
docker run --rm -u "$(id -u):$(id -g)" -e HOME=/tmp -v "$PWD:/src" -w /src omaphoto-dev sh -c '
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr \
-DOMAPHOTO_BUNDLE_ORT=ON -DOMAPHOTO_MODEL=/usr/local/share/omaphoto/u2net.onnx &&
cmake --build build --target omaphoto && cd build && cpack -G DEB'
mv build/omaphoto_*.deb omaphoto-${{ matrix.codename }}_amd64.deb
- uses: actions/upload-artifact@v7
with:
name: deb-${{ matrix.codename }}
path: omaphoto-${{ matrix.codename }}_amd64.deb
rpm:
needs: version
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v7
- run: docker build -t omaphoto-fedora scripts/distro/fedora
- run: |
docker run --rm -u "$(id -u):$(id -g)" -e HOME=/tmp -v "$PWD:/src" -w /src omaphoto-fedora sh -c '
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr \
-DOMAPHOTO_BUNDLE_ORT=ON -DOMAPHOTO_MODEL=/usr/local/share/omaphoto/u2net.onnx &&
cmake --build build --target omaphoto && cd build && cpack -G RPM'
mv build/omaphoto-*.x86_64.rpm omaphoto.x86_64.rpm
- uses: actions/upload-artifact@v7
with:
name: rpm
path: omaphoto.x86_64.rpm
arch:
needs: version
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v7
- run: docker build -t omaphoto-arch scripts/distro/arch
# makepkg refuses root; a user of the runner's id builds.
- run: |
docker run --rm -v "$PWD:/src" omaphoto-arch sh -c "
useradd -u $(id -u) builder && chown -R builder /src &&
su builder -c 'cd /src/packaging/arch && makepkg -f'"
mv packaging/arch/omaphoto-[0-9]*-x86_64.pkg.tar.zst omaphoto-x86_64.pkg.tar.zst
- uses: actions/upload-artifact@v7
with:
name: arch
path: omaphoto-x86_64.pkg.tar.zst
publish:
needs: [deb, rpm, arch]
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v7
- uses: actions/download-artifact@v8
with:
merge-multiple: true
path: packages
- working-directory: packages
run: sha256sum omaphoto-noble_amd64.deb omaphoto-resolute_amd64.deb omaphoto.x86_64.rpm omaphoto-x86_64.pkg.tar.zst > SHA256SUMS
- env:
GH_TOKEN: ${{ github.token }}
run: |
gh release create "$GITHUB_REF_NAME" packages/* --title "OmaPhoto ${GITHUB_REF_NAME#v}" \
--notes "Install with the script for your system: see the README's Install section."