|
2 | 2 | name: Deploy Documentation |
3 | 3 |
|
4 | 4 | on: |
5 | | - # Runs on pushes targeting the default branch (publishes to /snapshot/) |
6 | | - push: |
7 | | - branches: ["main"] |
8 | | - paths: |
9 | | - - 'pom.xml' |
10 | | - - 'src/**' |
11 | | - - '.github/**' |
| 5 | + # Runs after Build & Test succeeds on main (publishes to /snapshot/) |
| 6 | + workflow_run: |
| 7 | + workflows: ["Build & Test"] |
| 8 | + types: [completed] |
| 9 | + branches: [main] |
12 | 10 |
|
13 | 11 | # Runs on release publish (publishes to /latest/ and /vX.Y.Z/) |
14 | 12 | release: |
@@ -43,6 +41,8 @@ concurrency: |
43 | 41 |
|
44 | 42 | jobs: |
45 | 43 | build-and-deploy: |
| 44 | + # Skip if triggered by workflow_run that failed |
| 45 | + if: ${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }} |
46 | 46 | runs-on: ubuntu-latest |
47 | 47 | environment: |
48 | 48 | name: github-pages |
@@ -111,11 +111,31 @@ jobs: |
111 | 111 | echo "is_release=false" >> $GITHUB_OUTPUT |
112 | 112 | fi |
113 | 113 |
|
| 114 | + - name: Download JaCoCo exec from Build & Test |
| 115 | + if: steps.tags.outputs.is_release == 'false' && inputs.rebuild_all_versions != true && github.event_name == 'workflow_run' |
| 116 | + uses: actions/download-artifact@v4 |
| 117 | + with: |
| 118 | + name: jacoco-exec |
| 119 | + path: /tmp/jacoco-exec |
| 120 | + run-id: ${{ github.event.workflow_run.id }} |
| 121 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 122 | + continue-on-error: true |
| 123 | + |
114 | 124 | - name: Build snapshot documentation (main branch) |
115 | 125 | if: steps.tags.outputs.is_release == 'false' && inputs.rebuild_all_versions != true |
116 | 126 | run: | |
117 | | - # Run tests with JaCoCo coverage for snapshot builds |
118 | | - ./mvnw clean verify site -Dcheckstyle.skip=true |
| 127 | + # Compile sources (needed for javadoc and other reports) |
| 128 | + ./mvnw clean compile -DskipTests -Dcheckstyle.skip=true |
| 129 | + |
| 130 | + # Restore JaCoCo exec if available from Build & Test |
| 131 | + if [ -f "/tmp/jacoco-exec/sdk-tests.exec" ]; then |
| 132 | + mkdir -p target/jacoco-test-results |
| 133 | + cp /tmp/jacoco-exec/sdk-tests.exec target/jacoco-test-results/ |
| 134 | + echo "JaCoCo exec restored — coverage report will be included" |
| 135 | + fi |
| 136 | + |
| 137 | + # Generate site (JaCoCo report plugin picks up the exec file) |
| 138 | + ./mvnw site -DskipTests -Dcheckstyle.skip=true |
119 | 139 | |
120 | 140 | rm -rf "site/snapshot" |
121 | 141 | mkdir -p "site/snapshot" |
@@ -172,9 +192,9 @@ jobs: |
172 | 192 | |
173 | 193 | done <<< "${{ steps.tags.outputs.all_tags }}" |
174 | 194 | |
175 | | - # Return to main and build snapshot with JaCoCo coverage |
| 195 | + # Return to main and build snapshot |
176 | 196 | git checkout main |
177 | | - ./mvnw clean verify site -Dcheckstyle.skip=true |
| 197 | + ./mvnw clean site -DskipTests -Dcheckstyle.skip=true |
178 | 198 | |
179 | 199 | rm -rf "site/snapshot" |
180 | 200 | mkdir -p "site/snapshot" |
|
0 commit comments