diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml new file mode 100644 index 0000000..57e5507 --- /dev/null +++ b/.github/workflows/publish-release.yml @@ -0,0 +1,45 @@ +name: Publish release + +on: + workflow_dispatch: {} + push: + branches: + - feature/publish-release-from-ci + +env: + BUILD_TYPE: Release + +jobs: + build-and-test: + strategy: + matrix: + os: + - ubuntu-latest + - macos-13 + - macos-14 + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v3 + - name: Configure CMake + env: + BUILD_DIR: build-${{ matrix.os }} + run: | + cmake -B ${{github.workspace}}/${BUILD_DIR} \ + -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \ + -DSEMVERUTIL_ENABLE_TESTS=ON \ + -DSEMVERUTIL_STATIC_BINARY=ON + + - name: Build + env: + BUILD_DIR: build-${{ matrix.os }} + run: cmake --build ${{github.workspace}}/${BUILD_DIR} --config ${{env.BUILD_TYPE}} + - name: Test + working-directory: ${{github.workspace}}/build-${{ matrix.os }} + run: ctest -C ${{ env.BUILD_TYPE }} --output-on-failure + - name: Upload + uses: actions/upload-artifact@v4 + with: + name: dist-${{ matrix.os }} + path: | + build-${{ matrix.os }}/src/semverutil* + diff --git a/CMakeLists.txt b/CMakeLists.txt index 003d538..0013687 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,9 @@ cmake_minimum_required(VERSION 3.22) +if (APPLE) + set(CMAKE_OSX_ARCHTECTURES "arm64;x86_64") +endif () + file(READ ".versioning/current" current_version) string(STRIP "${current_version}" current_version) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index be15240..9d066bb 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -27,11 +27,13 @@ add_executable( main.cpp ) +if (NOT APPLE) target_link_options( semverutilbin PRIVATE $<$:-static -static-libgcc -static-libstdc++> ) +endif () target_link_libraries( semverutilbin @@ -44,4 +46,3 @@ set_target_properties( PROPERTIES OUTPUT_NAME semverutil$<$:-static> ) -