44 push :
55 branches : [ master ]
66
7- env :
8- PRIMARY_MAVEN_MODULE : ${{ github.event.repository.name }}
9-
10- permissions :
11- contents : write
12- pull-requests : write
13-
147# DO NOT RESTORE CACHE for critical release steps to prevent a (extremely unlikely) scenario
158# where a supply chain attack could be achieved due to poisoned cache
169jobs :
3730 ${{ runner.os }}-mvn-build-
3831
3932 - name : Build with Maven
40- run : ./mvnw -B clean package -T2C
33+ run : ../mvnw -B clean package -T2C
34+ working-directory : src
4135
4236 - name : Check for uncommited changes
4337 run : |
6155 runs-on : ubuntu-latest
6256 needs : [check-code]
6357 timeout-minutes : 10
58+ permissions :
59+ contents : write
6460 outputs :
6561 upload_url : ${{ steps.create-release.outputs.upload_url }}
6662 steps :
7773 - name : Get version
7874 id : version
7975 run : |
80- version=$(.. /mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)
76+ version=$(./mvnw -B help:evaluate -Dexpression=project.version -q -DforceStdout)
8177 echo "release=$version" >> $GITHUB_OUTPUT
8278 echo "releasenumber=${version//[!0-9]/}" >> $GITHUB_OUTPUT
83- working-directory : ${{ env.PRIMARY_MAVEN_MODULE }}
8479
8580 - name : Commit and Push
8681 run : |
9287
9388 - name : Create Release
9489 id : create-release
95- uses : shogo82148/actions-create-release@8674c0ecee617c8dfb006526bcc22a362c70b88a # v1
90+ uses : shogo82148/actions-create-release@cfc5a8374495dd25fe96f758cc09251ab6286911 # v1
9691 with :
9792 tag_name : v${{ steps.version.outputs.release }}
9893 release_name : v${{ steps.version.outputs.release }}
@@ -106,7 +101,7 @@ jobs:
106101 ```XML
107102 <dependency>
108103 <groupId>software.xdev</groupId>
109- <artifactId>${{ env.PRIMARY_MAVEN_MODULE }}</artifactId>
104+ <artifactId>${{ github.event.repository.name }}</artifactId>
110105 <version>${{ steps.version.outputs.release }}</version>
111106 </dependency>
112107 ```
@@ -130,13 +125,13 @@ jobs:
130125 distribution : ' temurin'
131126 java-version : ' 17'
132127 server-id : github-central
133- server-password : PACKAGES_CENTRAL_TOKEN
134- gpg-passphrase : MAVEN_GPG_PASSPHRASE
128+ server-password-env-var : PACKAGES_CENTRAL_TOKEN
129+ gpg-passphrase-env-var : MAVEN_GPG_PASSPHRASE
135130 gpg-private-key : ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Only import once
136131
137132 - name : Publish to GitHub Packages Central
138- run : ../mvnw -B deploy -P publish -DskipTests - DaltDeploymentRepository=github-central::https://maven.pkg.github.com/xdev-software/central
139- working-directory : ${{ env.PRIMARY_MAVEN_MODULE }}
133+ run : ../mvnw -B deploy -P publish -DaltDeploymentRepository=github-central::https://maven.pkg.github.com/xdev-software/central
134+ working-directory : src
140135 env :
141136 PACKAGES_CENTRAL_TOKEN : ${{ secrets.PACKAGES_CENTRAL_TOKEN }}
142137 MAVEN_GPG_PASSPHRASE : ${{ secrets.MAVEN_GPG_PASSPHRASE }}
@@ -147,19 +142,19 @@ jobs:
147142 distribution : ' temurin'
148143 java-version : ' 17'
149144 server-id : sonatype-central-portal
150- server-username : MAVEN_CENTRAL_USERNAME
151- server-password : MAVEN_CENTRAL_TOKEN
152- gpg-passphrase : MAVEN_GPG_PASSPHRASE
145+ server-username-env-var : MAVEN_CENTRAL_USERNAME
146+ server-password-env-var : MAVEN_CENTRAL_TOKEN
147+ gpg-passphrase-env-var : MAVEN_GPG_PASSPHRASE
153148
154149 - name : Publish to Central Portal
155- run : ../mvnw -B deploy -P publish,publish-sonatype-central-portal -DskipTests
150+ run : ../mvnw -B deploy -P publish,publish-sonatype-central-portal
151+ working-directory : src
156152 env :
157153 MAVEN_CENTRAL_USERNAME : ${{ secrets.SONATYPE_MAVEN_CENTRAL_PORTAL_USERNAME }}
158154 MAVEN_CENTRAL_TOKEN : ${{ secrets.SONATYPE_MAVEN_CENTRAL_PORTAL_TOKEN }}
159155 MAVEN_GPG_PASSPHRASE : ${{ secrets.MAVEN_GPG_PASSPHRASE }}
160- working-directory : ${{ env.PRIMARY_MAVEN_MODULE }}
161156
162- publish -pages :
157+ build -pages :
163158 runs-on : ubuntu-latest
164159 needs : [prepare-release]
165160 timeout-minutes : 15
@@ -188,20 +183,69 @@ jobs:
188183 ${{ runner.os }}-mvn-build-
189184
190185 - name : Build site
191- run : ../mvnw -B compile site -DskipTests -T2C
192- working-directory : ${{ env.PRIMARY_MAVEN_MODULE }}
186+ run : ../mvnw -B compile site -P site -T2C
187+ working-directory : src
188+
189+ - name : Aggregate site
190+ run : |
191+ # Compile is required, otherwise dep resolution failure
192+ echo "Looking up modules"
193+ module_dirs=($(../mvnw -B -q --also-make compile exec:exec -P site -Dexec.executable="pwd" -Dmaven.main.skip))
194+ base_module_full="${module_dirs[0]}"
195+
196+ echo "Found modules - Src: $base_module_full"
197+
198+ base_cut_away_length=$((${#base_module_full}+1))
199+
200+ echo "BasePathLengthToCutAway: $base_cut_away_length"
193201
194- - name : Deploy to Github pages
195- uses : peaceiris/actions-gh-pages@84c30a85c19949d7eee79c4ff27748b70285e453 # v4
202+ is_first=true
203+ for full_module_path in "${module_dirs[@]}"
204+ do
205+ if [ $is_first = true ]; then
206+ echo "Skipping initial/base module"
207+ is_first=false
208+ continue
209+ fi
210+
211+ m=${full_module_path:$base_cut_away_length}
212+
213+ echo "$m/target/site/. -> ./target/site/$m"
214+ mkdir -p ./target/site/$m
215+ cp -r $m/target/site/. ./target/site/$m
216+ done
217+ working-directory : src
218+
219+ - name : Upload pages artifact
220+ uses : actions/upload-pages-artifact@v5
196221 with :
197- github_token : ${{ secrets.GITHUB_TOKEN }}
198- publish_dir : ./${{ env.PRIMARY_MAVEN_MODULE }}/target/site
199- force_orphan : true
222+ path : src/target/site
223+
224+ deploy-pages :
225+ runs-on : ubuntu-latest
226+ needs : [build-pages]
227+ timeout-minutes : 10
228+ concurrency :
229+ group : ' pages'
230+ cancel-in-progress : false
231+ permissions :
232+ pages : write
233+ id-token : write
234+ environment :
235+ name : github-pages
236+ url : ${{ steps.deployment.outputs.page_url }}
237+ steps :
238+ - name : Deploy to GitHub Pages
239+ id : deployment
240+ uses : actions/deploy-pages@v5
200241
201242 after-release :
202243 runs-on : ubuntu-latest
203244 needs : [publish-maven]
204245 timeout-minutes : 10
246+ permissions :
247+ contents : write
248+ pull-requests : write
205249 steps :
206250 - uses : actions/checkout@v7
207251
0 commit comments