From 11ddf5048de2d1855e9fd08d59bb75e55242b27f Mon Sep 17 00:00:00 2001 From: Juan Cruz Viotti Date: Mon, 3 Jun 2024 19:46:35 -0400 Subject: [PATCH] Hardcode JSON Schema version in `action.yml` Signed-off-by: Juan Cruz Viotti --- CMakeLists.txt | 8 ++++++++ CONTRIBUTING.markdown | 6 +++++- action.yml | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7ab35002..bf2fffee 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,6 +26,14 @@ if(JSONSCHEMA_TESTS) add_subdirectory(test) endif() +# As a sanity check +file(READ "${PROJECT_SOURCE_DIR}/action.yml" ACTION_YML) +string(FIND "${ACTION_YML}" "${PROJECT_VERSION}" ACTION_YML_HAS_VERSION) +if(${ACTION_YML_HAS_VERSION} EQUAL -1) + message(FATAL_ERROR + "The GitHub Action definition must set the correct version: ${PROJECT_VERSION}") +endif () + # Packaging find_program(GIT_BIN NAMES git) if(GIT_BIN AND JSONSCHEMA_CONTINUOUS) diff --git a/CONTRIBUTING.markdown b/CONTRIBUTING.markdown index bd22f1d2..9db48547 100644 --- a/CONTRIBUTING.markdown +++ b/CONTRIBUTING.markdown @@ -23,9 +23,13 @@ Releasing ```sh git checkout main + # Update the VERSION in CMakeLists.txt vim CMakeLists.txt -git add CMakeLists.txt +# Update the version in action.yml +vim action.yml + +git add CMakeLists.txt action.yml git commit -m "vX.Y.Z" git tag -a "vX.Y.Z" -m "vX.Y.Z" git push diff --git a/action.yml b/action.yml index 4e60dac1..a63ac79e 100644 --- a/action.yml +++ b/action.yml @@ -10,5 +10,5 @@ runs: --output "${GITHUB_WORKSPACE}/install.sh" \ "https://raw.githubusercontent.com/intelligence-ai/jsonschema/main/install" chmod +x "${GITHUB_WORKSPACE}/install.sh" - "${GITHUB_WORKSPACE}/install.sh" "${GITHUB_REF#refs/tags/v}" + "${GITHUB_WORKSPACE}/install.sh" 0.1.3 rm "${GITHUB_WORKSPACE}/install.sh"