Skip to content

Commit

Permalink
Enhance release workflow to extract and output CLI version
Browse files Browse the repository at this point in the history
  • Loading branch information
BenAlvo1 committed Jan 28, 2025
1 parent ad6df6a commit 0d423a8
Showing 1 changed file with 56 additions and 0 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ jobs:
if: inputs.rchannels
release:
runs-on: ubuntu-latest
outputs:
TAG_NAME: ${{ steps.set_tag_name.outputs.TAG_NAME }}
CLI_VERSION: ${{ steps.extract_cli_version.outputs.CLI_VERSION }}
steps:
# Check out current repository
- name: Fetch Sources
Expand Down Expand Up @@ -131,6 +134,46 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./gradlew buildPlugin --info

- name: Extract CLI version
id: extract_cli_version
run: |
# Find the correct JAR file in Gradle cache (excluding javadoc JARs)
JAR_PATH=$(find ~/.gradle -type f -name "ast-cli-java-wrapper-*.jar" ! -name "*-javadoc.jar" | head -n 1)
if [ -z "$JAR_PATH" ]; then
echo "Error: ast-cli-java-wrapper JAR not found in Gradle dependencies."
exit 1
fi
echo "Found JAR at: $JAR_PATH"
# Create a temporary directory to extract the CLI
TEMP_DIR=$(mktemp -d)
unzip -j "$JAR_PATH" "cx-linux" -d "$TEMP_DIR"
if [ ! -f "$TEMP_DIR/cx-linux" ]; then
echo "Error: cx-linux not found inside the JAR."
ls -la
exit 1
fi
chmod +x "$TEMP_DIR/cx-linux"
# Extract the CLI version
CLI_VERSION=$("$TEMP_DIR/cx-linux" version | grep -Eo '^[0-9]+\.[0-9]+\.[0-9]+')
echo "CLI version being packed is $CLI_VERSION"
# Export CLI version as an environment variable
echo "CLI_VERSION=$CLI_VERSION" >> $GITHUB_ENV
echo "::set-output name=CLI_VERSION::$CLI_VERSION"
# Echo the CLI version for debugging purposes
echo "CLI version: $CLI_VERSION"


# Create the release or prerelease
- name: Create Release or Prerelease
uses: softprops/action-gh-release@v1
Expand All @@ -150,3 +193,16 @@ jobs:
else
./gradlew publishPlugin -Prchannels=${{ inputs.rchannels }}
fi
notify:
if: ${{ (inputs.rchannels != '' && inputs.rchannels != null) || inputs.rchannels == 'test-notify' }}
needs: release
uses: Checkmarx/plugins-release-workflow/.github/workflows/release-notify.yml@main
with:
product_name: JetBrains Plugin
release_version: ${{ needs.release.outputs.TAG_NAME }}
cli_release_version: ${{ needs.release.outputs.CLI_VERSION }}
release_author: "Phoenix Team"
release_url: https://github.com/Checkmarx/ast-jetbrains-plugin/releases/tag/${{ needs.release.outputs.TAG_NAME }}
jira_product_name: JetBrains
secrets: inherit

0 comments on commit 0d423a8

Please sign in to comment.