SQSCANGHA-82 Automate the update of the Scanner CLI version

This commit is contained in:
Julien HENRY 2025-02-10 14:44:54 +01:00
parent 73cb22d49a
commit 3ed7560138
2 changed files with 11 additions and 3 deletions

View file

@ -13,7 +13,7 @@ jobs:
pull-requests: write pull-requests: write
steps: steps:
- run: sudo apt install -y jq - run: sudo apt install -y jq
- run: sudo snap install yq
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
ref: master ref: master
@ -31,7 +31,13 @@ jobs:
run: | run: |
./scripts/fetch_latest_version.sh > sonar-scanner-version ./scripts/fetch_latest_version.sh > sonar-scanner-version
cat sonar-scanner-version >> $GITHUB_OUTPUT cat sonar-scanner-version >> $GITHUB_OUTPUT
- name: "Update default version"
if: steps.tagged-version.outputs.sonar-scanner-version != steps.latest-version.outputs.sonar-scanner-version
shell: bash
env:
NEW_VERSION: ${{ steps.latest-version.outputs.sonar-scanner-version }}
run: |
yq -i '.inputs.scannerVersion.default = "${NEW_VERSION}"' action.yml
- name: "Create Pull Request for version update" - name: "Create Pull Request for version update"
if: steps.tagged-version.outputs.sonar-scanner-version != steps.latest-version.outputs.sonar-scanner-version if: steps.tagged-version.outputs.sonar-scanner-version != steps.latest-version.outputs.sonar-scanner-version
shell: bash shell: bash
@ -44,6 +50,7 @@ jobs:
git config --global user.email "sonartech@sonarsource.com" git config --global user.email "sonartech@sonarsource.com"
git checkout -b ${UPDATE_BRANCH} git checkout -b ${UPDATE_BRANCH}
git add sonar-scanner-version git add sonar-scanner-version
git add action.yml
git commit -m "${TITLE}" git commit -m "${TITLE}"
git push --force-with-lease origin ${UPDATE_BRANCH} git push --force-with-lease origin ${UPDATE_BRANCH}
gh pr list gh pr list

View file

@ -16,7 +16,8 @@ inputs:
scannerVersion: scannerVersion:
description: Version of the Sonar Scanner CLI to use description: Version of the Sonar Scanner CLI to use
required: false required: false
default: 6.2.1.4610 # to be kept in sync with sonar-scanner-version # to be kept in sync with sonar-scanner-version
default: 6.2.1.4610
scannerBinariesUrl: scannerBinariesUrl:
description: URL to download the Sonar Scanner CLI binaries from description: URL to download the Sonar Scanner CLI binaries from
required: false required: false