96 lines
4.0 KiB
YAML
96 lines
4.0 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
|
|
# One RPM per Fedora release: each names its own LibRaw.
|
|
strategy:
|
|
matrix:
|
|
release: [43, 44]
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
- run: docker build -t omaphoto-fedora --build-arg RELEASE=${{ matrix.release }} 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-fc${{ matrix.release }}.x86_64.rpm
|
|
- uses: actions/upload-artifact@v7
|
|
with:
|
|
name: rpm-fc${{ matrix.release }}
|
|
path: omaphoto-fc${{ matrix.release }}.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-fc43.x86_64.rpm omaphoto-fc44.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."
|