Release #86
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
workflow_call: | |
inputs: | |
tag: | |
description: 'Next release tag' | |
required: true | |
type: string | |
javawrapperversion: | |
description: 'Java Wrapper Version' | |
required: false | |
type: string | |
rchannels: | |
description: 'Channels to publish development releases' | |
required: false | |
type: string | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: 'Next release tag' | |
required: true | |
type: string | |
javawrapperversion: | |
description: 'Java Wrapper Version' | |
required: false | |
type: string | |
rchannels: | |
description: 'Channels to publish development releases' | |
required: false | |
type: string | |
env: | |
CX_BASE_URI: ${{ secrets.CX_BASE_URI }} | |
CX_APIKEY: ${{ secrets.CX_APIKEY }} | |
CX_TENANT: ${{ secrets.CX_TENANT }} | |
CX_TEST_REPO: ${{ secrets.CX_TEST_REPO }} | |
CX_TEST_SCAN: ${{ secrets.CX_TEST_SCAN }} | |
CX_TEST_BRANCH: ${{ secrets.CX_TEST_BRANCH }} | |
CX_TEST_PROJECT: ${{ secrets.CX_TEST_PROJECT }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
CX_NOT_MATCH_TEST_PROJECT: ${{ secrets.CX_NOT_MATCH_TEST_PROJECT }} | |
CX_NOT_MATCH_TEST_BRANCH: ${{ secrets.CX_NOT_MATCH_TEST_BRANCH }} | |
CX_NOT_MATCH_TEST_SCAN_ID: ${{ secrets.CX_NOT_MATCH_TEST_SCAN_ID }} | |
jobs: | |
verify: | |
runs-on: ubuntu-latest | |
steps: | |
# Check out current repository | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
# Setup Java 11 environment for the next steps | |
- name: Setup Java | |
uses: actions/setup-java@v3.13.0 | |
with: | |
distribution: zulu | |
java-version: 11 | |
# Run verifier | |
- name: Run plugin verifier | |
run: ./gradlew runPluginVerifier | |
# Upload verifier report | |
- name: Upload report | |
uses: actions/upload-artifact@c7d193f32edcb7bfad88892161225aeda64e9392 #v4 | |
if: always() | |
with: | |
name: verifier-report | |
path: build/reports/pluginVerifier | |
testIntegration: | |
needs: [ verify ] | |
runs-on: ubuntu-latest | |
steps: | |
# Check out current repository | |
- name: Fetch Sources | |
uses: actions/checkout@v4 | |
# Setup Java 11 environment for the next steps | |
- name: Setup Java | |
uses: actions/setup-java@v3.13.0 | |
with: | |
distribution: zulu | |
java-version: 11 | |
# Perform clean before testing | |
- name: Clean | |
run: ./gradlew clean | |
# Run tests | |
- name: Tests | |
run: ./gradlew test -i --tests com.checkmarx.intellij.integration.standard* | |
# Save report if tests fail | |
- name: Save fails report | |
if: ${{ failure() }} | |
uses: actions/upload-artifact@c7d193f32edcb7bfad88892161225aeda64e9392 #v4 | |
with: | |
name: test-fails-report-integration | |
path: | | |
build/reports | |
deleteDevReleases: | |
uses: Checkmarx/ast-jetbrains-plugin/.github/workflows/delete-dev-releases.yml@main | |
with: | |
tag: ${{ inputs.rchannels }} | |
secrets: inherit | |
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 | |
uses: actions/checkout@v4 | |
# Setup Java 11 environment for the next steps | |
- name: Setup Java | |
uses: actions/setup-java@v3.13.0 | |
with: | |
distribution: zulu | |
java-version: 11 | |
# Set the tag in an env var | |
- name: Set env | |
run: | | |
echo "RELEASE_VERSION=${{ inputs.tag }}" >> $GITHUB_ENV | |
echo "JAVA_WRAPPER_VERSION=${{ inputs.javawrapperversion }}" >> $GITHUB_ENV | |
- name: Create Release Name | |
run: | | |
echo "Creating release name" | |
if [ -z "${{ inputs.rchannels }}" ]; then | |
echo "GH_RELEASE_TAG_NAME=${{ env.RELEASE_VERSION }}" >> $GITHUB_ENV | |
else | |
echo "GH_RELEASE_TAG_NAME=${{ env.RELEASE_VERSION }}-${{ inputs.rchannels }}" >> $GITHUB_ENV | |
fi | |
echo "Release name - ${{ env.GH_RELEASE_TAG_NAME }}" | |
echo "::set-output name=TAG_NAME::${{ env.GH_RELEASE_TAG_NAME }}" | |
# Build plugin | |
- name: Build | |
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 | |
# Create the release or prerelease | |
- name: Create Release or Prerelease | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: ${{ env.GH_RELEASE_TAG_NAME }} | |
name: ${{ env.GH_RELEASE_TAG_NAME }} | |
files: build/distributions/* | |
generate_release_notes: true | |
prerelease: ${{ inputs.rchannels != '' && inputs.rchannels != null }} | |
# Publish the plugin in marketplace | |
- name: Publish Plugin | |
env: | |
PUBLISH_TOKEN: ${{ secrets.PUBLISH_TOKEN }} | |
run: | | |
if [ -z "${{ inputs.rchannels }}" ]; then | |
./gradlew publishPlugin | |
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 |