👷 ci(build): enhance sonar scanner configuration
Some checks failed
build-and-push / lint (push) Successful in 4s
build-and-push / sonar (push) Failing after 7s
build-and-push / docker (push) Has been skipped

- extract project key from properties file for dynamic setup
- add projectBaseDir to sonar scanner command for accurate analysis
This commit is contained in:
nocci 2025-12-30 12:40:06 +00:00
parent d40a577f47
commit 5b1d966c6e

View file

@ -33,6 +33,7 @@ jobs:
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
PROJECT_KEY=$(grep -E '^sonar.projectKey=' sonar-project.properties | cut -d= -f2 | tr -d '\r')
docker run --rm \
-e SONAR_HOST_URL="$SONAR_HOST_URL" \
-e SONAR_TOKEN="$SONAR_TOKEN" \
@ -41,7 +42,9 @@ jobs:
sonarsource/sonar-scanner-cli \
sonar-scanner \
-Dsonar.host.url="$SONAR_HOST_URL" \
-Dsonar.login="$SONAR_TOKEN"
-Dsonar.token="$SONAR_TOKEN" \
-Dsonar.projectKey="${PROJECT_KEY:-free-games-claimer}" \
-Dsonar.projectBaseDir=/usr/src
docker:
needs: [lint, sonar]