Skip to content

Commit

Permalink
ci: update to latest CI scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
Dominick Leppich committed May 3, 2024
1 parent 946785e commit 7e6ea02
Show file tree
Hide file tree
Showing 3 changed files with 100 additions and 91 deletions.
67 changes: 33 additions & 34 deletions .github/workflows/develop-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,37 +12,36 @@ 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/*
- name: Check out source code
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 17
- 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 -P snapshot-build
- 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/*.war
install/*
71 changes: 34 additions & 37 deletions .github/workflows/release-build.yml
Original file line number Diff line number Diff line change
@@ -1,48 +1,45 @@
name: Publish Release Build
name: Publish Development Build

permissions:
contents: write

name: Publish Development Build

permissions:
contents: write

on:
push:
branches:
- 'master'
tags:
- 'v*'

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/*
- name: Check out source code
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 17
- 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 -P release-build
- name: Release
id: create_release
uses: softprops/action-gh-release@v2
with:
name: Release ${{ github.ref_name }}
generate_release_notes: true
draft: false
prerelease: false
files: |
**/target/*.war
install/*
53 changes: 33 additions & 20 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,54 +22,67 @@ pipeline {
}
}

stage('build') {
stage('build-snapshot') {
when {
not {
anyOf {
branch 'master'
branch 'release_*'
allOf {
branch 'PR-*'
expression { env.CHANGE_BRANCH.startsWith("release_") }
}
}
}
}
steps {
sh 'mvn clean verify -U'
recordIssues enabledForFailure: true, aggregatingResults: true, tools: [java(), javaDoc()]
sh 'mvn clean verify -U -P snapshot-build'
}
}

stage('sonarcloud') {
stage('build-release') {
when {
anyOf {
branch 'master'
branch 'sonar_*'
branch 'release_*'
allOf {
branch 'PR-*'
expression { env.CHANGE_BRANCH.startsWith("release_") }
}
}
}
steps {
withCredentials([string(credentialsId: 'jenkins-sonarcloud', variable: 'TOKEN')]) {
sh 'mvn verify sonar:sonar -Dsonar.token=$TOKEN -U'
}
sh 'mvn clean verify -U -P release-build'
}
}

stage('deploy-snapshot-libs') {
stage('sonarcloud') {
when {
anyOf {
branch 'develop'
branch 'master'
branch 'release_*'
branch 'sonar_*'
allOf {
branch 'PR-*'
expression { env.CHANGE_BRANCH.startsWith("release_") }
}
}
}
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'
}
withCredentials([string(credentialsId: 'jenkins-sonarcloud', variable: 'TOKEN')]) {
sh 'mvn verify sonar:sonar -Dsonar.token=$TOKEN -U'
}
}
}

stage('deploy-release-libs') {
stage('deploy-libs') {
when {
anyOf {
branch 'master'
branch 'develop'
}
}
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 Down

0 comments on commit 7e6ea02

Please sign in to comment.