From 90417401abb258e0a5d351c76fd8143f6a36c55c Mon Sep 17 00:00:00 2001 From: Snider Date: Mon, 29 Sep 2025 20:45:11 +0100 Subject: [PATCH] Refactor CI workflows and update CPack config Split build jobs by architecture and OS in GitHub Actions workflows, add Docker and docs build jobs, and update artifact upload to create GitHub releases. Also update CPackConfig.cmake to use BUILD_VERSION for package versioning. --- .github/actions/upload-artifacts/action.yml | 9 +++++ .github/workflows/_on-pr.yml | 37 +++++++++++++---- .github/workflows/_on-push.yml | 1 - .github/workflows/_on-release.yml | 45 +++++++++++++-------- cmake/CPackConfig.cmake | 4 +- 5 files changed, 69 insertions(+), 27 deletions(-) diff --git a/.github/actions/upload-artifacts/action.yml b/.github/actions/upload-artifacts/action.yml index 927df0b1..98951cc9 100644 --- a/.github/actions/upload-artifacts/action.yml +++ b/.github/actions/upload-artifacts/action.yml @@ -58,3 +58,12 @@ runs: with: name: ${{ steps.asset.outputs.key }} path: ${{ steps.asset.outputs.paths }} + + - name: Make Release + uses: softprops/action-gh-release@v2 + continue-on-error: true + with: + tag_name: ${{ inputs.chain-network }}-${{ inputs.release-tag }} + prerelease: contains(inputs.chain-network, 'testnet') + files: ${{ inputs.asset-directory }}/lethean-* + target_commitish: ${{ github.sha }} \ No newline at end of file diff --git a/.github/workflows/_on-pr.yml b/.github/workflows/_on-pr.yml index c465d570..1ba8089e 100644 --- a/.github/workflows/_on-pr.yml +++ b/.github/workflows/_on-pr.yml @@ -14,30 +14,51 @@ concurrency: cancel-in-progress: true jobs: - build-linux: - name: Compile + build-linux-intel: + name: Chain if: github.event.review.state == 'approved' && !github.event.pull_request.draft - uses: ./.github/workflows/build-linux.yml + uses: ./.github/workflows/build-linux-intel.yml with: chain-network: ${{ github.ref_name == 'main' && 'mainnet' || 'testnet' }} - build-windows: - name: Compile + build-linux-arm: + name: Chain if: github.event.review.state == 'approved' && !github.event.pull_request.draft - uses: ./.github/workflows/build-windows.yml + uses: ./.github/workflows/build-linux-arm64.yml + with: + chain-network: ${{ github.ref_name == 'main' && 'mainnet' || 'testnet' }} + + build-windows-intel: + name: Chain + if: github.event.review.state == 'approved' && !github.event.pull_request.draft + uses: ./.github/workflows/build-windows-intel.yml with: chain-network: ${{ github.ref_name == 'main' && 'mainnet' || 'testnet' }} build-macos-arm64: - name: Compile + name: Chain + if: github.event.review.state == 'approved' && !github.event.pull_request.draft uses: ./.github/workflows/build-macos-arm64.yml with: chain-network: ${{ github.ref_name == 'main' && 'mainnet' || 'testnet' }} build-macos-intel: - name: Compile + name: Chain if: github.event.review.state == 'approved' && !github.event.pull_request.draft uses: ./.github/workflows/build-macos-intel.yml with: chain-network: ${{ github.ref_name == 'main' && 'mainnet' || 'testnet' }} + build-docker: + name: Docker + if: github.event.review.state == 'approved' && !github.event.pull_request.draft + uses: ./.github/workflows/build-docker.yml + with: + chain-network: ${{ github.ref_name == 'main' && 'mainnet' || 'testnet' }} + secrets: inherit + + build-docs: + + if: github.event.review.state == 'approved' && !github.event.pull_request.draft + name: Docs + uses: ./.github/workflows/build-docs.yml diff --git a/.github/workflows/_on-push.yml b/.github/workflows/_on-push.yml index eb13681b..28fd723c 100644 --- a/.github/workflows/_on-push.yml +++ b/.github/workflows/_on-push.yml @@ -8,7 +8,6 @@ on: push: branches: - 'dev' - - 'dev-*' - 'main' concurrency: diff --git a/.github/workflows/_on-release.yml b/.github/workflows/_on-release.yml index c89cace9..495c0595 100644 --- a/.github/workflows/_on-release.yml +++ b/.github/workflows/_on-release.yml @@ -37,30 +37,43 @@ jobs: echo "Source Branch: $SOURCE_BRANCH" echo "Chain Network: ${{ steps.get_branch.outputs.chain_network }}" - build-linux: - name: Compile - needs: determine-network - uses: ./.github/workflows/build-linux.yml + build-linux-intel: + name: Chain + uses: ./.github/workflows/build-linux-intel.yml with: - chain-network: ${{ needs.determine-network.outputs.chain-network }} + chain-network: ${{ github.ref_name == 'main' && 'mainnet' || 'testnet' }} - build-windows: - name: Compile - needs: determine-network - uses: ./.github/workflows/build-windows.yml + build-linux-arm: + name: Chain + uses: ./.github/workflows/build-linux-arm64.yml with: - chain-network: ${{ needs.determine-network.outputs.chain-network }} + chain-network: ${{ github.ref_name == 'main' && 'mainnet' || 'testnet' }} + + build-windows-intel: + name: Chain + uses: ./.github/workflows/build-windows-intel.yml + with: + chain-network: ${{ github.ref_name == 'main' && 'mainnet' || 'testnet' }} build-macos-arm64: - name: Compile - needs: determine-network + name: Chain uses: ./.github/workflows/build-macos-arm64.yml with: - chain-network: ${{ needs.determine-network.outputs.chain-network }} + chain-network: ${{ github.ref_name == 'main' && 'mainnet' || 'testnet' }} build-macos-intel: - name: Compile - needs: determine-network + name: Chain uses: ./.github/workflows/build-macos-intel.yml with: - chain-network: ${{ needs.determine-network.outputs.chain-network }} + chain-network: ${{ github.ref_name == 'main' && 'mainnet' || 'testnet' }} + + build-docker: + name: Docker + uses: ./.github/workflows/build-docker.yml + with: + chain-network: ${{ github.ref_name == 'main' && 'mainnet' || 'testnet' }} + secrets: inherit + + build-docs: + name: Docs + uses: ./.github/workflows/build-docs.yml diff --git a/cmake/CPackConfig.cmake b/cmake/CPackConfig.cmake index 983dd181..a55201a7 100644 --- a/cmake/CPackConfig.cmake +++ b/cmake/CPackConfig.cmake @@ -1,10 +1,10 @@ -#include(${CMAKE_SOURCE_DIR}/cmake/config-vars.cmake) + if(CMAKE_BUILD_TYPE STREQUAL "Release") set(CPACK_PACKAGE_NAME "${package_name}") set(CPACK_PACKAGE_VENDOR "${package_vendor}") set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${package_description}") - set(CPACK_PACKAGE_VERSION "${package_version}") + set(CPACK_PACKAGE_VERSION "${BUILD_VERSION}") set(CPACK_PACKAGE_CONTACT "${package_contact}") set(CPACK_PACKAGE_HOMEPAGE_URL "${package_website}")