Skip to content

Commit 4ad3fba

Browse files
committed
publish workflow
1 parent ccea884 commit 4ad3fba

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

.github/workflows/publish.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Publish to GitHub Packages
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
jobs:
9+
publish:
10+
runs-on: ubuntu-latest
11+
12+
permissions:
13+
contents: read
14+
packages: write
15+
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0 # Required for flatten-maven-plugin to work with Git tags
21+
22+
- name: Set up JDK 24 and Maven
23+
uses: actions/setup-java@v4
24+
with:
25+
java-version: "24"
26+
distribution: "temurin"
27+
cache: "maven"
28+
29+
- name: Extract version from Git tag
30+
id: version
31+
run: |
32+
VERSION=${GITHUB_REF#refs/tags/v}
33+
echo "version=$VERSION" >> $GITHUB_OUTPUT
34+
echo "Extracted version: $VERSION"
35+
36+
- name: Update version in pom.xml
37+
run: |
38+
sed -i "s/<version>.*<\/version>/<version>${{ steps.version.outputs.version }}<\/version>/" pom.xml
39+
echo "Updated pom.xml version to ${{ steps.version.outputs.version }}"
40+
41+
- name: Build and Publish
42+
env:
43+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
44+
run: |
45+
mvn clean deploy -DskipTests

0 commit comments

Comments
 (0)