From 77f82d188213600fe8044f603ddf72822baef240 Mon Sep 17 00:00:00 2001 From: Daniel Meier Date: Sun, 16 Jul 2023 00:59:54 +0200 Subject: [PATCH] Update Github Actions Workflow files --- .github/workflows/check.yml | 9 +++------ .github/workflows/publish.yml | 25 +++++-------------------- app/build.gradle.kts | 4 ++++ 3 files changed, 12 insertions(+), 26 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 8df42c4..b3f6217 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -5,21 +5,21 @@ on: branches: - master - develop + - feature/** pull_request: branches: - master - develop + - feature/** jobs: check: - runs-on: ubuntu-latest - steps: - name: Checkout uses: actions/checkout@v3 - - name: Set up JDK 17 + - name: Set up JDK uses: actions/setup-java@v3 with: distribution: 'temurin' @@ -28,8 +28,5 @@ jobs: - name: Setup Gradle uses: gradle/gradle-build-action@v2 - - name: Run Gradle 'check' Task - run: ./gradlew check - - name: Run Gradle 'build' Task run: ./gradlew build diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 704893b..8eb07bc 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -2,7 +2,7 @@ name: Publish Docker image on: release: - types: [published] + types: [released, prereleased] jobs: push_to_registry: @@ -12,7 +12,7 @@ jobs: - name: Check out uses: actions/checkout@v3 - - name: Set up JDK 17 + - name: Set up JDK uses: actions/setup-java@v3 with: distribution: 'temurin' @@ -21,32 +21,17 @@ jobs: - name: Setup Gradle uses: gradle/gradle-build-action@v2 - - name: Build JAR - run: ./gradlew -PprojectVersion="${GITHUB_REF##*/}" build - - name: Log in to Docker Hub uses: docker/login-action@v2 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - - name: Extract metadata for Docker - id: meta - uses: docker/metadata-action@v4 - with: - images: dnl50/tsa-server - tags: | - type=semver,pattern={{version}} - - - name: Build and push Docker image - uses: docker/build-push-action@v3 - with: - context: . - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} + - name: Build and Push Image + run: ./gradlew -PprojectVersion="${GITHUB_REF##*/}" build -Dquarkus.native.compression.level=9 -Dquarkus.container-image.push=true - name: Update Docker Hub description + if: ${{ github.event.action == 'released' }} uses: peter-evans/dockerhub-description@v3 with: username: ${{ secrets.DOCKER_USERNAME }} diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 3c797b8..dc74804 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -50,6 +50,10 @@ dependencies { testAnnotationProcessor("org.projectlombok:lombok:${libs.versions.lombok.get()}") } +if (hasProperty("projectVersion")) { + version = property("projectVersion")!! +} + java { sourceCompatibility = JavaVersion.VERSION_17 }