chore: [skip publish] Use DHIS2 Bot sonar token #163
This file contains hidden or 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: Pull request | |
| on: | |
| pull_request | |
| jobs: | |
| unit-test: | |
| name: Run Checks | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v5 | |
| with: | |
| java-version: 21 | |
| distribution: temurin | |
| cache: 'gradle' | |
| - name: Change wrapper permission | |
| run: chmod +x ./gradlew | |
| - name: Test | |
| run: ./gradlew clean allTests | |
| - name: API Check | |
| run: ./gradlew apiCheck | |
| - name: Generate Kover reports | |
| run: ./gradlew koverXmlReport | |
| - name: Run SonarCloud Analysis | |
| run: ./gradlew sonar | |
| env: | |
| SONAR_TOKEN: ${{ secrets.DHIS2_BOT_SONARCLOUD_TOKEN }} | |
| GIT_BRANCH: ${{ github.ref_name}} | |
| GIT_BRANCH_DEST: ${{ github.base_ref }} | |
| PULL_REQUEST: ${{ github.event.pull_request.number }} | |
| publish: | |
| name: Publish | |
| needs: unit-test | |
| if: ${{ !contains(github.event.pull_request.title, '[skip publish]') }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v5 | |
| with: | |
| java-version: 21 | |
| distribution: temurin | |
| cache: 'gradle' | |
| - name: Change wrapper permission | |
| run: chmod +x ./gradlew | |
| - name: Publish Maven Snapshot | |
| run: ./gradlew publishToSonatype | |
| env: | |
| SONATYPE_PORTAL_USERNAME: ${{ secrets.SONATYPE_PORTAL_USERNAME }} | |
| SONATYPE_PORTAL_PASSWORD: ${{ secrets.SONATYPE_PORTAL_PASSWORD }} |