diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index 2e733a741..f71d86626 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -403,3 +403,45 @@ jobs: allowUpdates: true updateOnlyUnreleased: true artifacts: "${{ env.PACKAGE_DIR }}.tar.gz" + + build-deb: + runs-on: ubuntu-latest + container: seladb/ubuntu2404 + permissions: + contents: write + attestations: write + id-token: write + env: + BUILD_DIR: Dist + steps: + - name: Checkout code + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + + - name: Set package version + shell: bash + run: | + RAW_VERSION="${{ github.event.release.tag_name }}" + if [ -z "$RAW_VERSION" ]; then RAW_VERSION="${GITHUB_REF_NAME:-0.0.0-dev}"; fi + VERSION="${RAW_VERSION//\//-}" + echo "VERSION=$VERSION" >> $GITHUB_ENV + + - name: Configure and build with CMake + run: | + mkdir -p "${{ env.BUILD_DIR }}" + cd "${{ env.BUILD_DIR }}" + cmake -DPCAPPP_PACKAGE=ON -DPCAPPP_INSTALL=ON -DPROJECT_VERSION=${{ env.VERSION }} .. + make -j$(nproc) + + - name: Package with CPack (DEB) + run: | + cd "${{ env.BUILD_DIR }}" + cpack -G DEB + + - name: Upload DEB to release + if: github.ref_type == 'tag' + uses: ncipollo/release-action@440c8c1cb0ed28b9f43e4d1d670870f059653174 # v1.16.0 + with: + draft: true + allowUpdates: true + updateOnlyUnreleased: true + artifacts: "${{ env.BUILD_DIR }}/*.deb" diff --git a/CMakeLists.txt b/CMakeLists.txt index c59fc5615..c100a10e4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -435,7 +435,7 @@ if(PCAPPP_PACKAGE) cmake_host_system_information(RESULT DISTRO_VERSION_ID QUERY DISTRIB_VERSION_ID) set(_PCAPPP_PACKAGE_README_CUSTOM_PATH "${_PCAPPP_PACKAGE_README_PATH}/README.release.linux") if("${DISTRO_ID}" STREQUAL "ubuntu") - # set(CPACK_GENERATOR ${CPACK_GENERATOR};DEB) + set(CPACK_GENERATOR ${CPACK_GENERATOR};DEB) elseif("${DISTRO_ID}" STREQUAL "centos" OR "${DISTRO_ID}" STREQUAL "rhel") # set(CPACK_GENERATOR ${CPACK_GENERATOR};RPM) elseif("${DISTRO_ID}" STREQUAL "freebsd")