diff --git a/.github/workflows/branch.yml b/.github/workflows/branch.yml
new file mode 100644
index 000000000..7c873165a
--- /dev/null
+++ b/.github/workflows/branch.yml
@@ -0,0 +1,49 @@
+name: Create New Stable Branch
+
+on:
+ workflow_dispatch:
+
+jobs:
+ build:
+ name: Create new branch
+ env:
+ ENVIRONMENT: CI
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v4
+ - name: Set up JDK 17
+ uses: actions/setup-java@v4
+ with:
+ distribution: 'adopt'
+ java-version: 17
+ - name: install yq
+ run: wget https://github.com/mikefarah/yq/releases/download/v4.2.0/yq_linux_amd64 -O ~/yq && chmod +x ~/yq
+ - name: Maven Version
+ run: mvn --version
+ # Retrieve current version from the root pom
+ - name: Get version
+ run: |
+ PROJECT_VERSION=$(mvn org.apache.maven.plugins:maven-help-plugin:3.4.0:evaluate -Dexpression=project.version -q -DforceStdout)
+ echo PROJECT_VERSION=${PROJECT_VERSION} >> $GITHUB_ENV
+ echo CUR_VERSION=$(echo ${PROJECT_VERSION} | awk -F'.' '{print $1"."$2+0"."$3}' | sed s/[.]$//) >> $GITHUB_ENV
+ echo NEXT_VERSION=$(echo ${PROJECT_VERSION} | awk -F'.' '{print $1"."$2+1"."$3}' | sed s/[.]$//) >> $GITHUB_ENV
+ - name: Create branch ${{ env.CUR_VERSION }}
+ run: git branch ${{ env.CUR_VERSION }} master
+ - name: Bump next version ${{ env.NEXT_VERSION }}-SNAPSHOT
+ run: mvn versions:set -DnewVersion=${{ env.NEXT_VERSION }}-SNAPSHOT
+ - name: Set major version ${{ env.NEXT_VERSION }}
+ run: mvn versions:set-property -Dproperty=major-version -DnewVersion=${{ env.NEXT_VERSION }}
+ - name: Update main workflow
+ run: ~/yq -i e '.on.push.branches |= [ "master", '${{ env.NEXT_VERSION }}' ]' .github/workflows/main.yml
+ - name: Update Notify clients workflow
+ run: ~/yq -i e '.on.push.branches |= [ "master", '${{ env.NEXT_VERSION }}' ]' .github/workflows/notify-clients.yml
+ - name: Commit main branch changes
+ run: |
+ git config --global user.name "${{ env.CI_COMMIT_AUTHOR }}"
+ git config --global user.email "username@users.noreply.github.com"
+ git commit -a -m "Next is ${{ env.NEXT_VERSION }}"
+ - name: push branches
+ run: |
+ git push master
+ git push ${{ env.CUR_VERSION }}
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 19caddfd1..a3574de64 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -1,67 +1,58 @@
name: Java CI with Maven
-
on:
push:
branches: [ master, 0.12.x, 0.13.x ]
tags: [ "*" ]
pull_request:
workflow_dispatch:
-
jobs:
build:
name: Build on ${{ matrix.os.name }}
strategy:
matrix:
os:
- - {
- name: "windows-latest",
- build-options: "\"-Dquarkus.container-image.build=false\" -pl '!horreum-client, !horreum-integration-tests' -DskipITs -DskipTests"
- }
- - {
- name: "ubuntu-latest",
- build-options: ""
- }
+ - {name: "windows-latest", build-options: "\"-Dquarkus.container-image.build=false\" -pl '!horreum-client, !horreum-integration-tests' -DskipITs -DskipTests"}
+ - {name: "ubuntu-latest", build-options: ""}
env:
ENVIRONMENT: CI
- runs-on: ${{ matrix.os.name }}
-
+ runs-on: ${{ matrix.os.name }}
steps:
- - uses: actions/checkout@v4
- - name: Reclaim Disk Space
- run: .github/scripts/ci-prerequisites.sh
- - name: Set up JDK 17
- uses: actions/setup-java@v4
- with:
- distribution: 'adopt'
- java-version: 17
- - name: Cache Maven packages
- uses: actions/cache@v4
- with:
- path: ~/.m2
- key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
- restore-keys: ${{ runner.os }}-m2
- - name: Install Hunter
- run: pipx install git+https://github.com/datastax-labs/hunter.git
- - name: Maven Version
- run: mvn --version
- - name: Build and Test
- run: mvn clean install -B --file pom.xml ${{ matrix.os.build-options }} -P ci
- - name: Check uncommitted changes
- if: matrix.os.name == 'ubuntu-latest'
- run: |
- clean=$(git status --porcelain)
- if [[ -z "$clean" ]]; then
- echo "Empty git status --porcelain: $clean"
- else
- echo "Uncommitted file changes detected: $clean"
- git diff
- exit 1
- fi
- - name: Upload artifact for failed workflow
- if: failure()
- uses: actions/upload-artifact@v4
- with:
- name: test logs
- path: |
- */target/surefire-reports/*
- test-suite/target/hyperfoil/*.log
+ - uses: actions/checkout@v4
+ - name: Reclaim Disk Space
+ run: .github/scripts/ci-prerequisites.sh
+ - name: Set up JDK 17
+ uses: actions/setup-java@v4
+ with:
+ distribution: 'adopt'
+ java-version: 17
+ - name: Cache Maven packages
+ uses: actions/cache@v4
+ with:
+ path: ~/.m2
+ key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
+ restore-keys: ${{ runner.os }}-m2
+ - name: Install Hunter
+ run: pipx install git+https://github.com/datastax-labs/hunter.git
+ - name: Maven Version
+ run: mvn --version
+ - name: Build and Test
+ run: mvn clean install -B --file pom.xml ${{ matrix.os.build-options }} -P ci
+ - name: Check uncommitted changes
+ if: matrix.os.name == 'ubuntu-latest'
+ run: |
+ clean=$(git status --porcelain)
+ if [[ -z "$clean" ]]; then
+ echo "Empty git status --porcelain: $clean"
+ else
+ echo "Uncommitted file changes detected: $clean"
+ git diff
+ exit 1
+ fi
+ - name: Upload artifact for failed workflow
+ if: failure()
+ uses: actions/upload-artifact@v4
+ with:
+ name: test logs
+ path: |
+ */target/surefire-reports/*
+ test-suite/target/hyperfoil/*.log
diff --git a/.github/workflows/notify-clients.yaml b/.github/workflows/notify-clients.yaml
index ce2274d7d..9f888f80a 100644
--- a/.github/workflows/notify-clients.yaml
+++ b/.github/workflows/notify-clients.yaml
@@ -1,5 +1,4 @@
name: Notify clients
-
on:
push:
branches:
@@ -8,7 +7,6 @@ on:
- 0.13.x
paths:
- "docs/site/content/en/openapi/openapi.yaml"
-
jobs:
clients-notification:
runs-on: ubuntu-latest
@@ -19,7 +17,6 @@ jobs:
repository: Hyperfoil/horreum-client-golang
- name: Python
repository: Hyperfoil/horreum-client-python
-
steps:
- name: Extract trigger branch
id: extractor
diff --git a/docs/RELEASE.md b/docs/RELEASE.md
index eb4502465..0202825cf 100644
--- a/docs/RELEASE.md
+++ b/docs/RELEASE.md
@@ -99,44 +99,20 @@ Generate release notes:
https://github.com/Hyperfoil/Horreum/releases
-## After the release
-
-The version identifier for a release is from
-
-```
-./horreum-api/src/main/java/io/hyperfoil/tools/horreum/api/Version.java
-```
-
-so that file needs to be updated after a release.
-
## Creating a new Stable Branch
To create a new stable branch, for example creating a `0.11.x` branch, first create the branch locally:
```bash
git checkout origin/master
-git checkout -b 0.11.x
-git checkout origin/master
+git branch 0.11.x master
```
Update the new main branch to the next snapshot version:
```bash
mvn versions:set -DnewVersion=0.12-SNAPSHOT
-```
-
-Update the openapi version in the `horreum-api/pom.xml` file:
-
-```xml
- 0.12
-```
-
-Update the `horreum-api/src/main/java/io/hyperfoil/tools/horreum/api/Version.java` file
-
-```java
-public class Version {
- public static final String VERSION = "0.12.0";
-}
+mvn versions:set-property -Dproperty=major-version -DnewVersion=0.12
```
Update the Github actions to build the new stable branch for each push:
@@ -144,7 +120,7 @@ Update the Github actions to build the new stable branch for each push:
```yaml
on:
push:
- branches: [ master, 0.12.x ]
+ branches: [ master, 0.11.x ]
tags: [ "*" ]
pull_request:
workflow_dispatch:
@@ -154,9 +130,7 @@ Update the Github action to notify openapi changes to the clients on every stabl
```yaml
on:
push:
- branches:
- - main
- - 0.12.x
+ branches: [ master, 0.11.x ]
paths:
- "docs/site/content/en/openapi/openapi.yaml"
```
@@ -171,7 +145,7 @@ git commit -m "Next is 0.12"
Push the new branch and main branch to github:
```bash
-git push origin 0.12.x
+git push origin 0.11.x
git push origin master
```
diff --git a/horreum-api/pom.xml b/horreum-api/pom.xml
index 6f76ffe3b..9f00fbbd0 100644
--- a/horreum-api/pom.xml
+++ b/horreum-api/pom.xml
@@ -15,7 +15,6 @@
8
8
UTF-8
- 0.14
@@ -65,7 +64,7 @@
${basedir}/src/main/resources/application.properties
- ${openapi-version}
+ ${major-version}
io.hyperfoil.tools.horreum.api,
io.hyperfoil.tools.horreum.api.alerting,
@@ -94,7 +93,7 @@
${basedir}/src/main/resources/application.properties
- ${openapi-version}
+ ${major-version}
io.hyperfoil.tools.horreum.api,
io.hyperfoil.tools.horreum.api.alerting,
@@ -207,6 +206,24 @@
+
+ org.codehaus.mojo
+ properties-maven-plugin
+ 1.0.0
+
+
+ generate-resources
+
+ write-project-properties
+
+
+
+ ${project.build.outputDirectory}/build.properties
+
+
+
+
+
diff --git a/horreum-api/src/main/java/io/hyperfoil/tools/horreum/api/Version.java b/horreum-api/src/main/java/io/hyperfoil/tools/horreum/api/Version.java
index 030ec1d9c..b65cd9c4c 100644
--- a/horreum-api/src/main/java/io/hyperfoil/tools/horreum/api/Version.java
+++ b/horreum-api/src/main/java/io/hyperfoil/tools/horreum/api/Version.java
@@ -1,5 +1,19 @@
package io.hyperfoil.tools.horreum.api;
+import io.quarkus.logging.Log;
+
+import java.io.IOException;
+import java.util.Properties;
+
public class Version {
- public static final String VERSION = "0.14.0";
+ public static final String getVersion(){
+ final Properties properties = new Properties();
+ try {
+ properties.load(Version.class.getClassLoader().getResourceAsStream("build.properties"));
+ return properties.getProperty("horreum.version");
+ } catch (IOException e) {
+ Log.error("Failed to load version.properties",e);
+ }
+ return null;
+ }
}
diff --git a/horreum-backend/src/main/java/io/hyperfoil/tools/horreum/svc/ConfigServiceImpl.java b/horreum-backend/src/main/java/io/hyperfoil/tools/horreum/svc/ConfigServiceImpl.java
index 355951a6f..8acf7d961 100644
--- a/horreum-backend/src/main/java/io/hyperfoil/tools/horreum/svc/ConfigServiceImpl.java
+++ b/horreum-backend/src/main/java/io/hyperfoil/tools/horreum/svc/ConfigServiceImpl.java
@@ -55,7 +55,7 @@ public KeycloakConfig keycloak() {
@Override
public VersionInfo version() {
VersionInfo info = new VersionInfo();
- info.version = Version.VERSION;
+ info.version = Version.getVersion();
info.startTimestamp = startTimestamp;
info.privacyStatement = privacyStatement.orElse(null);
return info;
diff --git a/pom.xml b/pom.xml
index ec24bf323..45b14131f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -95,6 +95,9 @@
postgres:16
quay.io/keycloak/keycloak:23.0.3
+ ${project.version}
+ 0.14
+