Skip to content

Commit 8840cd3

Browse files
authored
CI impovements (#19)
* Revert "CI to build image and push to github registry (#17)" This reverts commit 7b70d39. * Improve image taging - Don't tag with run number (which conflict with patch versions - Tag with release version
1 parent 7b70d39 commit 8840cd3

3 files changed

Lines changed: 22 additions & 85 deletions

File tree

.github/workflows/docker-build.yml

Lines changed: 0 additions & 72 deletions
This file was deleted.

.github/workflows/maven.yml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ on:
1313
branches: [ "main" ]
1414
pull_request:
1515
branches: [ "main" ]
16+
release:
17+
types: [ published ]
1618

1719
jobs:
1820
build:
@@ -46,7 +48,14 @@ jobs:
4648
else
4749
eap="-eap"
4850
fi
49-
mainVersion="1.0.$RUN_NUMBER"
51+
52+
# Use release tag if available, otherwise parse from pom.xml
53+
if [ -n "${RELEASE_TAG}" ] && [ "${RELEASE_TAG}" != "" ]; then
54+
mainVersion="${RELEASE_TAG#v}" # Remove 'v' prefix if present
55+
else
56+
mainVersion="$(grep -m1 -oP '(?<=<version>)[^<]+' pom.xml)"
57+
fi
58+
5059
ver="$mainVersion-$keycloakVersion${eap}-$gitrev"
5160
echo "version=$ver" >>"$GITHUB_OUTPUT"
5261
echo "mainVersion=$mainVersion" >>"$GITHUB_OUTPUT"
@@ -55,7 +64,7 @@ jobs:
5564
mvn --batch-mode versions:set "-DnewVersion=$ver"
5665
env:
5766
BRANCH_REF: ${{ github.ref }}
58-
RUN_NUMBER: ${{ github.run_number }}
67+
RELEASE_TAG: ${{ github.event.release.tag_name }}
5968
- name: Check for update of KeyCloak
6069
run: |
6170
newestKcVersion="$(curl https://api.github.com/repos/keycloak/keycloak/releases/latest | jq -r .name)"
@@ -87,7 +96,7 @@ jobs:
8796
# https://docs.github.com/en/actions/use-cases-and-examples/publishing-packages/publishing-java-packages-with-maven
8897
- name: Publish to mvn artifact to GitHub Packages
8998
run: mvn --batch-mode deploy
90-
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
99+
if: (github.ref == 'refs/heads/main' && github.event_name == 'push') || github.event_name == 'release'
91100
env:
92101
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
93102
- uses: actions/upload-artifact@v4
@@ -98,7 +107,7 @@ jobs:
98107
docker:
99108
needs: build
100109
runs-on: ubuntu-latest
101-
if: github.ref == 'refs/heads/main'
110+
if: (github.ref == 'refs/heads/main' && github.event_name == 'push') || github.event_name == 'release'
102111
env:
103112
REGISTRY: ghcr.io
104113
IMAGE_NAME: ${{ github.repository }}

pom.xml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,15 @@
44
<groupId>ch.openem.keycloakadminhelperplugin</groupId>
55
<artifactId>keycloak-facilities-admin-plugin</artifactId>
66
<packaging>jar</packaging>
7+
<version>1.0.0-SNAPSHOT</version>
8+
<name>keycloak-facilities-admin-plugin</name>
9+
<url>http://maven.apache.org</url>
10+
11+
<properties>
12+
<!-- other properties -->
13+
<keycloak.version>26.5.4</keycloak.version>
14+
</properties>
15+
716
<build>
817
<plugins>
918
<plugin>
@@ -65,15 +74,6 @@
6574
</plugins>
6675
</build>
6776

68-
<version>1.0.0-rc2-SNAPSHOT</version>
69-
<name>keycloak-facilities-admin-plugin</name>
70-
<url>http://maven.apache.org</url>
71-
72-
<properties>
73-
<!-- other properties -->
74-
<keycloak.version>26.5.4</keycloak.version>
75-
</properties>
76-
7777
<dependencies>
7878
<!-- testing -->
7979
<dependency>

0 commit comments

Comments
 (0)