Skip to content

Commit 062dd73

Browse files
committed
Merge branch 'master' into update-from-template-merged
2 parents f503c60 + 3476732 commit 062dd73

File tree

17 files changed

+1465
-2
lines changed

17 files changed

+1465
-2
lines changed

.gitattributes

Lines changed: 4 additions & 0 deletions
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+
maven-wrapper.properties text eol=lf

.github/.lycheeignore

Lines changed: 1 addition & 0 deletions
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

Lines changed: 130 additions & 0 deletions
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

Lines changed: 213 additions & 0 deletions
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 "actions@github.com"
61+
git config --global user.name "GitHub Actions"
62+
63+
- name: Un-SNAP
64+
run: ./mvnw -B versions:set -DremoveSnapshot -DprocessAllModules -DgenerateBackupPoms=false
65+
66+
- name: Get version
67+
id: version
68+
run: |
69+
version=$(../mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)
70+
echo "release=$version" >> $GITHUB_OUTPUT
71+
echo "releasenumber=${version//[!0-9]/}" >> $GITHUB_OUTPUT
72+
working-directory: ${{ env.PRIMARY_MAVEN_MODULE }}
73+
74+
- name: Commit and Push
75+
run: |
76+
git add -A
77+
git commit -m "Release ${{ steps.version.outputs.release }}"
78+
git push origin
79+
git tag v${{ steps.version.outputs.release }}
80+
git push origin --tags
81+
82+
- name: Create Release
83+
id: create-release
84+
uses: shogo82148/actions-create-release@4661dc54f7b4b564074e9fbf73884d960de569a3 # v1
85+
with:
86+
tag_name: v${{ steps.version.outputs.release }}
87+
release_name: v${{ steps.version.outputs.release }}
88+
commitish: master
89+
body: |
90+
## [Changelog](https://github.com/${{ github.repository }}/blob/develop/CHANGELOG.md#${{ steps.version.outputs.releasenumber }})
91+
See [Changelog#v${{ steps.version.outputs.release }}](https://github.com/${{ github.repository }}/blob/develop/CHANGELOG.md#${{ steps.version.outputs.releasenumber }}) for more information.
92+
93+
## Installation
94+
Add the following lines to your pom:
95+
```XML
96+
<dependency>
97+
<groupId>software.xdev</groupId>
98+
<artifactId>${{ env.PRIMARY_MAVEN_MODULE }}</artifactId>
99+
<version>${{ steps.version.outputs.release }}</version>
100+
</dependency>
101+
```
102+
103+
publish-maven:
104+
runs-on: ubuntu-latest
105+
needs: [prepare-release]
106+
timeout-minutes: 60
107+
steps:
108+
- uses: actions/checkout@v4
109+
110+
- name: Init Git and pull
111+
run: |
112+
git config --global user.email "actions@github.com"
113+
git config --global user.name "GitHub Actions"
114+
git pull
115+
116+
- name: Set up JDK
117+
uses: actions/setup-java@v4
118+
with: # running setup-java overwrites the settings.xml
119+
distribution: 'temurin'
120+
java-version: '17'
121+
server-id: github-central
122+
server-password: PACKAGES_CENTRAL_TOKEN
123+
gpg-passphrase: MAVEN_GPG_PASSPHRASE
124+
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Only import once
125+
126+
- name: Publish to GitHub Packages Central
127+
run: ../mvnw -B deploy -P publish -DskipTests -DaltDeploymentRepository=github-central::https://maven.pkg.github.com/xdev-software/central
128+
working-directory: ${{ env.PRIMARY_MAVEN_MODULE }}
129+
env:
130+
PACKAGES_CENTRAL_TOKEN: ${{ secrets.PACKAGES_CENTRAL_TOKEN }}
131+
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
132+
133+
- name: Set up JDK
134+
uses: actions/setup-java@v4
135+
with: # running setup-java again overwrites the settings.xml
136+
distribution: 'temurin'
137+
java-version: '17'
138+
server-id: sonatype-central-portal
139+
server-username: MAVEN_CENTRAL_USERNAME
140+
server-password: MAVEN_CENTRAL_TOKEN
141+
gpg-passphrase: MAVEN_GPG_PASSPHRASE
142+
143+
- name: Publish to Central Portal
144+
run: ../mvnw -B deploy -P publish,publish-sonatype-central-portal -DskipTests
145+
env:
146+
MAVEN_CENTRAL_USERNAME: ${{ secrets.SONATYPE_MAVEN_CENTRAL_PORTAL_USERNAME }}
147+
MAVEN_CENTRAL_TOKEN: ${{ secrets.SONATYPE_MAVEN_CENTRAL_PORTAL_TOKEN }}
148+
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
149+
working-directory: ${{ env.PRIMARY_MAVEN_MODULE }}
150+
151+
publish-pages:
152+
runs-on: ubuntu-latest
153+
needs: [prepare-release]
154+
timeout-minutes: 15
155+
steps:
156+
- uses: actions/checkout@v4
157+
158+
- name: Init Git and pull
159+
run: |
160+
git config --global user.email "actions@github.com"
161+
git config --global user.name "GitHub Actions"
162+
git pull
163+
164+
- name: Setup - Java
165+
uses: actions/setup-java@v4
166+
with:
167+
java-version: '17'
168+
distribution: 'temurin'
169+
cache: 'maven'
170+
171+
- name: Build site
172+
run: ../mvnw -B compile site -DskipTests -T2C
173+
working-directory: ${{ env.PRIMARY_MAVEN_MODULE }}
174+
175+
- name: Deploy to Github pages
176+
uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4
177+
with:
178+
github_token: ${{ secrets.GITHUB_TOKEN }}
179+
publish_dir: ./${{ env.PRIMARY_MAVEN_MODULE }}/target/site
180+
force_orphan: true
181+
182+
after-release:
183+
runs-on: ubuntu-latest
184+
needs: [publish-maven]
185+
timeout-minutes: 10
186+
steps:
187+
- uses: actions/checkout@v4
188+
189+
- name: Init Git and pull
190+
run: |
191+
git config --global user.email "actions@github.com"
192+
git config --global user.name "GitHub Actions"
193+
git pull
194+
195+
- name: Inc Version and SNAP
196+
run: ./mvnw -B versions:set -DnextSnapshot -DprocessAllModules -DgenerateBackupPoms=false
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)