Skip to content

Commit 9c074a4

Browse files
Merge pull request #189 from Checkmarx/add-release-notify
Add release notify (AST-000)
2 parents 694c5c7 + 14229e6 commit 9c074a4

22 files changed

Lines changed: 132 additions & 58 deletions

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
checkmarx-ast-eclipse-plugin/lib/ast-cli-java-wrapper-2.1.8.jar filter=lfs diff=lfs merge=lfs -text
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#!/bin/bash
2+
3+
# Check if a parameter is provided
4+
if [ -z "$1" ]; then
5+
echo "Error: No binary name provided. Usage: $0 <binary_name>"
6+
exit 1
7+
fi
8+
9+
BINARY_NAME=$1
10+
11+
echo "Starting CLI version extraction for binary: $BINARY_NAME..."
12+
13+
# Find the correct JAR file in Gradle cache (excluding javadoc JARs)
14+
JAR_PATH=$(find checkmarx-ast-eclipse-plugin/lib -type f -name "ast-cli-java-wrapper-*.jar" ! -name "*-javadoc.jar" | head -n 1)
15+
16+
if [ -z "$JAR_PATH" ]; then
17+
echo "Error: ast-cli-java-wrapper JAR not found in Gradle dependencies."
18+
exit 1
19+
fi
20+
21+
echo "Found JAR at: $JAR_PATH"
22+
23+
# Create a temporary directory to extract the CLI
24+
TEMP_DIR=$(mktemp -d)
25+
echo "Using temporary directory: $TEMP_DIR"
26+
27+
unzip -j "$JAR_PATH" "$BINARY_NAME" -d "$TEMP_DIR"
28+
if [ $? -ne 0 ]; then
29+
echo "Error: Failed to unzip $BINARY_NAME from the JAR."
30+
exit 1
31+
fi
32+
33+
if [ ! -f "$TEMP_DIR/$BINARY_NAME" ]; then
34+
echo "Error: $BINARY_NAME not found inside the JAR."
35+
ls -la "$TEMP_DIR"
36+
exit 1
37+
fi
38+
39+
chmod +x "$TEMP_DIR/$BINARY_NAME"
40+
41+
# Extract the CLI version
42+
CLI_VERSION=$("$TEMP_DIR/$BINARY_NAME" version | grep -Eo '^[0-9]+\.[0-9]+\.[0-9]+')
43+
44+
if [ -z "$CLI_VERSION" ]; then
45+
echo "Error: CLI_VERSION is not set or is empty."
46+
exit 1
47+
fi
48+
49+
echo "CLI version being packed is $CLI_VERSION"
50+
51+
# Export CLI version as an environment variable
52+
echo "CLI_VERSION=$CLI_VERSION" >> $GITHUB_ENV
53+
54+
echo "CLI version extraction for $BINARY_NAME completed successfully."

.github/workflows/ast-scan.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ jobs:
77
runs-on: ubuntu-latest
88
steps:
99
- name: Checkout
10-
uses: actions/checkout@v3.5.2
10+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
1111
- name: Checkmarx One CLI Action
12-
uses: checkmarx/ast-github-action@main
12+
uses: checkmarx/ast-github-action@f0869bd1a37fddc06499a096101e6c900e815d81 # v.2.0.36
1313
with:
1414
base_uri: ${{ secrets.AST_RND_SCANS_BASE_URI }}
1515
cx_tenant: ${{ secrets.AST_RND_SCANS_TENANT }}

.github/workflows/ci.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ jobs:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- uses: actions/checkout@v3.5.2
13+
with:
14+
lfs: true
15+
- name: Checkout LFS objects
16+
run: git lfs checkout
1317
- uses: actions/setup-java@v3
1418
with:
1519
distribution: temurin
@@ -29,11 +33,15 @@ jobs:
2933
run: |
3034
Xvfb -ac :99 -screen 0 1920x1080x16 &
3135
mvn verify -Dtest.includes="**/ui/*.java"
32-
36+
3337
integration-tests:
3438
runs-on: ubuntu-latest
3539
steps:
3640
- uses: actions/checkout@v3.5.2
41+
with:
42+
lfs: true
43+
- name: Checkout LFS objects
44+
run: git lfs checkout
3745
- uses: actions/setup-java@v3
3846
with:
3947
distribution: temurin

.github/workflows/delete-dev-releases.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525

2626
- name: Delete releases and tags
2727
continue-on-error: true
28-
uses: dev-drprasad/delete-older-releases@v0.2.1
28+
uses: dev-drprasad/delete-older-releases@653dc03d96473ac9e585c68c8bf5aaccb0dadb61 # 0.2.1
2929
env:
3030
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3131
with:

.github/workflows/pr-automation.yml

Lines changed: 0 additions & 22 deletions
This file was deleted.

.github/workflows/pr-label.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
pull-requests: write # for TimonVS/pr-labeler-action to add labels in PR
1313
runs-on: ubuntu-latest
1414
steps:
15-
- uses: TimonVS/pr-labeler-action@v4
15+
- uses: TimonVS/pr-labeler-action@8b99f404a073744885d8021d1de4e40c6eaf38e2 # v4
1616
with:
1717
configuration-path: .github/pr-labeler.yml # optional, .github/pr-labeler.yml is the default value
1818
env:

.github/workflows/release.yml

Lines changed: 46 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,27 +31,37 @@ jobs:
3131
if: inputs.rbranch
3232
release:
3333
runs-on: ubuntu-latest
34+
outputs:
35+
TAG_NAME: ${{ steps.generate_tag_name.outputs.TAG_NAME }}
36+
CLI_VERSION: ${{ steps.set_outputs.outputs.CLI_VERSION }}
3437
steps:
3538
- name: Checkout
3639
uses: actions/checkout@v3.5.2
3740
with:
3841
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
3942

40-
# Set the tag in an env var
41-
- name: Set env
42-
run: |
43-
echo "RELEASE_VERSION=${{ inputs.tag }}" >> $GITHUB_ENV
4443
- name: Create Release Name
44+
id: generate_tag_name
4545
run: |
4646
echo "Creating release name"
47+
4748
if [ -z "${{ inputs.rbranch }}" ]; then
48-
echo "GH_RELEASE_TAG_NAME=${{ env.RELEASE_VERSION }}" >> $GITHUB_ENV
49-
echo "GH_BRANCH_NAME=main" >> $GITHUB_ENV
49+
export GH_RELEASE_TAG_NAME="${{ inputs.tag }}"
50+
export GH_BRANCH_NAME="main"
5051
else
51-
echo "GH_RELEASE_TAG_NAME=${{ env.RELEASE_VERSION }}-${{ inputs.rbranch }}" >> $GITHUB_ENV
52-
echo "GH_BRANCH_NAME=nightly" >> $GITHUB_ENV
52+
export GH_RELEASE_TAG_NAME="${{ inputs.tag }}-${{ inputs.rbranch }}"
53+
export GH_BRANCH_NAME="nightly"
5354
fi
54-
55+
56+
echo "Generated TAG_NAME: $GH_RELEASE_TAG_NAME"
57+
58+
# Persist the variables
59+
echo "GH_RELEASE_TAG_NAME=$GH_RELEASE_TAG_NAME" >> $GITHUB_ENV
60+
echo "GH_BRANCH_NAME=$GH_BRANCH_NAME" >> $GITHUB_ENV
61+
62+
# Set outputs for future steps
63+
echo "TAG_NAME=$GH_RELEASE_TAG_NAME" >> $GITHUB_OUTPUT
64+
5565
- name: Set up JDK 8
5666
uses: actions/setup-java@v3
5767
with:
@@ -67,13 +77,24 @@ jobs:
6777
${{ runner.os }}-maven-
6878
6979
- name: Update the POM version.
70-
run: mvn -B org.eclipse.tycho:tycho-versions-plugin:set-version -DnewVersion='${{ env.RELEASE_VERSION }}' --file pom.xml
80+
run: mvn -B org.eclipse.tycho:tycho-versions-plugin:set-version -DnewVersion='${{ inputs.tag }}' --file pom.xml
7181

7282
- name: Create release
7383
run: mvn -B clean install --file pom.xml -DskipTests -pl "!checkmarx-ast-eclipse-plugin-tests"
7484

85+
- name: Extract CLI version
86+
id: extract_cli_version
87+
run: |
88+
chmod +x ./.github/scripts/extract_cli_version.sh
89+
./.github/scripts/extract_cli_version.sh cx-linux
90+
91+
- name: Echo CLI version to outputs
92+
id: set_outputs
93+
run: |
94+
echo "::set-output name=CLI_VERSION::${{ env.CLI_VERSION }}"
95+
7596
- name: Release
76-
uses: softprops/action-gh-release@v1
97+
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v1
7798
with:
7899
tag_name: ${{ env.GH_RELEASE_TAG_NAME }}
79100
generate_release_notes: true
@@ -87,7 +108,7 @@ jobs:
87108
git config --global https.postBuffer 2097152000
88109
89110
- name: Create update site
90-
uses: cpina/github-action-push-to-another-repository@main
111+
uses: cpina/github-action-push-to-another-repository@07c4d7b3def0a8ebe788a8f2c843a4e1de4f6900 #v.1.7.2
91112
env:
92113
API_TOKEN_GITHUB: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
93114
with:
@@ -97,3 +118,16 @@ jobs:
97118
destination-repository-name: 'ast-eclipse-plugin-update-site'
98119
user-email: cylon-bot@checkmarx.com
99120
target-branch: ${{ env.GH_BRANCH_NAME }}
121+
122+
notify:
123+
if: ${{ inputs.rbranch == '' || inputs.rbranch == null }}
124+
needs: release
125+
uses: Checkmarx/plugins-release-workflow/.github/workflows/release-notify.yml@main
126+
with:
127+
product_name: Eclipse
128+
release_version: ${{ needs.release.outputs.TAG_NAME }}
129+
cli_release_version: ${{ needs.release.outputs.CLI_VERSION }}
130+
release_author: "Phoenix Team"
131+
release_url: https://github.com/Checkmarx/ast-eclipse-plugin/releases/tag/${{ needs.release.outputs.TAG_NAME }}
132+
jira_product_name: ECLIPSE
133+
secrets: inherit

.github/workflows/update-cli.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,22 @@ jobs:
3232
echo ${{ steps.ast-cli-java-wrapper.outputs.release_tag }} > ast-cli-java-wrapper.version
3333
current_version=ast-cli-java-wrapper-${{ steps.ast-cli-java-wrapper.outputs.current_tag }}.jar
3434
new_version=ast-cli-java-wrapper-${{ steps.ast-cli-java-wrapper.outputs.release_tag }}.jar
35+
3536
sed -i "s/$current_version/$new_version/g" checkmarx-ast-eclipse-plugin/build.properties
3637
sed -i "s/$current_version/$new_version/g" checkmarx-ast-eclipse-plugin/.classpath
3738
sed -i "s/$current_version/$new_version/g" checkmarx-ast-eclipse-plugin/META-INF/MANIFEST.MF
39+
3840
cd checkmarx-ast-eclipse-plugin/lib/
3941
rm -rf "$current_version"
4042
curl "https://repo1.maven.org/maven2/com/checkmarx/ast/ast-cli-java-wrapper/${{ steps.ast-cli-java-wrapper.outputs.release_tag }}/${new_version}" --output $new_version
4143
44+
ls -la
45+
cd ../..
4246
# Track the new JAR file with LFS
4347
FILE_PATH="checkmarx-ast-eclipse-plugin/lib/$new_version" # Correct path
48+
echo "FILE_PATH: $FILE_PATH"
4449
# Create the directory if it doesn't exist (important!)
45-
mkdir -p "checkmarx-ast-eclipse-plugin/lib"
46-
mv $new_version $FILE_PATH
50+
# mv $new_version $FILE_PATH
4751
# Ensure the file exists after download
4852
if [ ! -f "$FILE_PATH" ]; then
4953
echo "Error: File $FILE_PATH not found after download."

CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
# Each line is a file pattern followed by one or more owners
33

44
# Specify the default owners for the entire repository
5-
* @OrShamirCM @AlvoBen @pedrompflopes
5+
* @greensd4 @AlvoBen @pedrompflopes

0 commit comments

Comments
 (0)