Update and rename build.yml to sonarqube-scanner.yml #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI/CD workflow for Maven Build and Sonar Code scan | |
on: | |
push: | |
branches: | |
- master | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up JDK 20 | |
uses: actions/setup-java@v2 | |
with: | |
distribution: 'adopt' | |
java-version: '17' | |
- name: Build with Maven | |
run: mvn clean install -f pom.xml | |
- name: SonarQube Scan | |
uses: sonarsource/sonarqube-scan-action@master | |
with: | |
projectBaseDir: . | |
args: > | |
-Dsonar.organization=my-org | |
-Dsonar.projectKey=psyenduck_jenkins_bb884f99-57a6-45b3-bb59-0a99eca0871b | |
env: | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} |