Update checkmarx Java wrapper #1164
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: Update Checkmarx Java Wrapper | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 0 * * *' | |
jobs: | |
update-checkmarx-cli: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/[email protected] | |
with: | |
lfs: true | |
- name: Install Git LFS | |
run: git lfs install | |
- name: Configure Git user | |
run: | | |
git config --global user.name github-actions[bot] | |
git config --global user.email github-actions[bot]@users.noreply.github.com | |
- name: Get Latest Checkmarx Java Wrapper Version | |
id: ast-cli-java-wrapper | |
run: | | |
echo "RELEASE_TAG=$(curl -s "https://repo1.maven.org/maven2/com/checkmarx/ast/ast-cli-java-wrapper/maven-metadata.xml" | grep -oPm1 "(?<=<latest>)[^<]+")" >> $GITHUB_ENV | |
echo "CURRENT_TAG=$(<ast-cli-java-wrapper.version)" >> $GITHUB_ENV | |
- name: Update Checkmarx Java Wrapper Version | |
if: env.CURRENT_TAG != env.RELEASE_TAG | |
run: | | |
# Update current release | |
echo "$RELEASE_TAG" > ast-cli-java-wrapper.version | |
current_version="ast-cli-java-wrapper-${CURRENT_TAG}.jar" | |
new_version="ast-cli-java-wrapper-${RELEASE_TAG}.jar" | |
sed -i "s/$current_version/$new_version/g" checkmarx-ast-eclipse-plugin/build.properties | |
sed -i "s/$current_version/$new_version/g" checkmarx-ast-eclipse-plugin/.classpath | |
sed -i "s/$current_version/$new_version/g" checkmarx-ast-eclipse-plugin/META-INF/MANIFEST.MF | |
cd checkmarx-ast-eclipse-plugin/lib/ | |
rm -rf "$current_version" | |
curl "https://repo1.maven.org/maven2/com/checkmarx/ast/ast-cli-java-wrapper/${RELEASE_TAG}/${new_version}" --output $new_version | |
# Track the new JAR file with LFS | |
FILE_PATH="checkmarx-ast-eclipse-plugin/lib/$new_version" | |
mkdir -p "checkmarx-ast-eclipse-plugin/lib" | |
mv $new_version $FILE_PATH | |
# Ensure the file exists after download | |
if [ ! -f "$FILE_PATH" ]; then | |
echo "Error: File $FILE_PATH not found after download." | |
exit 1 | |
fi | |
git lfs track "$FILE_PATH" | |
git add .gitattributes "$FILE_PATH" | |
git commit -m "Update ast-cli-java-wrapper to $RELEASE_TAG" | |
- name: Create Pull Request | |
if: env.CURRENT_TAG != env.RELEASE_TAG | |
uses: peter-evans/create-pull-request@v6 | |
with: | |
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
commit-message: Update ast-cli-java-wrapper to ${{ env.RELEASE_TAG }} | |
title: elchanan test Update ast-cli-java-wrapper with ${{ env.RELEASE_TAG }} | |
body: | | |
Updates [ast-cli-java-wrapper][1] to ${{ env.RELEASE_TAG }} | |
Auto-generated by [create-pull-request][2] | |
[1]: https://github.com/CheckmarxDev/ast-cli-java-wrapper | |
labels: cxone | |
branch: elchanan/test/dependency/update_java_wrapper |