Skip to content

Commit

Permalink
Update Github Actions Workflow files
Browse files Browse the repository at this point in the history
  • Loading branch information
dnl50 committed Jul 15, 2023
1 parent fce82e5 commit 77f82d1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 26 deletions.
9 changes: 3 additions & 6 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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
25 changes: 5 additions & 20 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Publish Docker image

on:
release:
types: [published]
types: [released, prereleased]

jobs:
push_to_registry:
Expand All @@ -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'
Expand All @@ -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 }}
Expand Down
4 changes: 4 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ dependencies {
testAnnotationProcessor("org.projectlombok:lombok:${libs.versions.lombok.get()}")
}

if (hasProperty("projectVersion")) {
version = property("projectVersion")!!
}

java {
sourceCompatibility = JavaVersion.VERSION_17
}
Expand Down

0 comments on commit 77f82d1

Please sign in to comment.