Skip to content

Commit

Permalink
release: fix Jenkinsfile and GitHub actions, move install artifacts
Browse files Browse the repository at this point in the history
  • Loading branch information
Dominick Leppich committed Apr 15, 2024
1 parent 87cd303 commit 3bd3159
Show file tree
Hide file tree
Showing 5 changed files with 116 additions and 65 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/develop-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Publish Development Build

permissions:
contents: write

on:
push:
branches:
- 'develop'

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check out source code
uses: actions/checkout@v4
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Set up Maven cache
uses: actions/cache@v1
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Build with Maven
run: mvn clean verify -U
- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%d %H:%M:%S %Z')"
- name: Create tag name from date
id: tagdate
run: echo "::set-output name=tagdate::$(date +'%Y-%m-%d_%H-%M-%S_%Z')"
- name: Release
id: create_release
uses: softprops/action-gh-release@v2
with:
name: ${{ steps.date.outputs.date }}
tag_name: ${{ steps.tagdate.outputs.tagdate }}
generate_release_notes: true
draft: false
prerelease: true
files: |
**/target/*.jar
install/*
48 changes: 48 additions & 0 deletions .github/workflows/release-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Publish Release Build

permissions:
contents: write

on:
push:
branches:
- 'master'

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check out source code
uses: actions/checkout@v4
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Set up Maven cache
uses: actions/cache@v1
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Build with Maven
run: mvn clean verify -U
- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%d %H:%M:%S %Z')"
- name: Create tag name from date
id: tagdate
run: echo "::set-output name=tagdate::$(date +'%Y-%m-%d_%H-%M-%S_%Z')"
- name: Release
id: create_release
uses: softprops/action-gh-release@v2
with:
name: ${{ steps.date.outputs.date }}
tag_name: ${{ steps.tagdate.outputs.tagdate }}
generate_release_notes: true
draft: false
prerelease: false
files: |
**/target/*.jar
install/*
62 changes: 0 additions & 62 deletions .github/workflows/release.yml

This file was deleted.

23 changes: 20 additions & 3 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,33 @@ pipeline {
}
}

stage('deploy-libs') {
stage('deploy-snapshot-libs') {
when {
anyOf {
branch 'master'
branch 'develop'
}
}
steps {
script {
if (fileExists('module-lib/pom.xml')) {
sh 'cat pom.xml | grep "SNAPSHOT"'
sh 'mvn -N deploy'
sh 'mvn -f module-lib/pom.xml deploy'
}
}
}
}

stage('deploy-release-libs') {
when {
anyOf {
branch 'master'
}
}
steps {
script {
if (fileExists('module-lib/pom.xml')) {
sh 'cat pom.xml | grep "SNAPSHOT" || true'
sh 'mvn -N deploy'
sh 'mvn -f module-lib/pom.xml deploy'
}
Expand All @@ -63,7 +80,7 @@ pipeline {

post {
always {
junit "**/target/surefire-reports/*.xml"
junit allowEmptyResults: true, testResults: "**/target/surefire-reports/*.xml"
step([
$class : 'JacocoPublisher',
execPattern : '**/target/jacoco.exec',
Expand Down

0 comments on commit 3bd3159

Please sign in to comment.