abd3lraouf/Semantic

View on GitHub
.github/workflows/sdk-ci.yml

Summary

Maintainability
Test Coverage
name: "SDK CI"

on:
  push:
    branches:
      - master
      - next
      - next-major
      - beta
      - alpha
  pull_request:
    branches:
      - master
      - next
      - next-major
      - beta
      - alpha

env:
  GRADLE: '7.4.2'
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v3
      with:
        fetch-depth: 0
    - name: Set up JDK 11
      uses: actions/setup-java@v3
      with:
        distribution: 'temurin'
        java-version: 11
        cache: gradle
    - name: Read .nvmrc
      run: echo "##[set-output name=NVMRC;]$(cat .nvmrc)"
      id: nvm
    - name: Set up Node.js
      uses: actions/setup-node@v3
      with:
        node-version: '${{ steps.nvm.outputs.NVMRC }}'
        cache: npm
    - name: Gradle Wrapper Validation
      uses: gradle/wrapper-validation-action@v1
    - name: Build with Gradle
      run: |
        ./gradlew build --no-daemon

    - name: Run Semantic Release
      run: |
        echo "gpr.user=abd3lraouf" >> ~/.gradle/gradle.properties
        echo "gpr.key=${{ secrets.GITHUB_TOKEN }}" >> ~/.gradle/gradle.properties
        rm -rf build/libs/*.jar
        npm ci
        npx semantic-release
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    - name: Run SonarQube Scanner
      run: |
        if [ "$SONAR_LOGIN" != "" ]; then
          ./gradlew sonarqube -Dsonar.login=$SONAR_LOGIN --no-daemon
        fi
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        SONAR_LOGIN: ${{ secrets.SONAR_LOGIN }}
    - uses: actions/upload-artifact@v3
      if: always()
      with:
        name: reports (Gradle ${{ env.GRADLE }})
        path: sdk/build/reports
        if-no-files-found: ignore