11name : build-native-packages-signed
2+
23on :
34 push :
45 tags : ["v*"]
56 workflow_dispatch :
67permissions :
78 contents : write
89env :
9- GPG_KEY_ID : ${{ secrets.GPG_KEY_ID }}
10- GPG_PASSPHRASE : ${{ secrets.GPG_PASSPHRASE }}
11- GPG_PRIVATE_KEY_B64 : ${{ secrets.GPG_PRIVATE_KEY_B64 }}
10+ GPG_KEY_ID : ${{ secrets.ZMREPO_GPG_KEY_ID }}
11+ GPG_PASSPHRASE : ${{ secrets.ZMREPO_GPG_PASSPHRASE }}
12+ GPG_PRIVATE_KEY_B64 : ${{ secrets.ZMREPO_GPG_PRIVATE_KEY_B64 }}
13+
1214jobs :
1315 build-debian :
1416 name : Build & sign .deb (${{ matrix.distro }})
@@ -19,53 +21,65 @@ jobs:
1921 distro : ["debian:13", "debian:12", "ubuntu:22.04", "ubuntu:24.04"]
2022 container :
2123 image : ${{ matrix.distro }}
24+
2225 steps :
23- name : Prep apt
24- run :
26+ - name : Prep apt
27+ run : |
2528 set -eux
26- if grep -q '^deb http' /etc/apt/sources.list && ! grep -q '^deb-src' /etc/apt/sources.list; then
27- sed -n 's/^deb /deb-src /p' /etc/apt/sources.list >> /etc/apt/sources.list
29+ if grep -q '^deb http' /etc/apt/sources.list && ! grep -q '^deb-src'\
30+ /etc/apt/sources.list; then
31+ sed -n 's/^deb /deb-src /p' /etc/apt/sources.list >> \
32+ /etc/apt/sources.list
2833 fi
2934 apt-get update
30- name : Install build tools
31- run :
35+ - name : Install build tools
36+ run : |
3237 set -eux
33- apt-get install -y --no-install-recommends \
38+ apt install -y --no-install-recommends \
3439 git ca-certificates gnupg lsb-release tzdata \
3540 build-essential devscripts debhelper equivs fakeroot \
3641 cmake pkg-config ccache
37- name : Checkout
38- uses : actions/checkout@v4
42+ apt install -y debhelper sphinx-doc dh-linktree dh-apache2 cmake \
43+ libavcodec-dev libavdevice-dev libavformat-dev libavutil-dev \
44+ libswresample-dev libswscale-dev libbz2-dev \
45+ libturbojpeg0-dev default-libmysqlclient-dev \
46+ libpolkit-gobject-1-dev libv4l-dev libvlc-dev libssl-dev \
47+ libvncserver-dev libjwt-gnutls-dev libgsoap-dev gsoap \
48+ libmosquittopp-dev
49+
50+ - name : Checkout
51+ uses : actions/checkout@v5
3952 with :
4053 fetch-depth : 0
41- name : Import GPG key (Debian)
42- run :
54+ - name : Import GPG key (Debian)
55+ run : |
4356 set -eux
4457 mkdir -p ~/.gnupg
4558 chmod 700 ~/.gnupg
4659 echo "pinentry-mode loopback" >> ~/.gnupg/gpg.conf
4760 echo "$GPG_PRIVATE_KEY_B64" | base64 -d > /tmp/priv.asc
4861 gpg --batch --import /tmp/priv.asc
4962 gpg --batch --yes --edit-key "$GPG_KEY_ID" trust quit <<< "5\ny"
50- gpg --batch --armor --export "$GPG_KEY_ID" > public.asc
63+ gpg --batch --armor --export "$GPG_KEY_ID" --output public.asc
5164 chmod 600 ~/.gnupg/*
5265 export GPG_TTY=$(tty || true)
53- name : Install build-deps from debian/control
54- run :
66+ - name : Install build-deps from debian/control
67+ run : |
5568 set -eux
56- mk-build-deps -ir -t "apt-get -y --no-install-recommends" debian/control
57- name : Build (signed)
69+ mk-build-deps -ir -t "apt-get -y --no-install-recommends" \
70+ debian/control
71+ - name : Build (signed)
5872 env :
5973 DEB_BUILD_OPTIONS : " parallel=$(nproc)"
6074 # gpg picks passphrase from environment via loopback
61- run :
75+ run : |
6276 set -eux
6377 # Tell gpg to use loopback + passphrase
6478 export GPG_TTY=$(tty || true)
6579 export DEB_SIGN_KEYID="$GPG_KEY_ID"
6680 dpkg-buildpackage -k"$DEB_SIGN_KEYID" -b
67- name : Collect .deb artifacts (incl. signed metadata & public key)
68- run :
81+ - name : Collect .deb artifacts (incl. signed metadata & public key)
82+ run : |
6983 set -eux
7084 mkdir -p artifacts/deb
7185 shopt -s nullglob
@@ -74,96 +88,32 @@ name: Collect .deb artifacts (incl. signed metadata & public key)
7488 # quick verify signatures (non-fatal)
7589 gpg --verify artifacts/deb/*.changes || true
7690 gpg --verify artifacts/deb/*.buildinfo || true
77- name : Upload .deb artifacts
91+ - name : Upload .deb artifacts
7892 uses : actions/upload-artifact@v4
7993 with :
8094 name : debian-${{ matrix.distro }}
8195 path : artifacts/deb
82- build-rpm :
83- name : Build & sign .rpm (${{ matrix.distro }})
84- runs-on : ubuntu-latest
85- strategy :
86- fail-fast : false
87- matrix :
88- distro : ["rockylinux:9", "fedora:40"]
89- container :
90- image : ${{ matrix.distro }}
91- steps :
92- name : Install build tools
93- run :
94- set -eux
95- if command -v dnf >/dev/null; then PM=dnf; else PM=yum; fi
96- $PM -y install git rpm-build make gcc gcc-c++ cmake pkgconfig ccache which \
97- redhat-rpm-config gnupg2 rpm-sign
98- name : Checkout
99- uses : actions/checkout@v4
100- with :
101- fetch-depth : 0
102- name : Import GPG key (RPM)
103- run :
104- set -eux
105- mkdir -p ~/.gnupg
106- chmod 700 ~/.gnupg
107- echo "pinentry-mode loopback" >> ~/.gnupg/gpg.conf
108- echo "$GPG_PRIVATE_KEY_B64" | base64 -d > /tmp/priv.asc
109- gpg --batch --import /tmp/priv.asc
110- gpg --batch --yes --edit-key "$GPG_KEY_ID" trust quit <<< "5\ny"
111- gpg --batch --armor --export "$GPG_KEY_ID" > public.asc
112- printf '%%_signature gpg\n' >> ~/.rpmmacros
113- printf '%%_gpg_name %s\n' "$GPG_KEY_ID" >> ~/.rpmmacros
114- # custom sign cmd with loopback pinentry; rpmsign passes files via macros
115- cat >> ~/.rpmmacros <<'EOF'
116- %__gpg /usr/bin/gpg
117- %__gpg_sign_cmd %{__gpg} gpg --batch --no-verbose --no-armor --pinentry-mode loopback --passphrase %{?__gpg_passphrase} -u "%{_gpg_name}" -sbo %{__signature_filename} %{__plaintext_filename}
118- EOF
119- name : Prepare rpmbuild tree & source
120- run :
121- set -eux
122- mkdir -p rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}
123- VERSION="${GITHUB_REF_NAME:-dev}"
124- git archive --format=tar --prefix=zoneminder-${VERSION}/ HEAD | gzip -9 > rpmbuild/SOURCES/zoneminder-${VERSION}.tar.gz
125- cp packaging/zoneminder.spec rpmbuild/SPECS/zoneminder.spec
126- name : Install BuildRequires
127- run :
128- set -eux
129- if command -v dnf >/dev/null; then PM=dnf; else PM=yum; fi
130- $PM -y builddep rpmbuild/SPECS/zoneminder.spec || true
131- name : Build RPMs
132- run :
133- set -eux
134- rpmbuild -ba rpmbuild/SPECS/zoneminder.spec \
135- --define "_topdir $(pwd)/rpmbuild" \
136- --define "version ${GITHUB_REF_NAME:-dev}"
137- name : Sign RPMs
96+ - name : Publish to ZMREPO
97+ uses : easingthemes/ssh-deploy@main
13898 env :
139- __gpg_passphrase : ${{ secrets.GPG_PASSPHRASE }}
140- run :
141- set -eux
142- find rpmbuild/RPMS -name "*.rpm" -print0 | xargs -0 -n1 -I{} rpmsign --addsign {}
143- # quick verify (non-fatal if gpg keyring missing pub)
144- rpm -Kv rpmbuild/RPMS/*/*.rpm || true
145- name : Collect .rpm artifacts (incl. public key)
146- run :
147- set -eux
148- mkdir -p artifacts/rpm
149- find rpmbuild/RPMS -name "*.rpm" -exec cp -v {} artifacts/rpm/ \;
150- cp -v public.asc artifacts/rpm/
151- name : Upload .rpm artifacts
152- uses : actions/upload-artifact@v4
153- with :
154- name : rpm-${{ matrix.distro }}
155- path : artifacts/rpm
99+ SSH_PRIVATE_KEY : ${{ secrets.ZMREPO_SSH_KEY }}
100+ ARGS : " -rltgoDzvO"
101+ SOURCE : artifacts/deb/
102+ REMOTE_HOST : ${{ secrets.ZMREPO_HOST }}
103+ REMOTE_USER : ${{ secrets.ZMREPO_SSH_USER }}
104+ TARGET : debian/master/mini-dinstall/incoming/
105+
156106 release :
157107 name : Create GitHub Release (on tag)
158- needs : [ build-debian, build-rpm]
108+ needs : build-debian
159109 if : startsWith(github.ref, 'refs/tags/')
160110 runs-on : ubuntu-latest
161111 steps :
162- name : Download artifacts
163- uses : actions/download-artifact@v4
112+ - name : Download artifacts
113+ uses : actions/download-artifact@v5
164114 with :
165115 path : dist
166- name : Create release
116+ - name : Create release
167117 uses : softprops/action-gh-release@v2
168118 with :
169119 files : dist/**/*
0 commit comments