Skip to content

Commit

Permalink
ci: refactor how Sonar Cloud gets the project's version
Browse files Browse the repository at this point in the history
  • Loading branch information
fschuch committed May 27, 2024
1 parent f16d08b commit a39fcd5
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,17 @@ jobs:
with:
pattern: coverage-*
merge-multiple: true
- name: Set project version
- uses: actions/setup-python@v5
if: startsWith(github.ref, 'refs/tags/')
with:
python-version: "3.12"
cache: "pip"
- name: Set Version
if: startsWith(github.ref, 'refs/tags/')
run: |
REF=${{ github.ref }}
if [[ "${{ github.ref_type }}" == "tag" ]]; then
TAG_NAME=${REF#refs/tags/}
echo "sonar.projectVersion=$TAG_NAME" >> sonar-project.properties
fi
python -m pip install hatch
VERSION=$(hatch version)
echo "sonar.projectVersion=$VERSION" >> sonar-project.properties
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
Expand Down

0 comments on commit a39fcd5

Please sign in to comment.