Skip to content

Commit 530ed04

Browse files
committed
Merge branch 'master' into update-from-template-merged
2 parents 8f154b7 + f1d643f commit 530ed04

18 files changed

+1588
-2
lines changed

.gitattributes

+4
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,7 @@
33

44
# Force sh files to have LF
55
*.sh text eol=lf
6+
7+
# Force MVN Wrapper Linux files LF
8+
mvnw text eol=lf
9+
.mvn/wrapper/maven-wrapper.properties text eol=lf

.github/.lycheeignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
# Ignorefile for broken link check
22
localhost
3+
mvnrepository.com

.github/workflows/check-build.yml

+130
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
name: Check Build
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches: [ develop ]
7+
paths-ignore:
8+
- '**.md'
9+
- '.config/**'
10+
- '.github/**'
11+
- '.idea/**'
12+
- 'assets/**'
13+
pull_request:
14+
branches: [ develop ]
15+
paths-ignore:
16+
- '**.md'
17+
- '.config/**'
18+
- '.github/**'
19+
- '.idea/**'
20+
- 'assets/**'
21+
22+
env:
23+
PRIMARY_MAVEN_MODULE: ${{ github.event.repository.name }}
24+
DEMO_MAVEN_MODULE: ${{ github.event.repository.name }}-demo
25+
26+
jobs:
27+
build:
28+
runs-on: ubuntu-latest
29+
timeout-minutes: 30
30+
31+
strategy:
32+
matrix:
33+
java: [17, 21]
34+
distribution: [temurin]
35+
36+
steps:
37+
- uses: actions/checkout@v4
38+
39+
- name: Set up JDK
40+
uses: actions/setup-java@v4
41+
with:
42+
distribution: ${{ matrix.distribution }}
43+
java-version: ${{ matrix.java }}
44+
cache: 'maven'
45+
46+
- name: Build with Maven
47+
run: ./mvnw -B clean package
48+
49+
- name: Check for uncommited changes
50+
run: |
51+
if [[ "$(git status --porcelain)" != "" ]]; then
52+
echo ----------------------------------------
53+
echo git status
54+
echo ----------------------------------------
55+
git status
56+
echo ----------------------------------------
57+
echo git diff
58+
echo ----------------------------------------
59+
git diff
60+
echo ----------------------------------------
61+
echo Troubleshooting
62+
echo ----------------------------------------
63+
echo "::error::Unstaged changes detected. Locally try running: git clean -ffdx && ./mvnw -B clean package"
64+
exit 1
65+
fi
66+
67+
- name: Upload demo files
68+
uses: actions/upload-artifact@v4
69+
with:
70+
name: demo-files-java-${{ matrix.java }}
71+
path: ${{ env.DEMO_MAVEN_MODULE }}/target/${{ env.DEMO_MAVEN_MODULE }}.jar
72+
if-no-files-found: error
73+
74+
checkstyle:
75+
runs-on: ubuntu-latest
76+
if: ${{ github.event_name != 'pull_request' || !startsWith(github.head_ref, 'renovate/') }}
77+
timeout-minutes: 15
78+
79+
strategy:
80+
matrix:
81+
java: [17]
82+
distribution: [temurin]
83+
84+
steps:
85+
- uses: actions/checkout@v4
86+
87+
- name: Set up JDK
88+
uses: actions/setup-java@v4
89+
with:
90+
distribution: ${{ matrix.distribution }}
91+
java-version: ${{ matrix.java }}
92+
cache: 'maven'
93+
94+
- name: Run Checkstyle
95+
run: ./mvnw -B checkstyle:check -P checkstyle -T2C
96+
97+
pmd:
98+
runs-on: ubuntu-latest
99+
if: ${{ github.event_name != 'pull_request' || !startsWith(github.head_ref, 'renovate/') }}
100+
timeout-minutes: 15
101+
102+
strategy:
103+
matrix:
104+
java: [17]
105+
distribution: [temurin]
106+
107+
steps:
108+
- uses: actions/checkout@v4
109+
110+
- name: Set up JDK
111+
uses: actions/setup-java@v4
112+
with:
113+
distribution: ${{ matrix.distribution }}
114+
java-version: ${{ matrix.java }}
115+
cache: 'maven'
116+
117+
- name: Run PMD
118+
run: ./mvnw -B test pmd:aggregate-pmd-no-fork pmd:check -P pmd -DskipTests -T2C
119+
120+
- name: Run CPD (Copy Paste Detector)
121+
run: ./mvnw -B pmd:aggregate-cpd pmd:cpd-check -P pmd -DskipTests -T2C
122+
123+
- name: Upload report
124+
if: always()
125+
uses: actions/upload-artifact@v4
126+
with:
127+
name: pmd-report
128+
if-no-files-found: ignore
129+
path: |
130+
target/reports/**

.github/workflows/release.yml

+213
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,213 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
7+
env:
8+
PRIMARY_MAVEN_MODULE: ${{ github.event.repository.name }}
9+
10+
permissions:
11+
contents: write
12+
pull-requests: write
13+
14+
jobs:
15+
check-code:
16+
runs-on: ubuntu-latest
17+
timeout-minutes: 30
18+
steps:
19+
- uses: actions/checkout@v4
20+
21+
- name: Set up JDK
22+
uses: actions/setup-java@v4
23+
with:
24+
java-version: '17'
25+
distribution: 'temurin'
26+
cache: 'maven'
27+
28+
- name: Build with Maven
29+
run: ./mvnw -B clean package -T2C
30+
31+
- name: Check for uncommited changes
32+
run: |
33+
if [[ "$(git status --porcelain)" != "" ]]; then
34+
echo ----------------------------------------
35+
echo git status
36+
echo ----------------------------------------
37+
git status
38+
echo ----------------------------------------
39+
echo git diff
40+
echo ----------------------------------------
41+
git diff
42+
echo ----------------------------------------
43+
echo Troubleshooting
44+
echo ----------------------------------------
45+
echo "::error::Unstaged changes detected. Locally try running: git clean -ffdx && ./mvnw -B clean package"
46+
exit 1
47+
fi
48+
49+
prepare-release:
50+
runs-on: ubuntu-latest
51+
needs: [check-code]
52+
timeout-minutes: 10
53+
outputs:
54+
upload_url: ${{ steps.create_release.outputs.upload_url }}
55+
steps:
56+
- uses: actions/checkout@v4
57+
58+
- name: Configure Git
59+
run: |
60+
git config --global user.email "[email protected]"
61+
git config --global user.name "GitHub Actions"
62+
63+
- name: Un-SNAP
64+
run: |
65+
mvnwPath=$(readlink -f ./mvnw)
66+
modules=("") # root
67+
modules+=($(grep -oP '(?<=<module>)[^<]+' 'pom.xml'))
68+
for i in "${modules[@]}"
69+
do
70+
echo "Processing $i/pom.xml"
71+
(cd "$i" && $mvnwPath -B versions:set -DremoveSnapshot -DgenerateBackupPoms=false)
72+
done
73+
74+
- name: Get version
75+
id: version
76+
run: |
77+
version=$(../mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)
78+
echo "release=$version" >> $GITHUB_OUTPUT
79+
echo "releasenumber=${version//[!0-9]/}" >> $GITHUB_OUTPUT
80+
working-directory: ${{ env.PRIMARY_MAVEN_MODULE }}
81+
82+
- name: Commit and Push
83+
run: |
84+
git add -A
85+
git commit -m "Release ${{ steps.version.outputs.release }}"
86+
git push origin
87+
git tag v${{ steps.version.outputs.release }}
88+
git push origin --tags
89+
90+
- name: Create Release
91+
id: create_release
92+
uses: shogo82148/actions-create-release@v1
93+
with:
94+
tag_name: v${{ steps.version.outputs.release }}
95+
release_name: v${{ steps.version.outputs.release }}
96+
commitish: master
97+
body: |
98+
## [Changelog](https://github.com/${{ github.repository }}/blob/develop/CHANGELOG.md#${{ steps.version.outputs.releasenumber }})
99+
See [Changelog#v${{ steps.version.outputs.release }}](https://github.com/${{ github.repository }}/blob/develop/CHANGELOG.md#${{ steps.version.outputs.releasenumber }}) for more information.
100+
101+
## Installation
102+
Add the following lines to your pom:
103+
```XML
104+
<dependency>
105+
<groupId>software.xdev</groupId>
106+
<artifactId>${{ env.PRIMARY_MAVEN_MODULE }}</artifactId>
107+
<version>${{ steps.version.outputs.release }}</version>
108+
</dependency>
109+
```
110+
111+
publish-maven:
112+
runs-on: ubuntu-latest
113+
needs: [prepare-release]
114+
timeout-minutes: 60
115+
steps:
116+
- uses: actions/checkout@v4
117+
118+
- name: Init Git and pull
119+
run: |
120+
git config --global user.email "[email protected]"
121+
git config --global user.name "GitHub Actions"
122+
git pull
123+
124+
- name: Set up JDK OSSRH
125+
uses: actions/setup-java@v4
126+
with: # running setup-java again overwrites the settings.xml
127+
java-version: '17'
128+
distribution: 'temurin'
129+
server-id: ossrh
130+
server-username: MAVEN_CENTRAL_USERNAME
131+
server-password: MAVEN_CENTRAL_TOKEN
132+
gpg-passphrase: MAVEN_GPG_PASSPHRASE
133+
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
134+
135+
- name: Publish to OSSRH
136+
run: ../mvnw -B deploy -Possrh -DskipTests
137+
env:
138+
MAVEN_CENTRAL_USERNAME: ${{ secrets.S01_OSS_SONATYPE_MAVEN_USERNAME }}
139+
MAVEN_CENTRAL_TOKEN: ${{ secrets.S01_OSS_SONATYPE_MAVEN_TOKEN }}
140+
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
141+
working-directory: ${{ env.PRIMARY_MAVEN_MODULE }}
142+
143+
publish-pages:
144+
runs-on: ubuntu-latest
145+
needs: [prepare-release]
146+
timeout-minutes: 15
147+
steps:
148+
- uses: actions/checkout@v4
149+
150+
- name: Init Git and pull
151+
run: |
152+
git config --global user.email "[email protected]"
153+
git config --global user.name "GitHub Actions"
154+
git pull
155+
156+
- name: Setup - Java
157+
uses: actions/setup-java@v4
158+
with:
159+
java-version: '17'
160+
distribution: 'temurin'
161+
cache: 'maven'
162+
163+
- name: Build site
164+
run: ../mvnw -B compile site -DskipTests -T2C
165+
working-directory: ${{ env.PRIMARY_MAVEN_MODULE }}
166+
167+
- name: Deploy to Github pages
168+
uses: peaceiris/actions-gh-pages@v4
169+
with:
170+
github_token: ${{ secrets.GITHUB_TOKEN }}
171+
publish_dir: ./${{ env.PRIMARY_MAVEN_MODULE }}/target/site
172+
force_orphan: true
173+
174+
after-release:
175+
runs-on: ubuntu-latest
176+
needs: [publish-maven]
177+
timeout-minutes: 10
178+
steps:
179+
- uses: actions/checkout@v4
180+
181+
- name: Init Git and pull
182+
run: |
183+
git config --global user.email "[email protected]"
184+
git config --global user.name "GitHub Actions"
185+
git pull
186+
187+
- name: Inc Version and SNAP
188+
run: |
189+
mvnwPath=$(readlink -f ./mvnw)
190+
modules=("") # root
191+
modules+=($(grep -oP '(?<=<module>)[^<]+' 'pom.xml'))
192+
for i in "${modules[@]}"
193+
do
194+
echo "Processing $i/pom.xml"
195+
(cd "$i" && $mvnwPath -B build-helper:parse-version versions:set -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.nextIncrementalVersion} -DgenerateBackupPoms=false -DnextSnapshot=true -DupdateMatchingVersions=false)
196+
done
197+
198+
- name: Git Commit and Push
199+
run: |
200+
git add -A
201+
git commit -m "Preparing for next development iteration"
202+
git push origin
203+
204+
- name: pull-request
205+
env:
206+
GH_TOKEN: ${{ github.token }}
207+
run: |
208+
gh_pr_up() {
209+
gh pr create "$@" || gh pr edit "$@"
210+
}
211+
gh_pr_up -B "develop" \
212+
--title "Sync back" \
213+
--body "An automated PR to sync changes back"

0 commit comments

Comments
 (0)