Skip to content

Commit 3c4b610

Browse files
author
cx-Margarita-LevitM
committed
Add a test if the updated CLI version is the latest released version.
1 parent e2ab6ca commit 3c4b610

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

.github/workflows/release.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
name: Javascript Wrapper Release
32

43
on:
@@ -91,6 +90,19 @@ jobs:
9190
echo "CLI_VERSION=$CLI_VERSION" >> $GITHUB_ENV
9291
echo "::set-output name=CLI_VERSION::$CLI_VERSION"
9392
93+
- name: Check if CLI version is latest
94+
id: check_latest_cli_version
95+
run: |
96+
API_RESPONSE=$(curl -s -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/Checkmarx/ast-cli/releases/latest)
97+
LATEST_CLI_VERSION=$(echo "$API_RESPONSE" | grep -o '"tag_name"[[:space:]]*:[[:space:]]*"[^"]*"' | sed 's/"tag_name"[[:space:]]*:[[:space:]]*"\([^"]*\)"/\1/' | sed 's/^v//')
98+
99+
if [ "$CLI_VERSION" = "$LATEST_CLI_VERSION" ]; then
100+
echo "Confirm that the CLI version in the repository is up-to-date with the most recent release: $CLI_VERSION"
101+
else
102+
echo "The current repository contains a CLI version that differs from the latest released version: Expected $LATEST_CLI_VERSION, got $CLI_VERSION"
103+
exit 1
104+
fi
105+
94106
- name: NPM ci and build
95107
run: |
96108
npm ci

0 commit comments

Comments
 (0)