diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index f023adc..2793d6b 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -1,6 +1,9 @@
-name: Java CI
+name: Verify
-on: [push]
+on:
+ push:
+ branches-ignore:
+ - main
jobs:
build:
@@ -8,10 +11,12 @@ jobs:
steps:
- uses: actions/checkout@v3
+ with:
+ token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
- distribution: 'temurin'
+ distribution: 'adopt'
- name: Build with Maven
- run: mvn --batch-mode --update-snapshots package
\ No newline at end of file
+ run: mvn --batch-mode package
diff --git a/.github/workflows/pub-docker-hub.yaml b/.github/workflows/pub-docker-hub.yaml
deleted file mode 100644
index 910ebed..0000000
--- a/.github/workflows/pub-docker-hub.yaml
+++ /dev/null
@@ -1,29 +0,0 @@
-name: Publish Docker image to Docker Hub
-on:
- release:
- types:
- - published
-
-jobs:
- publish:
- runs-on: ubuntu-latest
- steps:
- - name: Login to Docker Hub
- uses: docker/login-action@v2
- with:
- username: ${{secrets.DOCKER_USERNAME}}
- password: ${{secrets.DOCKER_PASSWORD}}
- - uses: actions/checkout@v3
- - name: Set up Maven Central Repository
- uses: actions/setup-java@v3
- with:
- java-version: '17'
- distribution: 'adopt'
- server-id: docker.io
- server-username: DOCKER_USERNAME
- server-password: DOCKER_PASSWORD
- - name: Publish package
- run: mvn --batch-mode -Prelease package dockerfile:push
-env:
- DOCKER_USERNAME: ${{secrets.DOCKER_USERNAME}}
- DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}}
\ No newline at end of file
diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml
new file mode 100644
index 0000000..445c923
--- /dev/null
+++ b/.github/workflows/release.yaml
@@ -0,0 +1,87 @@
+name: Release
+
+on:
+ push:
+ branches:
+ - main
+ - main-WHO
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+ if: ${{ github.actor != 'protegeproject-bot[bot]' }}
+ steps:
+ - name: Login to Docker Hub
+ uses: docker/login-action@v2
+ with:
+ username: ${{secrets.DOCKER_USERNAME}}
+ password: ${{secrets.DOCKER_PASSWORD}}
+ - uses: actions/create-github-app-token@v1
+ id: app-token
+ with:
+ app-id: ${{ vars.PROTEGEPROJECT_BOT_APP_ID }}
+ private-key: ${{ secrets.PROTEGEPROJECT_BOT_APP_PRIVATE_KEY }}
+ - uses: actions/checkout@v4
+ with:
+ token: ${{ steps.app-token.outputs.token }}
+ ref: ${{ github.head_ref }}
+ - name: Set up Maven Central Repository
+ uses: actions/setup-java@v3
+ with:
+ java-version: '17'
+ distribution: 'adopt'
+ server-id: docker.io
+ server-username: DOCKER_USERNAME
+ server-password: DOCKER_PASSWORD
+ - name: Get current version
+ id: get-version
+ run: |
+ current_version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
+ echo "Current version: $current_version"
+ echo "::set-output name=current_version::$current_version"
+ - name: Bump version
+ id: bump
+ run: |
+ current_version=${{ steps.get-version.outputs.current_version }}
+ branch=${GITHUB_REF##*/}
+ echo "Current branch: $branch"
+
+ # Extract the base version without suffix
+ base_version=$(echo $current_version | sed -E 's/(-.*)?$//')
+
+ # Increment the base version (assuming semantic versioning)
+ IFS='.' read -r -a version_parts <<< "$base_version"
+ version_parts[2]=$((version_parts[2] + 1))
+ new_base_version="${version_parts[0]}.${version_parts[1]}.${version_parts[2]}"
+
+ if [[ "$branch" == "main-WHO" ]]; then
+ new_version="${new_base_version}-WHO"
+ else
+ new_version="$new_base_version"
+ fi
+
+ echo "New version: $new_version"
+ mvn versions:set -DnewVersion=$new_version -DgenerateBackupPoms=false
+ echo "::set-output name=new_version::$new_version"
+ - name: Commit new version
+ run: |
+ git config --global user.name "github-actions[bot]"
+ git config --global user.email "github-actions[bot]@users.noreply.github.com"
+ git add pom.xml
+ git commit -m "Bump version to ${{ steps.bump.outputs.new_version }}"
+ git tag ${{ steps.bump.outputs.new_version }}
+ git push origin HEAD:${GITHUB_REF##*/}
+ git push origin ${{ steps.bump.outputs.new_version }}
+ - name: Build and Publish package
+ run: mvn --batch-mode package install
+ - name: Release
+ uses: softprops/action-gh-release@v1
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ with:
+ tag_name: ${{ steps.bump.outputs.new_version }}
+ generate_release_notes: true
+
+env:
+ DOCKER_USERNAME: ${{secrets.DOCKER_USERNAME}}
+ DOCKER_TOKEN: ${{secrets.DOCKER_PASSWORD}}
diff --git a/pom.xml b/pom.xml
index c028247..c529edd 100644
--- a/pom.xml
+++ b/pom.xml
@@ -73,126 +73,71 @@
+
org.springframework.boot
spring-boot-maven-plugin
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+ 3.0.0
-
- paketobuildpacks/builder-jammy-base:latest
-
+
+ test
+
+
+ **/*TestCase.java
+ **/*Test.java
+ **/*IT.java
+
- com.spotify
- dockerfile-maven-plugin
- 1.4.13
+ org.codehaus.mojo
+ exec-maven-plugin
+ 3.3.0
- default
+ docker-build
+ package
- build
+ exec
+
+ docker
+ ${project.basedir}
+
+ build
+ -f
+ Dockerfile
+ --build-arg
+ JAR_FILE=${project.artifactId}-${project.version}.jar
+ -t
+ protegeproject/${project.artifactId}:${project.version}
+ .
+
+
+
+
+ docker-push
+ install
+
+ exec
+
+
+ docker
+ ${project.basedir}
+
+ push
+ protegeproject/${project.artifactId}:${project.version}
+
+
-
- protegeproject/${project.artifactId}
- ${project.version}
-
- ${project.build.finalName}.jar
-
-
-
-
-
-
- release
-
-
-
- org.apache.maven.plugins
- maven-source-plugin
- 3.2.1
-
-
- attach-sources
-
- jar-no-fork
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-javadoc-plugin
- 3.2.0
-
- none
- 16
-
-
-
- attach-javadocs
-
- jar
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-gpg-plugin
- 1.6
-
-
- sign-artifacts
- verify
-
- sign
-
-
-
- --pinentry-mode
- loopback
-
-
-
-
-
-
-
- org.sonatype.plugins
- nexus-staging-maven-plugin
- 1.6.7
- true
-
- ossrh
- https://oss.sonatype.org
- true
-
-
-
-
- com.thoughtworks.xstream
- xstream
- 1.4.15
-
-
-
-
-
-
-
-
-