Update update-cli.yml add lfs #1127
Workflow file for this run
This file contains hidden or 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 * * *' | |
| pull_request: | |
| paths: | |
| - .github/workflows/update-cli.yml | |
| jobs: | |
| update-checkmarx-cli: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4.1.7 | |
| with: | |
| lfs: true | |
| - name: Install Git LFS | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install git-lfs | |
| git lfs install | |
| - name: Get Latest Checkmarx Java wrapper version | |
| id: ast-cli-java-wrapper | |
| run: | | |
| echo ::set-output name=release_tag::$(curl -s "https://repo1.maven.org/maven2/com/checkmarx/ast/ast-cli-java-wrapper/maven-metadata.xml" | grep -oPm1 "(?<=<latest>)[^<]+") | |
| echo ::set-output name=current_tag::$(<ast-cli-java-wrapper.version) | |
| - name: Update Checkmarx Java wrapper version | |
| if: steps.ast-cli-java-wrapper.outputs.current_tag != steps.ast-cli-java-wrapper.outputs.release_tag | |
| run: | | |
| # Update current release | |
| echo ${{ steps.ast-cli-java-wrapper.outputs.release_tag }} > ast-cli-java-wrapper.version | |
| current_version=ast-cli-java-wrapper-${{ steps.ast-cli-java-wrapper.outputs.current_tag }}.jar | |
| new_version=ast-cli-java-wrapper-${{ steps.ast-cli-java-wrapper.outputs.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/${{ steps.ast-cli-java-wrapper.outputs.release_tag }}/${new_version}" --output $new_version | |
| # Track the new JAR file with LFS | |
| git lfs track "checkmarx-ast-eclipse-plugin/lib/$new_version" | |
| git add .gitattributes | |
| git commit -m "Track new JAR file with Git LFS" | |
| git push origin HEAD:${{ github.ref }} # Push .gitattributes | |
| - name: Create Pull Request | |
| if: steps.ast-cli-java-wrapper.outputs.current_tag != steps.ast-cli-java-wrapper.outputs.release_tag | |
| uses: peter-evans/create-pull-request@v5 | |
| with: | |
| token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
| commit-message: Update ast-cli-java-wrapper to ${{ steps.ast-cli-java-wrapper.outputs.release_tag }} | |
| title: Update ast-cli-java-wrapper with ${{ steps.ast-cli-java-wrapper.outputs.release_tag }} | |
| body: | | |
| Updates [ast-cli-java-wrapper][1] to ${{ steps.ast-cli-java-wrapper.outputs.release_tag }} | |
| Auto-generated by [create-pull-request][2] | |
| [1]: https://github.com/CheckmarxDev/ast-cli-java-wrapper | |
| labels: cxone | |
| branch: dependency/update_java_wrapper | |
| - name: Push updated files (including LFS file) | |
| if: steps.ast-cli-java-wrapper.outputs.current_tag != steps.ast-cli-java-wrapper.outputs.release_tag | |
| run: | | |
| git config --global user.name "github-actions[bot]" | |
| git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
| git add . | |
| git commit -m "Updated ast-cli-java-wrapper and related files" | |
| git push origin HEAD:${{ github.ref }} |