From 918d0f51e657cc0a2a9e9b0444e0c15fb584dad0 Mon Sep 17 00:00:00 2001 From: Paul-Christian Volkmer Date: Sat, 10 Aug 2024 13:52:24 +0200 Subject: [PATCH] build: add GitHub workflow to build release image --- .github/workflows/release.yml | 36 +++++++++++++++++++++++++++++++++++ build.gradle.kts | 14 +++++++++++++- 2 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..d3a1bec --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,36 @@ +name: Create release and upload assets + +on: + push: + tags: + - 'v*' + +jobs: + build_image: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 + with: + java-version: '21' + distribution: 'temurin' + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Execute image build and push + run: | + ./gradlew test bootBuildImage + docker tag ghcr.io/pcvolkmer/onco-analytics-monitor ghcr.io/pcvolkmer/onco-analytics-monitor:${{ github.ref_name }} + docker push ghcr.io/pcvolkmer/onco-analytics-monitor + docker push ghcr.io/pcvolkmer/onco-analytics-monitor:${{ github.ref_name }} \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index 137bf17..ad099d6 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,3 +1,5 @@ +import org.springframework.boot.gradle.tasks.bundling.BootBuildImage + plugins { id("org.springframework.boot") version "3.3.2" id("io.spring.dependency-management") version "1.1.6" @@ -8,7 +10,7 @@ plugins { } group = "dev.pcvolkmer.onco-analytics" -version = "0.0.1-SNAPSHOT" +version = "0.1.0-SNAPSHOT" java { toolchain { @@ -58,3 +60,13 @@ kotlin { tasks.withType { useJUnitPlatform() } + +tasks.named("bootBuildImage") { + imageName.set("ghcr.io/pcvolkmer/onco-analytics-monitor") + + environment.set(environment.get() + mapOf( + "BP_OCI_SOURCE" to "https://github.com/pcvolkmer/onco-analytics-monitor", + "BP_OCI_LICENSES" to "AGPLv3", + "BP_OCI_DESCRIPTION" to "Kafka Topic monitoring for https://github.com/bzkf/onco-analytics-on-fhir" + )) +} \ No newline at end of file