Skip to content

Commit d086467

Browse files
authored
Merge pull request #3 from dbmdz/release-6-0-0
Fix version numbering; publish to maven central
2 parents def16a6 + 8aee08d commit d086467

File tree

3 files changed

+76
-13
lines changed

3 files changed

+76
-13
lines changed

.github/workflows/ci.yml

Lines changed: 73 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,90 @@ on:
55
branches: [ main ]
66
push:
77
branches: [ main ]
8+
release:
9+
types: [ published ]
810
workflow_dispatch:
911

1012
jobs:
1113
build:
1214
runs-on: ubuntu-latest
13-
strategy:
14-
matrix:
15-
java: [11, 17]
1615
steps:
17-
- uses: actions/checkout@v3
16+
- name: Check out repository
17+
uses: actions/checkout@v4
1818
- name: Set up JDK
19-
uses: actions/setup-java@v3
19+
uses: actions/setup-java@v4
2020
with:
2121
check-latest: true
22-
distribution: adopt
22+
distribution: temurin
2323
java-version: ${{ matrix.java }}
24-
- uses: actions/cache@v3
24+
- name: Set up cache
25+
uses: actions/cache@v4
2526
env:
2627
cache-name: cache-maven-artifacts
2728
with:
28-
path: ~/.m2/repository
29-
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
29+
key: xml-toolbox-cache-java-${{ matrix.java }}-${{ github.run_id }}
30+
path: |
31+
~/.m2/repository
32+
**/target
3033
- name: Build with Maven
31-
run: mvn -B verify
34+
run: mvn -B -U clean verify
35+
strategy:
36+
matrix:
37+
java: [11, 17]
38+
publish:
39+
if: (github.event_name == 'push' && contains(github.ref, 'main')) || github.event_name == 'release'
40+
needs: build
41+
runs-on: ubuntu-latest
42+
steps:
43+
- name: Check out repository
44+
uses: actions/checkout@v4
45+
- name: Set up cache
46+
uses: actions/cache@v4
47+
env:
48+
cache-name: cache-maven-artifacts
49+
with:
50+
key: xml-toolbox-cache-java-${{ matrix.java }}-${{ github.run_id }}
51+
path: |
52+
~/.m2/repository
53+
**/target
54+
- name: Install XML utils
55+
run: sudo apt update && sudo apt install libxml2-utils
56+
- name: Extract project version
57+
run: echo "PROJECT_VERSION=$(xmllint --xpath '/*[local-name()="project"]/*[local-name()="version"]/text()' pom.xml)" >> $GITHUB_ENV
58+
# Publish snapshot
59+
- name: Set up JDK 11 for publishing a snapshot
60+
if: github.event_name == 'push' && endswith(env.PROJECT_VERSION, 'SNAPSHOT')
61+
uses: actions/setup-java@v4
62+
with:
63+
check-latest: true
64+
distribution: temurin
65+
java-version: 11
66+
server-id: central
67+
server-password: MAVEN_PASSWORD
68+
server-username: MAVEN_USERNAME
69+
- name: Publish snapshot to the Maven Central Repository
70+
if: github.event_name == 'push' && endswith(env.PROJECT_VERSION, 'SNAPSHOT')
71+
run: mvn -B deploy -DskipTests
72+
env:
73+
MAVEN_PASSWORD: ${{ secrets.CENTRAL_PASSWORD }}
74+
MAVEN_USERNAME: ${{ secrets.CENTRAL_USERNAME }}
75+
# Publish release
76+
- name: Set up JDK 11 for publishing a release
77+
if: github.event_name == 'release' && !endswith(env.PROJECT_VERSION, 'SNAPSHOT')
78+
uses: actions/setup-java@v4
79+
with:
80+
check-latest: true
81+
distribution: temurin
82+
gpg-passphrase: MAVEN_GPG_PASSPHRASE
83+
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
84+
java-version: 11
85+
server-id: central
86+
server-password: MAVEN_PASSWORD
87+
server-username: MAVEN_USERNAME
88+
- name: Publish release to the Maven Central Repository
89+
if: github.event_name == 'release' && !endswith(env.PROJECT_VERSION, 'SNAPSHOT')
90+
run: mvn -B deploy -DskipTests -Pdeploy
91+
env:
92+
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
93+
MAVEN_PASSWORD: ${{ secrets.CENTRAL_PASSWORD }}
94+
MAVEN_USERNAME: ${{ secrets.CENTRAL_USERNAME }}

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## Unreleased
99

10-
## [5.0.0](https://github.com/dbmdz/xml-toolbox/releases/tag/5.0.0) - 2025-06-12
10+
## [6.0.0](https://github.com/dbmdz/xml-toolbox/releases/tag/6.0.0) - 2025-06-12
1111

1212
### Changed
1313

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<groupId>dev.mdz</groupId>
66
<artifactId>xml-toolbox</artifactId>
7-
<version>5.0.0</version>
7+
<version>6.0.0</version>
88
<packaging>jar</packaging>
99

1010
<name>XML Toolbox</name>
@@ -13,7 +13,7 @@
1313
<licenses>
1414
<license>
1515
<name>MIT License</name>
16-
<url>https://github.com/dbmdz/iiif-apis/blob/master/LICENSE</url>
16+
<url>https://github.com/dbmdz/xml-toolbox/blob/master/LICENSE</url>
1717
<distribution>repo</distribution>
1818
</license>
1919
</licenses>

0 commit comments

Comments
 (0)