2626 runs-on : ubuntu-latest
2727 container :
2828 image : rockylinux:8
29- if : ${{ !contains(github.event.head_commit.message, '[no-build]') }}
29+ if : ${{ github.event_name != 'push' || !contains(github.event.head_commit.message, '[no-build]') }}
3030
3131 steps :
3232 - uses : actions/checkout@v4
3535 run : |
3636 dnf -y install rpm-build make gcc autoconf automake \
3737 glibc-devel libcap-devel python3 \
38- curl tar bzip2 patch findutils
38+ curl tar bzip2 patch findutils \
39+ openssh-clients gnupg2
3940 ln -sf /usr/bin/python3 /usr/bin/python || true
4041 ln -snf /usr/share/zoneinfo/$TZ /etc/localtime || true
4142
4445 shell : bash
4546 run : |
4647 rel="${{ github.event.release.tag_name }}"
47-
48- # Spec is source of truth for upstream version
48+
4949 SPEC_VER="$(rpmspec -q --qf '%{VERSION}\n' SPECS/jailkit.spec | head -n1)"
50-
50+
5151 # Accept: 2.23, v2.23, 2.23-4, v2.23-4
5252 if [[ "$rel" =~ ^v?([0-9]+(\.[0-9]+)+)(-([0-9]+))?$ ]]; then
5353 TAG_VER="${BASH_REMATCH[1]}"
@@ -57,16 +57,16 @@ jobs:
5757 echo "Bad release tag '$rel' (expected like ${SPEC_VER} or ${SPEC_VER}-2)" >&2
5858 exit 1
5959 fi
60-
60+
6161 if [ "$TAG_VER" != "$SPEC_VER" ]; then
6262 echo "Tag version '$TAG_VER' does not match spec version '$SPEC_VER'" >&2
6363 exit 1
6464 fi
65-
65+
6666 echo "UPSTREAM_VER=$SPEC_VER" >> "$GITHUB_ENV"
6767 echo "PKG_RELEASE=$PKGREL" >> "$GITHUB_ENV"
6868 echo "BUILD_NUMBER=" >> "$GITHUB_ENV"
69-
69+
7070 grep -E '^(UPSTREAM_VER|PKG_RELEASE|BUILD_NUMBER)=' "$GITHUB_ENV" || true
7171
7272 - name : Compute build number (non-release only)
@@ -109,19 +109,42 @@ jobs:
109109
110110 rpmbuild "${args[@]}" -ba rpmbuild/SPECS/jailkit.spec
111111
112- - uses : actions/upload-artifact@v4
113- with :
114- name : jailkit-rpm-x86_64
115- path : |
116- rpmbuild/RPMS/**/*.rpm
117- rpmbuild/SRPMS/*.src.rpm
112+ - name : Fetch bootstrap
113+ if : ${{ github.event_name != 'pull_request' }}
114+ run : curl -fsSLO ${{ env.BUILD_BOOTSTRAP }}
115+
116+ - name : Upload binaries (no artifacts)
117+ if : ${{ github.event_name != 'pull_request' }}
118+ env :
119+ CLOUD__IP_ADDR : ${{ secrets.DEV_IP_ADDR }}
120+ CLOUD__IP_KNOWN_HOSTS : ${{ secrets.DEV_IP_KNOWN_HOSTS }}
121+ CLOUD__UPLOAD_SSH_USER : ${{ secrets.DEV_UPLOAD_SSH_USER }}
122+ CLOUD__UPLOAD_SSH_DIR : ${{ env.IS_RELEASE == 'true' && secrets.PRERELEASE_UPLOAD_SSH_DIR || secrets.DEV_UPLOAD_SSH_DIR }}
123+ CLOUD__SSH_PRV_KEY : ${{ secrets.DEV_SSH_PRV_KEY }}
124+ CLOUD__GH_TOKEN : ${{ github.token }}
125+ shell : bash
126+ run : |
127+ source bootstrap.bash \
128+ $([[ "${{ env.IS_RELEASE }}" == "true" ]] && echo "--release" || echo "--testing") \
129+ $([[ "${{ env.IS_PRERELEASE }}" == "true" ]] && echo "--prerelease")
130+
131+ mkdir -p "$ROOT_REPOS"
132+
133+ find rpmbuild/RPMS -type f -name 'jailkit-*.rpm' \
134+ ! -name '*.src.rpm' \
135+ ! -name '*debuginfo*' \
136+ ! -name '*debugsource*' \
137+ -exec cp -v {} "$ROOT_REPOS/" \;
138+
139+ upload_list=("$ROOT_REPOS/"*)
140+ cloud_upload upload_list
118141
119142 build-aarch64 :
120143 name : Build (aarch64)
121144 runs-on : ubuntu-24.04-arm
122145 container :
123146 image : rockylinux:8
124- if : ${{ !contains(github.event.head_commit.message, '[no-build]') }}
147+ if : ${{ github.event_name != 'push' || !contains(github.event.head_commit.message, '[no-build]') }}
125148
126149 steps :
127150 - uses : actions/checkout@v4
@@ -130,7 +153,8 @@ jobs:
130153 run : |
131154 dnf -y install rpm-build make gcc autoconf automake \
132155 glibc-devel libcap-devel python3 \
133- curl tar bzip2 patch findutils
156+ curl tar bzip2 patch findutils \
157+ openssh-clients gnupg2
134158 ln -sf /usr/bin/python3 /usr/bin/python || true
135159 ln -snf /usr/share/zoneinfo/$TZ /etc/localtime || true
136160
@@ -139,10 +163,9 @@ jobs:
139163 shell : bash
140164 run : |
141165 rel="${{ github.event.release.tag_name }}"
142-
143- # Spec is source of truth for upstream version
166+
144167 SPEC_VER="$(rpmspec -q --qf '%{VERSION}\n' SPECS/jailkit.spec | head -n1)"
145-
168+
146169 # Accept: 2.23, v2.23, 2.23-4, v2.23-4
147170 if [[ "$rel" =~ ^v?([0-9]+(\.[0-9]+)+)(-([0-9]+))?$ ]]; then
148171 TAG_VER="${BASH_REMATCH[1]}"
@@ -152,16 +175,16 @@ jobs:
152175 echo "Bad release tag '$rel' (expected like ${SPEC_VER} or ${SPEC_VER}-2)" >&2
153176 exit 1
154177 fi
155-
178+
156179 if [ "$TAG_VER" != "$SPEC_VER" ]; then
157180 echo "Tag version '$TAG_VER' does not match spec version '$SPEC_VER'" >&2
158181 exit 1
159182 fi
160-
183+
161184 echo "UPSTREAM_VER=$SPEC_VER" >> "$GITHUB_ENV"
162185 echo "PKG_RELEASE=$PKGREL" >> "$GITHUB_ENV"
163186 echo "BUILD_NUMBER=" >> "$GITHUB_ENV"
164-
187+
165188 grep -E '^(UPSTREAM_VER|PKG_RELEASE|BUILD_NUMBER)=' "$GITHUB_ENV" || true
166189
167190 - name : Compute build number (non-release only)
@@ -204,38 +227,41 @@ jobs:
204227
205228 rpmbuild "${args[@]}" -ba rpmbuild/SPECS/jailkit.spec
206229
207- - uses : actions/upload-artifact@v4
208- with :
209- name : jailkit-rpm-aarch64
210- path : |
211- rpmbuild/RPMS/**/*.rpm
212- rpmbuild/SRPMS/*.src.rpm
230+ - name : Fetch bootstrap
231+ if : ${{ github.event_name != 'pull_request' }}
232+ run : curl -fsSLO ${{ env.BUILD_BOOTSTRAP }}
213233
214- collect :
215- name : Collect
216- needs : [build-x86_64, build-aarch64]
217- runs-on : ubuntu-latest
218- if : ${{ !contains(github.event.head_commit.message, '[no-build]') }}
234+ - name : Upload binaries (no artifacts)
235+ if : ${{ github.event_name != 'pull_request' }}
236+ env :
237+ CLOUD__IP_ADDR : ${{ secrets.DEV_IP_ADDR }}
238+ CLOUD__IP_KNOWN_HOSTS : ${{ secrets.DEV_IP_KNOWN_HOSTS }}
239+ CLOUD__UPLOAD_SSH_USER : ${{ secrets.DEV_UPLOAD_SSH_USER }}
240+ CLOUD__UPLOAD_SSH_DIR : ${{ env.IS_RELEASE == 'true' && secrets.PRERELEASE_UPLOAD_SSH_DIR || secrets.DEV_UPLOAD_SSH_DIR }}
241+ CLOUD__SSH_PRV_KEY : ${{ secrets.DEV_SSH_PRV_KEY }}
242+ CLOUD__GH_TOKEN : ${{ github.token }}
243+ shell : bash
244+ run : |
245+ source bootstrap.bash \
246+ $([[ "${{ env.IS_RELEASE }}" == "true" ]] && echo "--release" || echo "--testing") \
247+ $([[ "${{ env.IS_PRERELEASE }}" == "true" ]] && echo "--prerelease")
219248
220- steps :
221- - uses : actions/download-artifact@v4
222- with :
223- path : packages
224- merge-multiple : true
225-
226- - run : find packages -type f -name "jailkit-[0-9]*.*.rpm" | sort
227-
228- - uses : actions/upload-artifact@v4
229- with :
230- name : jailkit-packages
231- path : packages
232- retention-days : 30
233-
234- publish :
235- name : Publish using Webmin CI/CD
236- needs : [collect]
249+ mkdir -p "$ROOT_REPOS"
250+
251+ find rpmbuild/RPMS -type f -name 'jailkit-*.rpm' \
252+ ! -name '*.src.rpm' \
253+ ! -name '*debuginfo*' \
254+ ! -name '*debugsource*' \
255+ -exec cp -v {} "$ROOT_REPOS/" \;
256+
257+ upload_list=("$ROOT_REPOS/"*)
258+ cloud_upload upload_list
259+
260+ finalize :
261+ name : Sign + rebuild repos
262+ needs : [build-x86_64, build-aarch64]
237263 runs-on : ubuntu-latest
238- if : ${{ github.event_name != 'pull_request' && ! contains(github.event.head_commit.message, '[no-build]') }}
264+ if : ${{ github.event_name != 'pull_request' && (github.event_name != 'push' || ! contains(github.event.head_commit.message, '[no-build]') ) }}
239265
240266 steps :
241267 - name : Install deps
@@ -244,16 +270,10 @@ jobs:
244270 sudo apt-get install -y ${{ env.BUILD_DEPS }}
245271 sudo timedatectl set-timezone ${{ env.TZ }}
246272
247- - name : Download packages
248- uses : actions/download-artifact@v4
249- with :
250- name : jailkit-packages
251- path : packages
252-
253273 - name : Fetch bootstrap
254274 run : curl -fsSLO ${{ env.BUILD_BOOTSTRAP }}
255275
256- - name : Upload only main packages + sign + rebuild repos
276+ - name : Sign + rebuild repos
257277 env :
258278 CLOUD__IP_ADDR : ${{ secrets.DEV_IP_ADDR }}
259279 CLOUD__IP_KNOWN_HOSTS : ${{ secrets.DEV_IP_KNOWN_HOSTS }}
@@ -267,14 +287,4 @@ jobs:
267287 $([[ "${{ env.IS_RELEASE }}" == "true" ]] && echo "--release" || echo "--testing") \
268288 $([[ "${{ env.IS_PRERELEASE }}" == "true" ]] && echo "--prerelease")
269289
270- mkdir -p "$ROOT_REPOS"
271-
272- find packages -type f -name 'jailkit-[0-9]*.x86_64.rpm' -exec cp -v {} "$ROOT_REPOS/" \;
273- find packages -type f -name 'jailkit-[0-9]*.*.x86_64.rpm' -exec cp -v {} "$ROOT_REPOS/" \;
274-
275- find packages -type f -name 'jailkit-[0-9]*.aarch64.rpm' -exec cp -v {} "$ROOT_REPOS/" \;
276- find packages -type f -name 'jailkit-[0-9]*.*.aarch64.rpm' -exec cp -v {} "$ROOT_REPOS/" \;
277-
278- upload_list=("$ROOT_REPOS/"*)
279- cloud_upload upload_list
280290 cloud_sign_and_build_repos_auto virtualmin.dev
0 commit comments