Skip to content

Commit

Permalink
Test automatic building of BetrockServer
Browse files Browse the repository at this point in the history
  • Loading branch information
OfficialPixelBrush committed Jan 24, 2025
1 parent a58f653 commit a0dc528
Showing 1 changed file with 34 additions and 7 deletions.
41 changes: 34 additions & 7 deletions .github/workflows/cmake-single-platform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@ name: CMake on a single platform

on:
push:
branches: [ "main" ]
branches: [ "main", "latest" ]
pull_request:
branches: [ "main" ]
branches: [ "main", "latest" ]

permissions:
contents: write

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
Expand All @@ -23,6 +26,13 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Extract Version from CMakeLists.txt
id: extract_version
run: |
VERSION=$(grep -oP 'project\([^\)]*VERSION\s+\K[^\)]+' CMakeLists.txt)
echo "VERSION=$VERSION"
echo "version=$VERSION" >> $GITHUB_ENV
- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
Expand All @@ -35,9 +45,26 @@ jobs:
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}

#- name: Test
#working-directory: ${{github.workspace}}/build
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
#run: ctest -C ${{env.BUILD_TYPE}}
- name: Package
run: cpack --config ${{github.workspace}}/build/CPackConfig.cmake -G TGZ

- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ env.version }}
release_name: v${{ env.version }}
draft: false
prerelease: false

- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{github.workspace}}/build/*.tar.gz
asset_name: your_generated_file_name.tar.gz
asset_content_type: application/gzip

0 comments on commit a0dc528

Please sign in to comment.