summaryrefslogtreecommitdiff
path: root/.forgejo
diff options
context:
space:
mode:
authorJeroen Wijenbergh <jeroen.wijenbergh@geant.org>2026-02-20 14:28:35 +0100
committerJeroen Wijenbergh <jeroen.wijenbergh@geant.org>2026-02-20 15:12:23 +0100
commitc7c2d68c07c3b0ee854a733d6c5b17ebd68a44f8 (patch)
tree1e9ae3bddac05757546027fa7bec51a1b030e04c /.forgejo
parent084508bd51559c9909881682fd49fa4bb5e0e004 (diff)
RPM: Initial upstream packaging
Diffstat (limited to '.forgejo')
-rw-r--r--.forgejo/workflows/rpm.yml63
1 files changed, 63 insertions, 0 deletions
diff --git a/.forgejo/workflows/rpm.yml b/.forgejo/workflows/rpm.yml
new file mode 100644
index 0000000..7ad28a0
--- /dev/null
+++ b/.forgejo/workflows/rpm.yml
@@ -0,0 +1,63 @@
+name: Build RPM Packages
+
+on:
+ push:
+ branches:
+ - '**'
+ release:
+ types: [published]
+
+jobs:
+ build-rpm:
+ name: RPM build for ${{ matrix.image }}
+ runs-on: codeberg-small-lazy
+ container:
+ image: codeberg.org/jwijenbergh/rpmbuilder-${{ matrix.image }}-${{ matrix.arch }}
+
+ strategy:
+ matrix:
+ image:
+ - "fedora:42"
+ - "fedora:43"
+ arch:
+ - "amd64"
+
+ env:
+ RPMBUILD_ROOT: /home/ci-user/rpmbuild
+ RPMBUILD_PROJECT_NAME: python3-eduvpn-common
+ RPMBUILD_SPEC_FILE: python3-eduvpn-common.spec
+
+ steps:
+ - name: Checkout Repository
+ run: git clone --depth 1 -b ${{ github.ref_name }} ${{ github.server_url }}/${{ github.repository }} .
+
+ - name: Prepare RPM
+ run: |
+ rpmdev-setuptree
+ mkdir -p "${RPMBUILD_ROOT}/SOURCES" "${RPMBUILD_ROOT}/SPECS"
+
+ VERSION=$(grep -o 'const Version = "[^"]*' internal/commonver/commonver.go | cut -d '"' -f 2)
+
+ mkdir -p release
+ git archive --prefix "${RPMBUILD_PROJECT_NAME}-${VERSION}/" HEAD | tar -xf -
+ tar -cJf "${RPMBUILD_ROOT}/SOURCES/${RPMBUILD_PROJECT_NAME}-${VERSION}.tar.xz" "${RPMBUILD_PROJECT_NAME}-${VERSION}"
+
+ cp -r "rpm/SPECS/${RPMBUILD_SPEC_FILE}" "${RPMBUILD_ROOT}/SPECS/"
+
+ - name: Install RPM dependencies
+ run: sudo dnf builddep -y "${RPMBUILD_ROOT}/SPECS/${RPMBUILD_SPEC_FILE}"
+
+ - name: Build RPM
+ run: rpmbuild -ba "${RPMBUILD_ROOT}/SPECS/${RPMBUILD_SPEC_FILE}"
+
+ - name: Upload RPM
+ if: github.event_name == 'release' && secrets.PACKAGE_TOKEN != ''
+ run: |
+ OWNER="${{ github.repository_owner }}"
+ FEDORA_RELEASE="$(echo '${{ matrix.image }}' | cut -d ':' -f2)"
+ for RPM in $(find ${RPMBUILD_ROOT}/RPMS/ -type f -name "*.rpm"); do
+ echo "uploading RPM: ${RPM}"
+ curl --user "${OWNER}:${{ secrets.PACKAGE_TOKEN }}" \
+ --upload-file "${RPM}" \
+ "${{ github.server_url }}/api/packages/${OWNER}/rpm/fedora-${FEDORA_RELEASE}/upload?sign=true"
+ done