Skip to content

Commit

Permalink
release plugin added
Browse files Browse the repository at this point in the history
  • Loading branch information
Andreas Mautsch committed Apr 8, 2024
1 parent 76694c4 commit 98c5835
Show file tree
Hide file tree
Showing 7 changed files with 69 additions and 21 deletions.
65 changes: 52 additions & 13 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,78 @@ name: Java CI

on: [push]

jobs:
build:
permissions:
contents: write

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'

- name: Test
uses: gradle/gradle-build-action@v3
with:
gradle-version: 8.7
arguments: build test

snapshot:
runs-on: ubuntu-latest
needs: test
steps:
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_PASSWORD }}

- uses: actions/checkout@v4

- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'

- name: Test
- name: Container Images
uses: gradle/gradle-build-action@v3
with:
gradle-version: 8.6
arguments: test
gradle-version: 8.7
arguments: jib dockerImageNative

release:
runs-on: ubuntu-latest
needs: snapshot
if: github.ref == 'refs/heads/main'

- name: JVM Image
uses: gradle/gradle-build-action@v3
steps:
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_PASSWORD }}

- uses: actions/checkout@v4

- name: Set up JDK
uses: actions/setup-java@v4
with:
gradle-version: 8.6
arguments: jib jib
distribution: 'temurin'
java-version: '21'

- name: Setup git config
run: |
git config user.name "GitHub Actions Bot"
git config user.email "<>"
- name: Native Image
- name: Release
uses: gradle/gradle-build-action@v3
with:
gradle-version: 8.6
arguments: dockerImageNative
gradle-version: 8.7
arguments: release -Prelease.useAutomaticVersion=true
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
go to /src/deploy/docker and do "./stack up"

# run jvm multi image
docker run --pull always --name event-dispatcher-service --rm -p50500:50500 -e spring.rabbitmq.host=host.docker.internal goafabric/event-dispatcher-service:3.2.5-SNAPSHOT
docker run --pull always --name event-dispatcher-service --rm -p50500:50500 -e spring.rabbitmq.host=host.docker.internal goafabric/event-dispatcher-service:$(grep '^version=' gradle.properties | cut -d'=' -f2)

# run native image
docker run --pull always --name event-dispatcher-service-native --rm -p50500:50500 -e spring.rabbitmq.host=host.docker.internal goafabric/event-dispatcher-service-native:3.2.5-SNAPSHOT -Xmx32m
docker run --pull always --name event-dispatcher-service-native --rm -p50500:50500 -e spring.rabbitmq.host=host.docker.internal goafabric/event-dispatcher-service-native:$(grep '^version=' gradle.properties | cut -d'=' -f2) -Xmx32m

# run native image arm
docker run --pull always --name event-dispatcher-service-native --rm -p50500:50500 -e spring.rabbitmq.host=host.docker.internal goafabric/event-dispatcher-service-native-arm64v8:3.2.5-SNAPSHOT -Xmx32m
docker run --pull always --name event-dispatcher-service-native --rm -p50500:50500 -e spring.rabbitmq.host=host.docker.internal goafabric/event-dispatcher-service-native-arm64v8:$(grep '^version=' gradle.properties | cut -d'=' -f2) -Xmx32m

# rabbitmq
docker run --rm -p15672:15672 -p5672:5672 --name rabbitmq -e RABBITMQ_DEFAULT_USER=admin -e RABBITMQ_DEFAULT_PASS=admin rabbitmq:3.11.5-management
Expand Down
14 changes: 10 additions & 4 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import org.springframework.boot.gradle.tasks.bundling.BootBuildImage

group = "org.goafabric"
version = "3.2.5-SNAPSHOT"
val group: String by project
val version: String by project
java.sourceCompatibility = JavaVersion.VERSION_21

val dockerRegistry = "goafabric"
Expand All @@ -14,7 +14,8 @@ plugins {
id("org.springframework.boot") version "3.2.4"
id("io.spring.dependency-management") version "1.1.4"
id("org.graalvm.buildtools.native") version "0.9.28"
id("com.google.cloud.tools.jib") version "3.4.0"
id("com.google.cloud.tools.jib") version "3.4.2"
id("net.researchgate.release") version "3.0.2"
}

repositories {
Expand Down Expand Up @@ -81,4 +82,9 @@ tasks.named<BootBuildImage>("bootBuildImage") {
}
}

graalvmNative { binaries.named("main") { quickBuild.set(true) } }
graalvmNative { binaries.named("main") { quickBuild.set(true) } }

configure<net.researchgate.release.ReleaseExtension> {
buildTasks.set(listOf("build", "test", "jib", "dockerImageNative"))
tagTemplate.set("v${version}".replace("-SNAPSHOT", ""))
}
1 change: 1 addition & 0 deletions doc/release-notes.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# 3.2.5
- release plugin added

# 3.2.4
- upgrade to Spring Boot 3.2.4
Expand Down
2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
group=org.goafabric
version=3.2.25-SNAPSHOT
1 change: 0 additions & 1 deletion src/deploy/docker/.values
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
_Values_root_name="event-dispatcher-service"

_Values_image_repository=goafabric/event-dispatcher-service
_Values_image_tag=3.2.5-SNAPSHOT

_Values_service_port=50500
_Values_resources_entrypoint="java -Xms128M -Xmx128M -cp /app/resources:/app/classes:/app/libs/* org.goafabric.eventdispatcher.Application"
Expand Down
1 change: 1 addition & 0 deletions src/deploy/docker/stack
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
source .values
export COMMAND=$1
export OPTION=$2
export _Values_image_tag=$(grep '^version=' ../../../gradle.properties | cut -d'=' -f2)

[[ "$(uname -m)" == "arm64" || "$(uname -m)" == "aarch64" ]] && export _Values_server_arch="-arm64v8"
export _Values_image_native="" && [[ "${OPTION}" = "-native" ]] && export _Values_image_native=-native${_Values_server_arch} && export _Values_resources_entrypoint=${_Values_resources_entrypoint_native} && export _Values_health_check_disabled=true
Expand Down

0 comments on commit 98c5835

Please sign in to comment.