diff --git a/.github/workflows/change.yml b/.github/workflows/change.yml index df87df93af..377701477d 100644 --- a/.github/workflows/change.yml +++ b/.github/workflows/change.yml @@ -32,3 +32,10 @@ jobs: needs: build with: image: registry.gitlab.com/kwinft/ci-images/archlinux/kwinft-base-master + + package: + uses: ./.github/workflows/package.yml + needs: build + with: + image: registry.gitlab.com/kwinft/ci-images/archlinux/kwinft-base-master + package-name: theseus-ship diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml new file mode 100644 index 0000000000..adfc137442 --- /dev/null +++ b/.github/workflows/package.yml @@ -0,0 +1,70 @@ +# SPDX-FileCopyrightText: 2024 Roman Gilg +# SPDX-License-Identifier: MIT +name: Package +on: + workflow_call: + inputs: + image: + description: Image to package on + required: true + type: string + artifact-name: + description: Artifact name of build dir + required: false + type: string + default: 'build' + package-name: + description: Name of the resulting packages + required: true + type: string + +jobs: + deb: + name: Create deb + runs-on: ubuntu-latest + container: + image: ${{ inputs.image }} + steps: + - name: Install dpkg + run: pacman -Sy --needed --quiet --noconfirm dpkg + - name: Checkout Repository + uses: actions/checkout@v4 + - name: Download artifact + uses: actions/download-artifact@v4 + with: + name: ${{ inputs.artifact-name }} + - name: Untar artifact + run: tar -xzf build-dir.tar + - name: Run CPack + run: cd build && cpack -G DEB -D CPACK_DEBIAN_FILE_NAME=${{ inputs.package-name }}.deb + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: deb-package + path: build/_CPack_Packages/Linux/DEB/${{ inputs.package-name }}.deb + retention-days: 8 + + tar: + name: Create tar + runs-on: ubuntu-latest + container: + image: ${{ inputs.image }} + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + - name: Download artifact + uses: actions/download-artifact@v4 + with: + name: ${{ inputs.artifact-name }} + - name: Untar artifact + run: tar -xzf build-dir.tar + - name: Run CPack + # Need to use CPACK_PACKAGE_FILE_NAME instead of CPACK_ARCHIVE_FILE_NAME + # See: https://gitlab.kitware.com/cmake/cmake/-/issues/20419 + run: cd build && cpack -G TGZ -D CPACK_PACKAGE_FILE_NAME=${{ inputs.package-name }} + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: tar-package + path: build/_CPack_Packages/Linux/TGZ/${{ inputs.package-name }}.tar.gz + retention-days: 8 diff --git a/CMakeLists.txt b/CMakeLists.txt index 4b7215caa2..92af385edd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -227,3 +227,5 @@ install( FILES ${CMAKE_CURRENT_BINARY_DIR}/bin/kwin_wayland_wrapper DESTINATION ${CMAKE_INSTALL_FULL_BINDIR} ) + +include(Packing) diff --git a/cmake/modules/Packing.cmake b/cmake/modules/Packing.cmake new file mode 100644 index 0000000000..68825a2416 --- /dev/null +++ b/cmake/modules/Packing.cmake @@ -0,0 +1,21 @@ +# SPDX-FileCopyrightText: 2024 Roman Gilg +# SPDX-License-Identifier: GPL-2.0-or-later + +set(CPACK_PACKAGE_NAME theseus-ship CACHE STRING "Deb package name") +set(CPACK_PACKAGE_VENDOR "WinFT") + +set(CPACK_PACKAGE_CONTACT "subdiff@gmail.com") +set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Roman Gilg") + +set(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR}) +set(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR}) +set(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH}) + +set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE") +set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/README.md") + +set(CPACK_VERBATIM_VARIABLES YES) +set(CPACK_PACKAGE_INSTALL_DIRECTORY ${CPACK_PACKAGE_NAME}) +set(CPACK_DEBIAN_FILE_NAME DEB-DEFAULT) + +include(CPack)