From c0284497e3cdf10d722af29eda3e20e0b1f969db Mon Sep 17 00:00:00 2001 From: VintagePC <53943260+vintagepc@users.noreply.github.com> Date: Fri, 1 Mar 2024 20:00:27 -0500 Subject: [PATCH] Facilitate automatic release uploads of artifacts --- .github/workflows/build.yml | 12 ++++++++++++ CMakeLists.txt | 19 +++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 10f103d87..9cab9858d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,6 +4,8 @@ on: pull_request: branches: - '*' + tags: + - 'v*' push: branches: [ MK3, MK3_* ] @@ -66,6 +68,16 @@ jobs: name: Firmware path: build/*.hex + - name: RELEASE THE KRAKEN + if: startsWith(github.ref, 'refs/tags/v') + uses: "marvinpinto/action-automatic-releases@latest" + with: + repo_token: "${{ secrets.GITHUB_TOKEN }}" + draft: true + files: | + "build/release/*.hex" + "build/release/*.zip" + check-lang: runs-on: ubuntu-latest diff --git a/CMakeLists.txt b/CMakeLists.txt index b1d204cc3..60b275f65 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -545,6 +545,8 @@ function(fw_add_variant variant_name) BYPRODUCTS ${LANG_HEX} COMMAND ${CMAKE_COMMAND} -E create_hardlink ${FW_LANG_FINAL}.hex ${LANG_DEBUG_HEX} BYPRODUCTS ${LANG_DEBUG_HEX} + COMMAND ${CMAKE_COMMAND} -E create_hardlink ${FW_LANG_FINAL}.hex ${CMAKE_BINARY_DIR}/release/${hex_variant_name}_${FN_VERSION_DEBUG_SUFFIX}_MULTILANG.hex + BYPRODUCTS ${CMAKE_BINARY_DIR}/release/${hex_variant_name}_${FN_VERSION_DEBUG_SUFFIX}_MULTILANG.hex DEPENDS ${FW_LANG_PATCH}.hex ${LANG_CATHEX} COMMENT "Generating final ${FW_LANG_FINAL}.hex" ) @@ -586,6 +588,13 @@ function(fw_add_variant variant_name) list(APPEND ALL_VARIANT_HEXES ${FW_LANG_FINAL}) endforeach() add_custom_target("${variant_name}-All-Languages" DEPENDS ${ALL_VARIANT_HEXES}) + add_custom_command(TARGET "${variant_name}-All-Languages" + POST_BUILD + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + COMMAND ${CMAKE_COMMAND} -E make_directory "release" + COMMAND ${CMAKE_COMMAND} -E tar "cfv" "release/${variant_name}_${FN_VERSION_SUFFIX}.zip" --format=zip ${variant_name}_${FN_VERSION_DEBUG_SUFFIX}_en*.hex + BYPRODUCTS "${CMAKE_BINARY_DIR}/release/${variant_name}_${FN_VERSION_SUFFIX}.zip" + ) add_dependencies(ALL_MULTILANG "${variant_name}-All-Languages") endif() endfunction() @@ -628,6 +637,16 @@ if(CMAKE_CROSSCOMPILING) endforeach(THIS_VAR IN LISTS FW_VARIANTS) endif() +SET(REVO_FW_ZIP_NAME "E3D_REVO_FW_MK3_MK3S_MK3S+_${FN_VERSION_SUFFIX}.zip") + +add_custom_command(TARGET ALL_MULTILANG + POST_BUILD + WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/release + BYPRODUCTS ${CMAKE_BINARY_DIR}/release/${REVO_FW_ZIP_NAME} + COMMAND ${CMAKE_COMMAND} -E tar "cfv" "${REVO_FW_ZIP_NAME}" --format=zip *E3DREVO*.hex + COMMAND ${CMAKE_COMMAND} -E rm *E3DREVO*.hex + ) + # # Tests #