|
1 |
| -name: maven-build |
| 1 | +name: Build & Deploy |
2 | 2 | on:
|
3 | 3 | push:
|
4 |
| - branches: |
5 |
| - - master |
| 4 | + branches: [master] |
| 5 | + paths-ignore: |
| 6 | + - '**.md' |
| 7 | + - '.gitignore' |
| 8 | + - 'LICENSE' |
6 | 9 | pull_request:
|
7 | 10 | types: [opened, synchronize, reopened]
|
| 11 | + paths-ignore: |
| 12 | + - '**.md' |
| 13 | + - '.gitignore' |
| 14 | + - 'LICENSE' |
| 15 | + |
8 | 16 | jobs:
|
9 | 17 | build:
|
10 |
| - name: Build, analyse, publish |
| 18 | + name: Build, Analyze & Deploy |
11 | 19 | runs-on: ubuntu-latest
|
| 20 | + |
| 21 | + permissions: |
| 22 | + contents: write # for GitHub Pages deployment |
| 23 | + pages: write |
| 24 | + |
| 25 | + concurrency: |
| 26 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 27 | + cancel-in-progress: true |
| 28 | + |
12 | 29 | steps:
|
13 | 30 | - uses: actions/checkout@v4
|
14 | 31 | with:
|
15 |
| - fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis |
| 32 | + fetch-depth: 0 # Required for SonarQube analysis |
| 33 | + |
16 | 34 | - name: Set up JDK 17
|
17 | 35 | uses: actions/setup-java@v4
|
18 | 36 | with:
|
19 | 37 | java-version: 17
|
20 | 38 | distribution: 'temurin'
|
| 39 | + cache: 'maven' # Enables built-in Maven dependency caching |
| 40 | + |
21 | 41 | - name: Cache SonarQube packages
|
22 | 42 | uses: actions/cache@v4
|
23 | 43 | with:
|
24 | 44 | path: ~/.sonar/cache
|
25 |
| - key: ${{ runner.os }}-sonar |
26 |
| - restore-keys: ${{ runner.os }}-sonar |
27 |
| - - name: Cache Maven packages |
28 |
| - uses: actions/cache@v4 |
29 |
| - with: |
30 |
| - path: ~/.m2 |
31 |
| - key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} |
32 |
| - restore-keys: ${{ runner.os }}-m2 |
| 45 | + key: ${{ runner.os }}-sonar-${{ hashFiles('**/pom.xml') }} |
| 46 | + restore-keys: | |
| 47 | + ${{ runner.os }}-sonar- |
| 48 | + |
33 | 49 | - name: Build and analyze
|
34 | 50 | env:
|
| 51 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
35 | 52 | SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
36 |
| - run: mvn -B -Puber-jar verify javadoc:javadoc org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=micycle1_PTS |
37 |
| - - uses: actions/upload-artifact@v4 |
| 53 | + run: | |
| 54 | + mvn -B -Puber-jar verify \ |
| 55 | + javadoc:javadoc \ |
| 56 | + org.sonarsource.scanner.maven:sonar-maven-plugin:sonar \ |
| 57 | + -Dsonar.projectKey=micycle1_PTS \ |
| 58 | + -Dsonar.java.source=17 \ |
| 59 | + -Dmaven.test.failure.ignore=false |
| 60 | + |
| 61 | + - name: Upload JAR artifact |
| 62 | + if: success() && github.event_name == 'push' && github.ref == 'refs/heads/master' |
| 63 | + uses: actions/upload-artifact@v4 |
38 | 64 | with:
|
39 |
| - name: PGS Uber-jar |
| 65 | + name: PGS-uber-jar |
40 | 66 | path: target/*.jar
|
41 |
| - - name: Publish Javadocs |
42 |
| - uses: JamesIves/github-pages-deploy-action@4 |
| 67 | + if-no-files-found: error |
| 68 | + retention-days: 90 |
| 69 | + |
| 70 | + - name: Deploy Javadocs to GitHub Pages |
| 71 | + if: success() && github.event_name == 'push' && github.ref == 'refs/heads/master' |
| 72 | + uses: JamesIves/github-pages-deploy-action@v4 |
43 | 73 | with:
|
44 |
| - branch: gh-pages # The branch the action should deploy to. |
45 |
| - folder: target/reports/apidocs # The folder the action should deploy. |
| 74 | + branch: gh-pages |
| 75 | + folder: target/site/apidocs |
0 commit comments