summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.forgejo/workflows/rpm.yml63
-rwxr-xr-xprepare_release.sh6
-rw-r--r--rpm/SPECS/python3-eduvpn-common.spec87
3 files changed, 156 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
diff --git a/prepare_release.sh b/prepare_release.sh
index ab219a3..53d3333 100755
--- a/prepare_release.sh
+++ b/prepare_release.sh
@@ -72,8 +72,14 @@ $(cat internal/discovery/organization_list.json.minisig)
"
fi
+# Update debian changelog
dch -v ${PROJECT_VERSION} --distribution unstable "New version"
+# Update fedora spec
+sed -i "s/^Version:.*/Version: ${PROJECT_VERSION}/" rpm/specs/python3-eduvpn-common.spec
+# We set the author and email the same as debian's
+sed -i "/^%changelog/a * $(LC_ALL=C date +'%a %b %d %Y') ${DEBFULL_NAME} <${DEBEMAIL}> - ${PROJECT_VERSION}-1\n- New version\n" rpm/specs/python3-eduvpn-common.spec
+
# Replace version number
# replace in internal/commonver
sed -i "s/const Version = \".*\"/const Version = \"${PROJECT_VERSION}\"/" internal/commonver/commonver.go
diff --git a/rpm/SPECS/python3-eduvpn-common.spec b/rpm/SPECS/python3-eduvpn-common.spec
new file mode 100644
index 0000000..8174864
--- /dev/null
+++ b/rpm/SPECS/python3-eduvpn-common.spec
@@ -0,0 +1,87 @@
+%global gomodulesmode GO111MODULE=on
+
+Name: python3-eduvpn-common
+Version: 4.0.0
+Release: 1%{?dist}
+Summary: Python3 eduvpn-common wrapper
+
+License: MIT
+URL: https://codeberg.org/eduVPN/eduvpn-common
+Source0: python3-eduvpn-common-%{version}.tar.xz
+
+BuildRequires: gcc
+BuildRequires: golang
+BuildRequires: minisign
+BuildRequires: python3-devel
+BuildRequires: python3-setuptools
+BuildRequires: python3-wheel
+BuildRequires: go-rpm-macros
+
+%description
+The python wrapper for the eduVPN common Go shared library
+
+%prep
+%setup -qn python3-eduvpn-common-%{version}
+
+%build
+# build the Go component
+export CGO_ENABLED=1
+%gobuild -o lib/libeduvpn_common-%{version}.so "-buildmode=c-shared" ./exports
+
+# build the Python component
+pushd wrappers/python
+%py3_build
+popd
+
+%install
+install -m 0755 -D -p lib/libeduvpn_common-%{version}.so %{buildroot}%{_libdir}/libeduvpn_common-%{version}.so
+
+pushd wrappers/python
+%py3_install
+popd
+
+%files
+%{_libdir}/*
+%{python3_sitelib}/eduvpn_common/
+%{python3_sitelib}/eduvpn_common-%{version}*
+
+%changelog
+* Thu Oct 09 2025 Jeroen Wijenbergh <jeroen.wijenbergh@geant.org> - 4.0.0-1
+- update to 4.0.0
+
+* Thu Apr 17 2025 jwijenbergh <jeroen.wijenbergh@geant.org> - 3.0.0-1
+- update to 3.0.0
+
+* Thu Oct 31 2024 jwijenbergh <jeroen.wijenbergh@geant.org> - 2.1.0-2
+- rebuilt
+
+* Tue Jul 30 2024 jwijenbergh <jeroen.wijenbergh@geant.org> - 2.1.0-1
+- update to 2.1.0
+
+* Tue Jun 25 2024 jwijenbergh <jeroen.wijenbergh@geant.org> - 2.0.2-1
+- update to 2.0.2
+
+* Thu Jun 06 2024 Jeroen Wijenbergh <jeroen.wijenbergh@geant.org> - 2.0.1-1
+- update to 2.0.1
+
+* Wed Jun 05 2024 Jeroen Wijenbergh <jeroen.wijenbergh@geant.org> - 2.0.0-1
+- update to 2.0.0
+
+* Fri May 24 2024 Jeroen Wijenbergh <jeroen.wijenbergh@geant.org> - 1.2.1-1
+- update to 1.2.1
+
+* Fri Dec 08 2023 Jeroen Wijenbergh <jeroen.wijenbergh@geant.org> - 1.2.0-1
+- update to 1.2.0
+
+* Fri Sep 01 2023 Jeroen Wijenbergh <jeroen.wijenbergh@geant.org> - 1.1.2-1
+- update to 1.1.2
+
+* Tue Aug 29 2023 Jeroen Wijenbergh <jeroen.wijenbergh@geant.org> - 1.1.1-1
+- update to 1.1.1
+
+* Tue Apr 18 2023 Jeroen Wijenbergh <jeroen.wijenbergh@geant.org> - 1.1.0-1
+- update to 1.1.0
+
+* Wed Mar 01 2023 Jeroen Wijenbergh <jeroen.wijenbergh@geant.org> - 1.0.0-1
+- initial package
+