From 9e0ddfa4ba4af863b5f4756af5bd64e6f455e8f4 Mon Sep 17 00:00:00 2001 From: Ryan Harg Date: Thu, 21 Nov 2024 11:49:50 +0100 Subject: [PATCH] Integrate with ci and registry --- .woodpecker/build.yml | 25 +++++++++++++++++++++++++ .woodpecker/push-image.yml | 30 ++++++++++++++++++++++++++++++ app/build.gradle.kts | 24 ++++++++++++++++++++++-- 3 files changed, 77 insertions(+), 2 deletions(-) create mode 100644 .woodpecker/build.yml create mode 100644 .woodpecker/push-image.yml diff --git a/.woodpecker/build.yml b/.woodpecker/build.yml new file mode 100644 index 0000000..2480890 --- /dev/null +++ b/.woodpecker/build.yml @@ -0,0 +1,25 @@ +when: + - event: push + +steps: + - name: build + image: eclipse-temurin:17-jdk-alpine + commands: + - ./gradlew clean build + + - name: notify + image: deblan/woodpecker-email + settings: + debug: true + dsn: + from_secret: smtp_url + from: + address: + from_secret: email_sender + name: "Woodpecker CI" + recipients_only: true + recipients: + from_secret: email_recipient + when: + status: + - failure \ No newline at end of file diff --git a/.woodpecker/push-image.yml b/.woodpecker/push-image.yml new file mode 100644 index 0000000..5ac1499 --- /dev/null +++ b/.woodpecker/push-image.yml @@ -0,0 +1,30 @@ +when: + - event: tag + +steps: + - name: push-image + image: eclipse-temurin:17-jdk-alpine + environment: + REGISTRY_USERNAME: + from_secret: registry_username + REGISTRY_PASSWORD: + from_secret: registry_password + commands: + - ./gradlew jib -Papp.version=${CI_COMMIT_TAG} -Pdocker.repo.username=$${REGISTRY_USERNAME} -Pdocker.repo.password=$${REGISTRY_PASSWORD} + + - name: notify + image: deblan/woodpecker-email + settings: + debug: true + dsn: + from_secret: smtp_url + from: + address: + from_secret: email_sender + name: "Woodpecker CI" + recipients_only: true + recipients: + from_secret: email_recipient + when: + status: + - failure \ No newline at end of file diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 47fc2c0..5bfdf61 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -8,7 +8,13 @@ plugins { // Apply the application plugin to add support for building a CLI application in Java. application - id("com.google.cloud.tools.jib") version "3.4.3" + id("com.google.cloud.tools.jib") version "3.4.4" +} + +project.version = if (project.hasProperty("app.version")) { + project.property("app.version").toString() +} else { + "0.0.1-SNAPSHOT" } repositories { @@ -20,7 +26,21 @@ repositories { } jib { - to.image = "github-release-bot" + to { + image = "registry.azw27.de/github-release-bot/github-release-bot" + + tags = if (project.hasProperty("app.version")) { + setOf("v" + project.property("app.version").toString()) + } else { + setOf("dev-snapshot") + } + auth { + username = if (project.hasProperty("docker.repo.username")) + project.property("docker.repo.username").toString() else "" + password = if (project.hasProperty("docker.repo.password")) + project.property("docker.repo.password").toString() else "" + } + } container.creationTime.set(DateTimeFormatter.ISO_DATE_TIME.format(Instant.now().atZone(ZoneId.of("UTC")))) val buildDir = layout.buildDirectory.get()