From 6e3fe0b0421dd9c5a55882d4b05d0d5467ed579b Mon Sep 17 00:00:00 2001 From: Greg Beard Date: Sun, 10 Mar 2024 11:24:53 +0000 Subject: [PATCH] feat(ci) Adds manual workflow for publishing releases --- .github/workflows/publish-release.yml | 39 +++++++++++++++++++++++++++ src/CMakeLists.txt | 3 ++- 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/publish-release.yml diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml new file mode 100644 index 0000000..7763634 --- /dev/null +++ b/.github/workflows/publish-release.yml @@ -0,0 +1,39 @@ +name: CMake + +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 + 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/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> ) -