2.2 #480
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 & Deploy | |
| on: | |
| push: | |
| branches: [master] | |
| paths-ignore: | |
| - '**.md' | |
| - '.gitignore' | |
| - 'LICENSE' | |
| pull_request: | |
| types: [opened, synchronize, reopened] | |
| paths-ignore: | |
| - '**.md' | |
| - '.gitignore' | |
| - 'LICENSE' | |
| jobs: | |
| build: | |
| name: Build & Analyze | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| pull-requests: write # for SonarQube PR comments | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # Required for SonarQube analysis | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: 17 | |
| distribution: 'temurin' | |
| cache: 'maven' | |
| - name: Cache SonarQube packages | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.sonar/cache | |
| key: ${{ runner.os }}-sonar-${{ hashFiles('**/pom.xml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-sonar- | |
| - name: Build and analyze | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
| run: | | |
| mvn -B -Puber-jar verify \ | |
| org.sonarsource.scanner.maven:sonar-maven-plugin:sonar \ | |
| -Dsonar.projectKey=micycle1_PTS \ | |
| -Dsonar.java.source=17 \ | |
| -Dmaven.test.failure.ignore=false | |
| - name: Upload JAR artifact | |
| if: success() && github.event_name == 'push' && github.ref == 'refs/heads/master' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: PGS-uber-jar | |
| path: target/*.jar | |
| if-no-files-found: error | |
| retention-days: 90 | |
| - name: Upload Javadocs for deployment | |
| if: success() && github.event_name == 'push' && github.ref == 'refs/heads/master' | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: target/reports/apidocs | |
| deploy: | |
| name: Deploy to GitHub Pages | |
| needs: build | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/master' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| pages: write | |
| id-token: write | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| concurrency: | |
| group: pages | |
| cancel-in-progress: false | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |