|
1 | | -name: Update Checkmarx AST CLI |
2 | | - |
| 1 | +name: Update checkmarx ast cli |
3 | 2 | on: |
4 | 3 | workflow_dispatch: |
5 | | - inputs: |
6 | | - new_cli_version: |
7 | | - description: 'New CLI version (optional)' |
8 | | - required: false |
9 | 4 | schedule: |
10 | 5 | - cron: '0 0 * * *' |
11 | 6 |
|
12 | 7 | jobs: |
13 | 8 | update-checkmarx-cli: |
14 | 9 | runs-on: ubuntu-latest |
15 | | - |
16 | 10 | steps: |
17 | 11 | - uses: actions/checkout@v4 |
18 | 12 |
|
19 | | - # Fetch the latest Checkmarx AST CLI version |
20 | 13 | - name: Get Latest Checkmarx API version |
21 | 14 | id: checkmarx-ast-cli |
22 | 15 | run: | |
23 | | - if [ "${{ github.event.inputs.new_cli_version }}" ]; then |
24 | | - LATEST_VERSION=${{ github.event.inputs.new_cli_version }} |
25 | | - else |
26 | | - LATEST_VERSION=$(curl -sL https://api.github.com/repos/Checkmarx/ast-cli/releases/latest | jq -r ".tag_name") |
27 | | - fi |
28 | | - CURRENT_VERSION=$(<checkmarx-ast-cli.version) |
29 | | - echo ::set-output name=release_tag::$LATEST_VERSION |
30 | | - echo ::set-output name=current_tag::$CURRENT_VERSION |
| 16 | + echo ::set-output name=release_tag::$(curl -sL https://api.github.com/repos/Checkmarx/ast-cli/releases/latest | jq -r ".tag_name") |
| 17 | + echo ::set-output name=current_tag::$(<checkmarx-ast-cli.version) |
31 | 18 |
|
32 | | - # Update the version file if the latest version differs |
33 | | - - name: Update Checkmarx CLI version in version file |
| 19 | + - name: Update Checkmarx cli version |
34 | 20 | if: steps.checkmarx-ast-cli.outputs.current_tag != steps.checkmarx-ast-cli.outputs.release_tag |
35 | 21 | env: |
36 | 22 | RELEASE_TAG: ${{ steps.checkmarx-ast-cli.outputs.release_tag }} |
37 | 23 | run: | |
| 24 | + # Update current release |
38 | 25 | echo ${{ steps.checkmarx-ast-cli.outputs.release_tag }} > checkmarx-ast-cli.version |
39 | 26 |
|
40 | | - # Update the TypeScript file's cliDefaultVersion field |
41 | | - - name: Update cliDefaultVersion in CxInstaller.ts |
42 | | - if: steps.checkmarx-ast-cli.outputs.current_tag != steps.checkmarx-ast-cli.outputs.release_tag |
43 | | - env: |
44 | | - NEW_CLI_VERSION: ${{ steps.checkmarx-ast-cli.outputs.release_tag }} |
45 | | - run: | |
46 | | - FILE_PATH="src/main/osinstaller/CxInstaller.ts" |
47 | | - # Ensure that 'cliDefaultVersion' is updated correctly |
48 | | - sed -i "s/\(cliDefaultVersion = '\)[^']*\(';\)/\1${NEW_CLI_VERSION}\2/" $FILE_PATH |
49 | | -
|
50 | | - # Create a Pull Request with the version changes |
51 | 27 | - name: Create Pull Request |
52 | 28 | if: steps.checkmarx-ast-cli.outputs.current_tag != steps.checkmarx-ast-cli.outputs.release_tag |
53 | 29 | uses: peter-evans/create-pull-request@c5a7806660adbe173f04e3e038b0ccdcd758773c #v6 |
|
0 commit comments