diff --git a/Makefile b/Makefile index 188d689f3..6a897cf45 100644 --- a/Makefile +++ b/Makefile @@ -14,16 +14,27 @@ export GITHUB_WORKSPACE = $(shell pwd) run: @bash ./entrypoint.sh $(DEFAULT_VERSION) $(DEFAULT_COMMAND) $(TEST_FILEPATH) $(DEFAULT_TEMPLATE) $(DEFAULT_LANGUAGE) $(DEFAULT_OUTPUT) $(DEFAULT_PARAMETERS) $(DEFAULT_CUSTOM_COMMANDS) -# Updates the action.yml file with the latest version of the action got from $VERSION env variable -generate-assets: - version=$$(echo ${VERSION} | sed 's/v//g'); \ - sed "s/docker:\/\/asyncapi\/github-action-for-cli:.*/docker:\/\/asyncapi\/github-action-for-cli:$$version'/g" action.yml > action.yml.tmp - @mv action.yml.tmp action.yml - -test: test-default test-validate-success test-validate-fail test-custom-output test-custom-commands test-optimize test-bundle test-convert +test: test-default test-validate-success test-validate-fail test-custom-output test-custom-commands test-optimize test-bundle test-convert test-action-bump # Test cases +# Tests if the action has been bumped greater than the latest release +# sed "s/docker:\/\/asyncapi\/github-action-for-cli:.*/docker:\/\/asyncapi\/github-action-for-cli:$$version'/g" action.yml > action.yml.tmp +REGEX = docker:\/\/asyncapi\/github-action-for-cli:([0-9.]+) +test-action-bump: + @version=$$(cat package.json | jq -r '.version'); \ + action=$$(cat action.yml); \ + [[ $$action =~ $(REGEX) ]]; \ + action_version=$${BASH_REMATCH[1]}; \ + echo "Action version: $$action_version"; \ + echo "Package version: $$version"; \ + if [[ $$action_version > $$version ]]; then \ + echo "Action version is greater than package version"; \ + else \ + echo "Action version has not been bumped. Please bump the action version to the semantically correct version after $$version"; \ + exit 1; \ + fi + # Tests the default configuration without any inputs test-default: @bash ./entrypoint.sh $(DEFAULT_VERSION) $(DEFAULT_COMMAND) $(TEST_FILEPATH) $(DEFAULT_TEMPLATE) $(DEFAULT_LANGUAGE) $(DEFAULT_OUTPUT) $(DEFAULT_PARAMETERS) $(DEFAULT_CUSTOM_COMMANDS) diff --git a/action.yml b/action.yml index c2697222b..3c1f8ef94 100644 --- a/action.yml +++ b/action.yml @@ -38,7 +38,7 @@ runs: using: 'docker' # This is the image that will be used to run the action. # IMPORTANT: The version has to be changed manually in your PRs. - image: 'docker://asyncapi/github-action-for-cli:3.0.1' + image: 'docker://asyncapi/github-action-for-cli:3.0.2' args: - ${{ inputs.cli_version }} - ${{ inputs.command }} diff --git a/package.json b/package.json index 6284e1e3e..e67cbe082 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "test": "make test", "generate:assets": "echo 'No additional assets need to be generated at the moment'", "docker:build": "docker build -t asyncapi/github-action-for-cli:latest .", - "bump:version": "npm --no-git-tag-version --allow-same-version version $VERSION && make generate-assets" + "bump:version": "npm --no-git-tag-version --allow-same-version version $VERSION" }, "repository": { "type": "git",