From 03302514f280241d5e9a393136b8e161feb511c0 Mon Sep 17 00:00:00 2001 From: Paul Bui-Quang Date: Thu, 5 Dec 2024 12:42:59 +0100 Subject: [PATCH] ci: update sonar job --- .github/workflows/main.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6f364e1af..a5e3c3cb9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -11,7 +11,7 @@ jobs: test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis @@ -25,11 +25,18 @@ jobs: run: npm run lint && npx tsc --noEmit - name: Test run: npm run coverage + - name: Retrieve version + run: | + VERSION=$(cat package.json | grep version | head -1 | awk -F= "{ print $2 }" | sed 's/"version"://g' | sed 's/[",]//g' | tr -d '[[:space:]]') + echo "VERSION=$VERSION" >> $GITHUB_ENV - name: SonarCloud Scan uses: SonarSource/sonarcloud-github-action@master env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + with: + args: > + -Dsonar.projectVersion=${{ env.VERSION }} publish: if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')