Merge branch 'release-25.4' into releases #20
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: build | |
| on: | |
| push: | |
| branches: | |
| - '**' | |
| paths-ignore: | |
| - '**.md' | |
| pull_request: | |
| branches: | |
| - '**' | |
| paths-ignore: | |
| - '**.md' | |
| jobs: | |
| prep: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| version: ${{ steps.init.outputs.version }} | |
| release: ${{ steps.init.outputs.release }} | |
| steps: | |
| - | |
| name: Checkout | |
| uses: actions/checkout@v4 | |
| - | |
| name: Init | |
| id: init | |
| run: | | |
| VERSION=$(grep "version" gradle.properties | cut -d'=' -f2) | |
| echo ::set-output name=version::${VERSION} | |
| if [[ $VERSION =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then | |
| echo ::set-output name=release::true | |
| else | |
| echo ::set-output name=release::false | |
| fi | |
| snapshot: | |
| needs: prep | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| java: | |
| - 17 | |
| steps: | |
| - | |
| name: Checkout | |
| uses: actions/checkout@v4 | |
| - | |
| name: Set up Java ${{ matrix.java }} | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: ${{ matrix.java }} | |
| java-package: jdk | |
| distribution: 'zulu' | |
| - | |
| name: Cache deps | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.gradle/caches | |
| key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }} | |
| restore-keys: | | |
| ${{ runner.os }}-gradle- | |
| - | |
| name: Build | |
| run: | | |
| ./gradlew clean build | |
| - | |
| name: Archive artifact | |
| if: success() && matrix.java == '17' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: snapshot | |
| path: build/libs/*.jar | |
| build-ui: | |
| needs: prep | |
| runs-on: ubuntu-latest | |
| steps: | |
| - | |
| name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| - | |
| name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: 'yarn' | |
| cache-dependency-path: sonarqube-webapp/yarn.lock | |
| - | |
| name: Set up symlink | |
| run: ./sonarqube-webapp-addons/setup.sh | |
| - | |
| name: Install dependencies | |
| working-directory: sonarqube-webapp | |
| run: yarn install --no-immutable | |
| - | |
| name: Build frontend | |
| working-directory: sonarqube-webapp | |
| run: yarn nx run sq-server:build | |
| - | |
| name: Create build artifact | |
| working-directory: sonarqube-webapp/apps/sq-server/build/webapp | |
| run: zip -r ${{ github.workspace }}/sonarqube-webapp.zip ./* | |
| - | |
| name: Archive artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: webapp-build | |
| path: sonarqube-webapp.zip | |
| release: | |
| needs: [prep, build-ui] | |
| if: github.event_name != 'pull_request' && needs.prep.outputs.release == 'true' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - | |
| name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - | |
| name: Set up Java | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: 17 | |
| java-package: jdk | |
| distribution: 'zulu' | |
| - | |
| name: Cache deps | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.gradle/caches | |
| key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }} | |
| restore-keys: | | |
| ${{ runner.os }}-gradle- | |
| - | |
| name: Set up Git | |
| run: | | |
| git config user.name GitHub | |
| git config user.email noreply@github.com | |
| git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - | |
| name: Release | |
| if: success() | |
| run: | | |
| ./gradlew clean release \ | |
| -Prelease.useAutomaticVersion=true \ | |
| -Prelease.releaseVersion=${{ needs.prep.outputs.version }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - | |
| name: Archive artifact | |
| if: success() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: release | |
| path: build/libs/*.jar | |
| - | |
| name: Download frontend artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: webapp-build | |
| path: build/ui | |
| - | |
| name: GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| if: success() | |
| with: | |
| name: ${{ needs.prep.outputs.version }} | |
| tag_name: ${{ needs.prep.outputs.version }} | |
| draft: true | |
| files: | | |
| build/libs/*.jar | |
| build/ui/sonarqube-webapp.zip | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| sonar: | |
| needs: prep | |
| runs-on: ubuntu-latest | |
| steps: | |
| - | |
| name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - | |
| name: Set up Java | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: 17 | |
| java-package: jdk | |
| distribution: 'zulu' | |
| - | |
| name: Cache deps | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.gradle/caches | |
| key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }} | |
| restore-keys: | | |
| ${{ runner.os }}-gradle- | |
| - | |
| name: Test and Sonar | |
| if: ${{ env.SONAR_TOKEN != null }} | |
| run: | | |
| if [ "${{ github.event_name }}" = "pull_request" ]; then | |
| ./gradlew test sonar \ | |
| -Dsonar.gradle.skipCompile=true \ | |
| -Dsonar.pullrequest.provider=github \ | |
| -Dsonar.pullrequest.github.repository=${{ github.repository }} \ | |
| -Dsonar.host.url=https://sonarcloud.io \ | |
| -Dsonar.organization=${SONAR_ORG_KEY} \ | |
| -Dsonar.projectKey=${SONAR_PROJECT_KEY} \ | |
| -Dsonar.pullrequest.key=${{ github.event.number }} \ | |
| -Dsonar.pullrequest.base=${{ github.base_ref }} | |
| elif [ "${{ needs.prep.outputs.release }}" = 'true' ]; then | |
| ./gradlew test sonar \ | |
| -Dsonar.gradle.skipCompile=true \ | |
| -Dsonar.pullrequest.provider=github \ | |
| -Dsonar.pullrequest.github.repository=${{ github.repository }} \ | |
| -Dsonar.host.url=https://sonarcloud.io \ | |
| -Dsonar.organization=${SONAR_ORG_KEY} \ | |
| -Dsonar.projectKey=${SONAR_PROJECT_KEY} \ | |
| -Dsonar.projectVersion=${{ needs.prep.outputs.version }} | |
| else | |
| ./gradlew test sonar \ | |
| -Dsonar.gradle.skipCompile=true \ | |
| -Dsonar.pullrequest.provider=github \ | |
| -Dsonar.pullrequest.github.repository=${{ github.repository }} \ | |
| -Dsonar.host.url=https://sonarcloud.io \ | |
| -Dsonar.organization=${SONAR_ORG_KEY} \ | |
| -Dsonar.projectKey=${SONAR_PROJECT_KEY} \ | |
| -Dsonar.branch.name=${GITHUB_REF##*/} | |
| fi | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
| SONAR_ORG_KEY: ${{ secrets.SONAR_ORG_KEY }} | |
| SONAR_PROJECT_KEY: ${{ secrets.SONAR_PROJECT_KEY }} |