diff --git a/.github/workflows/append-release-cmake.yml b/.github/workflows/append-release-cmake.yml index 91a4e26e1c2..3eb179b1239 100644 --- a/.github/workflows/append-release-cmake.yml +++ b/.github/workflows/append-release-cmake.yml @@ -38,7 +38,7 @@ jobs: - name: Render template run: | - PATTERN="tiledb-([^-]+)-([^-]+)(-noavx2)?-([^-]+).(tar.gz|zip)$" + PATTERN="tiledb-([^-]+)-([^-]+)(-noavx2)?-([^-]+)-([^-]+).(tar.gz|zip)$" RELLIST="output/releases.csv" MODULE="output/DownloadPrebuiltTileDB.cmake" cp cmake/inputs/DownloadPrebuiltTileDB.cmake $MODULE diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8584e0d1870..e41069f419f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -17,9 +17,18 @@ jobs: steps: - name: Checkout TileDB uses: actions/checkout@v3 + - name: Set variables + id: get-values + run: | + release_hash=$( echo ${{ github.sha }} | cut -c-7 - ) + ref=${{ github.head_ref || github.ref_name }} + echo "release_version=${ref##*/}-$release_hash" >> $GITHUB_OUTPUT + shell: bash - name: CMake Configure run: cmake -S . -B build -DTILEDB_CMAKE_IDE=ON - name: CPack Package Source + env: + TILEDB_PACKAGE_VERSION: ${{ steps.get-values.outputs.release_version }} run: cd build && cpack --config CPackSourceConfig.cmake - name: Upload Release Artifacts uses: actions/upload-artifact@v3 @@ -79,8 +88,7 @@ jobs: run: | release_hash=$( echo ${{ github.sha }} | cut -c-7 - ) ref=${{ github.head_ref || github.ref_name }} - echo "release_hash=$release_hash" >> $GITHUB_OUTPUT - echo "archive_name=tiledb-${{ matrix.platform }}-${ref##*/}-$release_hash" >> $GITHUB_OUTPUT + echo "release_version=${ref##*/}-$release_hash" >> $GITHUB_OUTPUT shell: bash - name: Install manylinux prerequisites if: matrix.manylinux @@ -106,6 +114,8 @@ jobs: ${{ matrix.cmake_args }} shell: bash - name: Build TileDB + env: + TILEDB_PACKAGE_VERSION: ${{ steps.get-values.outputs.release_version }} run: cmake --build build --config Release --target package - name: Upload release artifacts uses: actions/upload-artifact@v3 diff --git a/cmake/inputs/CustomCPackOptions.cmake.in b/cmake/inputs/CustomCPackOptions.cmake.in index 71d8fbea068..65187e15532 100644 --- a/cmake/inputs/CustomCPackOptions.cmake.in +++ b/cmake/inputs/CustomCPackOptions.cmake.in @@ -5,3 +5,11 @@ set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY OFF) # Enable HASH set(CPACK_PACKAGE_CHECKSUM "SHA256") + +set(PACKAGE_VERSION $ENV{TILEDB_PACKAGE_VERSION}) +if(NOT PACKAGE_VERSION) + message(FATAL_ERROR "In order to package TileDB specify environment variable TILEDB_PACKAGE_VERSION") +endif() + +set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_SOURCE_PACKAGE_FILE_NAME}-${PACKAGE_VERSION}") +set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}-${PACKAGE_VERSION}") diff --git a/cmake/package.cmake b/cmake/package.cmake index 08bfae9049c..19ed3f47ef4 100644 --- a/cmake/package.cmake +++ b/cmake/package.cmake @@ -29,6 +29,13 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") else() set(CPACK_SYSTEM_PROCESSOR ${CMAKE_SYSTEM_PROCESSOR}) endif() +elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows") + set(CPACK_SYSTEM_NAME ${CMAKE_SYSTEM_NAME}) + if(CMAKE_SYSTEM_PROCESSOR STREQUAL "AMD64") + set(CPACK_SYSTEM_PROCESSOR "x86_64") + else() + set(CPACK_SYSTEM_PROCESSOR ${CMAKE_SYSTEM_PROCESSOR}) + endif() else() set(CPACK_SYSTEM_NAME ${CMAKE_SYSTEM_NAME}) set(CPACK_SYSTEM_PROCESSOR ${CMAKE_SYSTEM_PROCESSOR}) @@ -36,10 +43,10 @@ endif() set(CPACK_SOURCE_IGNORE_FILES ".*\.git;.*build.*/.*") -set(CPACK_SOURCE_PACKAGE_FILE_NAME "${PROJECT_NAME}-source-${TILEDB_VERSION}") +set(CPACK_SOURCE_PACKAGE_FILE_NAME "${PROJECT_NAME}-source") string(TOLOWER ${CPACK_SOURCE_PACKAGE_FILE_NAME} CPACK_SOURCE_PACKAGE_FILE_NAME) -set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${CPACK_SYSTEM_NAME}-${CPACK_SYSTEM_PROCESSOR}${CPACK_NOAVX2}-${TILEDB_VERSION}") +set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${CPACK_SYSTEM_NAME}-${CPACK_SYSTEM_PROCESSOR}${CPACK_NOAVX2}") string(TOLOWER ${CPACK_PACKAGE_FILE_NAME} CPACK_PACKAGE_FILE_NAME) include(CPack)