Skip to content

Commit 1dad6ff

Browse files
committed
feat: prepare for automatic releasing
1 parent 8aca3c0 commit 1dad6ff

File tree

10 files changed

+123
-6
lines changed

10 files changed

+123
-6
lines changed

.github/workflows/release.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
on:
2+
push:
3+
tags:
4+
- 'v*'
5+
6+
jobs:
7+
build-and-release:
8+
runs-on: ubuntu-latest
9+
permissions:
10+
contents: write
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v4
15+
16+
- name: Make build script executable
17+
run: chmod +x ./build.sh
18+
19+
- name: Run build script
20+
run: ./build.sh
21+
22+
- name: Create Release
23+
id: create_release
24+
uses: softprops/action-gh-release@v1
25+
with:
26+
files: ./target/hawk-auth-server-extension.jar
27+
name: Release ${{ github.ref_name }}
28+
draft: false
29+
prerelease: false
30+
token: ${{ secrets.GITHUB_TOKEN }}
31+
generate_release_notes: true

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,3 @@
1010

1111
.maven/*
1212
target/*
13-
!target/hawk-auth-server-extension.jar
14-
!target/hawk-auth-server-extension-sources.jar

LICENSE

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Copyright 2025 HAWK Hildesheim
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.

build.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,14 @@
22

33
SCRIPT_FILE=$(realpath ${BASH_SOURCE%/*})
44
cd $SCRIPT_FILE
5+
6+
VERSION="0.0.1"
7+
if [ -n "$1" ]; then
8+
VERSION=$1
9+
fi
10+
511
docker run --rm \
612
-v "$PWD":/usr/src/mymaven \
713
-v "$PWD/.maven":/root/.m2 \
814
-w /usr/src/mymaven \
9-
maven:3 mvn clean install
15+
maven:3 mvn -DpackageVersion=${VERSION} clean install

pom.xml

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
55
<modelVersion>4.0.0</modelVersion>
6-
76
<name>HAWK Auth Server</name>
87
<description>Keycloak extension that provides some additional REST endpoints for more efficient work with the client library</description>
98

@@ -15,7 +14,7 @@
1514

1615
<groupId>com.hawk.keycloak</groupId>
1716
<artifactId>hawk-auth-server-extension</artifactId>
18-
<version>26.0.4</version>
17+
<version>${packageVersion}</version>
1918
<packaging>jar</packaging>
2019

2120
<properties>
@@ -29,26 +28,55 @@
2928
<dependency>
3029
<groupId>org.keycloak</groupId>
3130
<artifactId>keycloak-core</artifactId>
31+
<version>${keycloak.version}</version>
32+
<scope>provided</scope>
33+
</dependency>
34+
<dependency>
35+
<groupId>org.keycloak</groupId>
36+
<artifactId>keycloak-common</artifactId>
37+
<version>${keycloak.version}</version>
38+
<scope>provided</scope>
39+
</dependency>
40+
<dependency>
41+
<groupId>org.keycloak</groupId>
42+
<artifactId>keycloak-model-storage</artifactId>
43+
<version>${keycloak.version}</version>
44+
<scope>provided</scope>
45+
</dependency>
46+
<dependency>
47+
<groupId>org.keycloak</groupId>
48+
<artifactId>keycloak-model-storage-private</artifactId>
49+
<version>${keycloak.version}</version>
50+
<scope>provided</scope>
51+
</dependency>
52+
<dependency>
53+
<groupId>org.keycloak</groupId>
54+
<artifactId>keycloak-config-api</artifactId>
55+
<version>${keycloak.version}</version>
3256
<scope>provided</scope>
3357
</dependency>
3458
<dependency>
3559
<groupId>org.keycloak</groupId>
3660
<artifactId>keycloak-server-spi</artifactId>
61+
<version>${keycloak.version}</version>
3762
<scope>provided</scope>
3863
</dependency>
3964
<dependency>
4065
<groupId>org.keycloak</groupId>
4166
<artifactId>keycloak-server-spi-private</artifactId>
67+
<version>${keycloak.version}</version>
4268
<scope>provided</scope>
4369
</dependency>
4470
<dependency>
4571
<groupId>org.keycloak</groupId>
4672
<artifactId>keycloak-services</artifactId>
73+
<version>${keycloak.version}</version>
4774
<scope>provided</scope>
4875
</dependency>
4976
<dependency>
5077
<groupId>org.keycloak</groupId>
5178
<artifactId>keycloak-saml-core-public</artifactId>
79+
<version>${keycloak.version}</version>
5280
<scope>provided</scope>
5381
</dependency>
5482
<dependency>
@@ -77,6 +105,12 @@
77105

78106
<build>
79107
<finalName>${project.artifactId}</finalName>
108+
<resources>
109+
<resource>
110+
<directory>src/main/resources</directory>
111+
<filtering>true</filtering>
112+
</resource>
113+
</resources>
80114
<plugins>
81115
<plugin>
82116
<groupId>org.apache.maven.plugins</groupId>

src/main/java/com/hawk/keycloak/util/ConnectionInfoRequestHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public ConnectionInfo handleRequest() {
1616

1717
return new ConnectionInfo(
1818
Version.VERSION,
19-
"1.0.0",
19+
VersionInfo.getPackageVersion(),
2020
session.getContext().getClient().getClientId(),
2121
session.getContext().getClient().getId()
2222
);
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package com.hawk.keycloak.util;
2+
3+
import lombok.extern.slf4j.Slf4j;
4+
5+
import java.io.IOException;
6+
import java.io.InputStream;
7+
import java.util.Properties;
8+
9+
@Slf4j
10+
public class VersionInfo {
11+
12+
private static final String PACKAGE_VERSION;
13+
14+
static {
15+
String version;
16+
Properties properties = new Properties();
17+
try (InputStream input = VersionInfo.class.getClassLoader().getResourceAsStream("version.properties")) {
18+
if (input != null) {
19+
properties.load(input);
20+
version = properties.getProperty("version", "unknown");
21+
} else {
22+
version = "unknown";
23+
}
24+
} catch (IOException e) {
25+
log.error("Failed to read version.properties", e);
26+
version = "unknown";
27+
}
28+
PACKAGE_VERSION = version;
29+
}
30+
31+
public static String getPackageVersion() {
32+
return PACKAGE_VERSION;
33+
}
34+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
version=${packageVersion}
1.18 KB
Binary file not shown.
2.1 KB
Binary file not shown.

0 commit comments

Comments
 (0)