Skip to content
This repository was archived by the owner on Jan 18, 2024. It is now read-only.

Commit 0bfb13a

Browse files
authored
Merge pull request #1 from xdev-software/update-from-template
Update from template
2 parents bfe131a + c578e1a commit 0bfb13a

27 files changed

+1277
-377
lines changed

.github/dependabot.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: github-actions
4+
directory: "/"
5+
schedule:
6+
interval: daily
7+
# Run it at a specific time so that we don't get emails all day long
8+
time: "00:00"
9+
open-pull-requests-limit: 10
10+
ignore:
11+
- dependency-name: "*"
12+
# GitHub actions are using git tags (v1 = v1.2 = v1.2.3) which should be compatible until a major change is performed
13+
update-types:
14+
- "version-update:semver-minor"
15+
- "version-update:semver-patch"
16+
- package-ecosystem: maven
17+
directory: "/"
18+
schedule:
19+
interval: daily
20+
# Run it at a specific time so that we don't get emails all day long
21+
time: "00:00"
22+
open-pull-requests-limit: 10

.github/workflows/checkBuild.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Check Build
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches: [ develop ]
7+
paths-ignore:
8+
- '**.md'
9+
pull_request:
10+
branches: [ develop ]
11+
paths-ignore:
12+
- '**.md'
13+
14+
jobs:
15+
build:
16+
runs-on: ubuntu-latest
17+
18+
strategy:
19+
matrix:
20+
java: [8, 11, 17]
21+
java-package: [jdk]
22+
distribution: [temurin]
23+
24+
steps:
25+
- uses: actions/checkout@v3
26+
27+
- name: Set up JDK
28+
uses: actions/setup-java@v3
29+
with:
30+
distribution: ${{ matrix.distribution }}
31+
java-version: ${{ matrix.java }}
32+
java-package: ${{ matrix.java-package }}
33+
cache: 'maven'
34+
35+
- name: Build with Maven
36+
run: mvn -B clean verify
37+
38+
- name: Check for uncommited changes
39+
run: |
40+
if [[ "$(git status --porcelain)" != "" ]]; then
41+
echo ----------------------------------------
42+
echo git status
43+
echo ----------------------------------------
44+
git status
45+
echo ----------------------------------------
46+
echo git diff
47+
echo ----------------------------------------
48+
git diff
49+
echo ----------------------------------------
50+
echo Troubleshooting
51+
echo ----------------------------------------
52+
echo "::error::Unstaged changes detected. Locally try running: git clean -ffdx && mvn -B clean verify"
53+
exit 1
54+
fi
55+
56+
- uses: actions/upload-artifact@v3
57+
with:
58+
name: jars-java-${{ matrix.java }}
59+
path: target/*.jar
60+
if-no-files-found: error

.github/workflows/release.yml

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

.github/workflows/test-deploy.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Test Deployment CI
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
publish_central: # Publish the code to central
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v3
11+
12+
- name: Set up JDK OSSRH
13+
uses: actions/setup-java@v3
14+
with: # running setup-java again overwrites the settings.xml
15+
distribution: 'temurin'
16+
java-version: '8'
17+
server-id: ossrh
18+
server-username: MAVEN_CENTRAL_USERNAME
19+
server-password: MAVEN_CENTRAL_TOKEN
20+
gpg-passphrase: MAVEN_GPG_PASSPHRASE
21+
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
22+
23+
- name: Publish to OSSRH
24+
run: mvn -B deploy -Possrh
25+
env:
26+
MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
27+
MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }}
28+
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}

0 commit comments

Comments
 (0)