From 03a3b923a0d841f009ff2b88addd028442204699 Mon Sep 17 00:00:00 2001 From: "Azamat H. Hackimov" Date: Mon, 12 Aug 2024 17:07:44 +0300 Subject: [PATCH] Add release flow to GitHub Actions Initial support to automate release flow. Now after git tag of specific commit GitHub Actions will create a draft entry of release (named by tag) with source code package on it. --- .github/workflows/release.yml | 30 ++++++++++++++++++++++++++++++ CMakeLists.txt | 14 ++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..fefaa13a7 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,30 @@ +name: Release source tarball +on: + push: + tags: + - '*' + +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Generate git hash and tarball + run: | + sudo apt update + sudo apt install -y ninja-build cmake g++ libsdl2-dev zlib1g-dev + cmake --preset linux + cmake --build --preset linux -t get_git_hash + cmake --build --preset linux -t package_source + + - name: Release + uses: ncipollo/release-action@v1.14.0 + with: + artifacts: "builds/linux/Descent3-*-Source.tar.xz" + draft: true + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/CMakeLists.txt b/CMakeLists.txt index 7a26bc95b..5c98edd98 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -253,3 +253,17 @@ add_subdirectory(tools) add_subdirectory(netcon) add_subdirectory(netgames) add_subdirectory(scripts) + +# Packaging stuff +set(CPACK_SOURCE_GENERATOR "TXZ") +set(CPACK_SOURCE_IGNORE_FILES + ".git/" + ".github/" + ".idea" + build[s]/ + cmake-build-* + ".*~$" +) +set(CPACK_VERBATIM_VARIABLES YES) +include(CPack) +