Skip to content

Commit 79c7984

Browse files
committed
ci(packaging): publish RPMs to Nexus directly from build job
Upload built RPMs to flagos-yum-hosted from within the build-rpm job on the same self-hosted runner, gated on v* tags. h20 reaches the internal Nexus but not codeload/api.github.com reliably, so avoid the cross-workflow artifact round-trip that the deb upload-nexus flow depends on.
1 parent 4c4a859 commit 79c7984

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

.github/workflows/build-rpm.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,33 @@ jobs:
3636
name: flagcx-${{ matrix.backend }}-rpm-packages
3737
path: rpm-packages/${{ matrix.backend }}/**/*.rpm
3838
retention-days: 7
39+
40+
# Publish straight from the locally-built artifacts on the same self-hosted
41+
# runner: h20 can reach the internal Nexus but not codeload/api.github.com
42+
# reliably, so we deliberately avoid any cross-workflow artifact round-trip.
43+
- name: Publish ${{ matrix.backend }} RPMs to Nexus YUM repository
44+
if: startsWith(github.ref, 'refs/tags/v')
45+
env:
46+
NEXUS_USERNAME: ${{ secrets.REGISTRY_USERNAME }}
47+
NEXUS_PASSWORD: ${{ secrets.CONTAINER_REGISTRY }}
48+
NEXUS_REPO_URL: https://resource.flagos.net/repository/flagos-yum-hosted
49+
BACKEND: ${{ matrix.backend }}
50+
run: |
51+
set -euo pipefail
52+
53+
uploaded=0
54+
while IFS= read -r -d '' rpm; do
55+
# rel keeps the RPMS/<arch>/<file> or SRPMS/<file> layout under the backend
56+
rel="${rpm#rpm-packages/${BACKEND}/}"
57+
echo "Uploading ${rpm} -> ${BACKEND}/${rel}"
58+
curl -f -u "${NEXUS_USERNAME}:${NEXUS_PASSWORD}" \
59+
--upload-file "$rpm" \
60+
"${NEXUS_REPO_URL}/${BACKEND}/${rel}"
61+
uploaded=$((uploaded + 1))
62+
done < <(find "rpm-packages/${BACKEND}" -name '*.rpm' -print0)
63+
64+
if [ "$uploaded" -eq 0 ]; then
65+
echo "No RPMs found for ${BACKEND}"
66+
exit 1
67+
fi
68+
echo "Uploaded ${uploaded} ${BACKEND} RPM(s) to Nexus YUM repository"

0 commit comments

Comments
 (0)