Skip to content

Commit

Permalink
Update GH workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
g3force committed Feb 16, 2025
1 parent c2f8862 commit 44994d0
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 9 deletions.
19 changes: 11 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
name: Build
name: Build and push to docker

on: push
on:
push:
branches: [ master ]

jobs:
build:

runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-depth: 0 # required to fetch all history for all branches and tags
- name: Set up JDK
uses: actions/setup-java@v2
with:
java-version: 21
distribution: temurin
- name: Build
run: ./gradlew build
- name: IntegrationTest
run: ./gradlew integrationTest
- name: Publish to Docker Hub
env:
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}
DOCKER_HUB_PASSWORD: ${{ secrets.DOCKER_HUB_PASSWORD }}
run: ./gradlew jib -Pjib.to.image=registry.hub.docker.com/tigersmannheim/sumatra
33 changes: 33 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Perform Release

on:
push:
tags:
- version/*

jobs:
release:

runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # required to fetch all history for all branches and tags
- name: Set up JDK
uses: actions/setup-java@v2
with:
java-version: 21
distribution: temurin
- name: Publish to Docker Hub
env:
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}
DOCKER_HUB_PASSWORD: ${{ secrets.DOCKER_HUB_PASSWORD }}
run: |
./gradlew jib
- name: Publish Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
tag=${GITHUB_REF#refs/tags/version/*}
./gradlew githubRelease -Pversion=$tag
3 changes: 2 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import org.apache.tools.ant.filters.ReplaceTokens
plugins {
alias(libs.plugins.sonar)
alias(libs.plugins.versionCatalogUpdate)
alias(libs.plugins.githubRelease)
id 'idea'

id 'sumatra.java'
Expand All @@ -12,7 +13,7 @@ plugins {

def gitDescribe = providers.exec {
commandLine("git", "describe", "--tags", "--always", "--first-parent")
}.standardOutput.asText.map { it.replace("merge/", "").trim() }
}.standardOutput.asText.map { it.replace("merge/", "").replace("version/", "").trim() }

version gitDescribe.get()

Expand Down
2 changes: 2 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ plugin-jib = "3.4.2"
plugin-protobuf = "0.9.4"
plugin-sonar = "5.0.0.4638"
plugin-version-catalog-update = "0.8.4"
plugin-github-release = "2.4.1"

[libraries]
com-fasterxml-jackson-core-jackson-annotations = { module = "com.fasterxml.jackson.core:jackson-annotations", version.ref = "com-fasterxml-jackson-core" }
Expand Down Expand Up @@ -76,3 +77,4 @@ plugin-protobuf = { module = "com.google.protobuf:protobuf-gradle-plugin", versi
[plugins]
sonar = { id = "org.sonarqube", version.ref = "plugin-sonar" }
versionCatalogUpdate = { id = "nl.littlerobots.version-catalog-update", version.ref = "plugin-version-catalog-update" }
githubRelease = { id = "com.github.breadmoirai.github-release", version.ref = "plugin-github-release" }

0 comments on commit 44994d0

Please sign in to comment.