Skip to content

Commit

Permalink
build: gh action for jar release
Browse files Browse the repository at this point in the history
  • Loading branch information
janderssonse committed Nov 23, 2021
1 parent efdc00c commit d52050a
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 1 deletion.
37 changes: 37 additions & 0 deletions .github/workflows/publishjar.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Create and publish a Spring Boot jar/Spring Boot LaunchScript Jar

on:
push:
tags:
- 'v*'

jobs:
build-artifacts:
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Build jars with Gradle
run: |
./gradlew build -x test
- name: Release Jars
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
build/libs/encore*.jar
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ FROM ${DOCKER_BASE_IMAGE}
LABEL org.opencontainers.image.url="https://github.com/svt/encore"
LABEL org.opencontainers.image.source="https://github.com/svt/encore"

COPY build/libs/encore.jar /app/encore.jar
COPY build/libs/encore*.jar /app/encore.jar
COPY bin/start.sh /app/start.sh

WORKDIR /app
Expand Down
9 changes: 9 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ plugins {
id("org.springdoc.openapi-gradle-plugin") version "1.3.3"
}


project.version = scmVersion.version

apply(from = "checks.gradle")

group = "se.svt.oss"
Expand Down Expand Up @@ -49,6 +52,12 @@ repositories {
mavenCentral()
}

//don't build the extra plain jars that was auto-added in Spring Boot 2.5.0,
//https://docs.spring.io/spring-boot/docs/current/gradle-plugin/reference/htmlsingle/#packaging-executable.and-plain-archives
tasks.getByName<Jar>("jar") {
enabled = false
}

configurations {
implementation {
exclude(module = "spring-boot-starter-logging")
Expand Down

0 comments on commit d52050a

Please sign in to comment.