Skip to content

Nightly Build

Nightly Build #20

Workflow file for this run

name: Nightly Build
on:
schedule:
- cron: "0 3 * * *" # Runs at 3:00 AM UTC daily
workflow_dispatch: # Allows manual trigger
inputs:
java_version:
description: 'Java version to use'
type: choice
required: true
default: '["17"]'
options:
- '["17"]'
- '["21"]'
- '["17", "21"]'
dry_run:
description: 'Dry-Run: Skips remote operations when true'
type: boolean
required: true
default: true
skip_tests:
description: 'Skip test execution for faster build'
type: boolean
required: true
default: false
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
name: Build
strategy:
fail-fast: true
matrix:
java: ${{ fromJson(github.event.inputs.java_version || '["17", "21"]') }}
runs-on: ubuntu-24.04
outputs:
version: ${{steps.maven-build.outputs.version}}
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Cache Maven packages
uses: actions/cache@v4
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Maven Build
id: maven-build
shell: bash
run: |
.github/scripts/jacoco-create-flag-files.sh
RELEASE_VERSION=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout | tail -n 1)
SKIP_TESTS=${{ github.event.inputs.skip_tests || (github.event_name == 'schedule' && false) }}
echo "version=$RELEASE_VERSION" >> $GITHUB_OUTPUT
echo "skip_tests=$SKIP_TESTS"
./mvnw \
-Pdistro,distro-run,distro-tomcat,distro-wildfly,distro-webjar,distro-starter,distro-serverless,h2-in-memory \
install \
versions:dependency-updates-aggregate-report \
versions:plugin-updates-aggregate-report \
-Dsave=true -Ddisplay=false io.github.orhankupusoglu:sloc-maven-plugin:sloc \
-Dbuildplan.appendOutput=true -Dbuildplan.outputFile=$PROJECT_ROOT/target/reports/buildplan.txt fr.jcgay.maven.plugins:buildplan-maven-plugin:list \
-DskipTests=$SKIP_TESTS
.github/scripts/prepare-reports.sh
./mvnw -Psonatype-oss-release -DskipTests=true -Dskip.frontend.build=true deploy
find target -name maven-metadata.* -delete
./mvnw --non-recursive org.jacoco:jacoco-maven-plugin:report-aggregate
- name: Cache build artifacts
uses: actions/cache/save@v4
with:
path: |
distro/**/*.tar.gz
distro/**/*.zip
distro/webjar/target/operaton-webapp-webjar-*.jar
./*/staging-deploy/**
**/target/reports/**
**/target/surefire-reports/*.xml
target/project-reports.zip
key: ${{ github.run_id }}-build-artifacts
- name: Publish Test Report
if: ${{ github.event.inputs.skip_tests == 'false' || github.event_name == 'schedule' }}
# https://github.com/marketplace/actions/junit-report-action
uses: mikepenz/action-junit-report@v4
with:
report_paths: ${{ github.workspace }}/**/target/surefire-reports/*.xml
require_passed_tests: true
release:
name: Release
needs:
- build
runs-on: ubuntu-24.04
steps:
- name: Check out the code
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{github.event.inputs.release_branch}}
- name: Restore build artifacts cache
uses: actions/cache@v4
with:
path: |
distro/**/*.tar.gz
distro/**/*.zip
distro/webjar/target/operaton-webapp-webjar-*.jar
./*/staging-deploy/**
**/target/reports/**
**/target/surefire-reports/*.xml
target/project-reports.zip
key: ${{ github.run_id }}-build-artifacts
fail-on-cache-miss: true
- name: Release with JReleaser
uses: jreleaser/release-action@v2
env:
JRELEASER_PROJECT_VERSION: ${{needs.build.outputs.version}}
JRELEASER_GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
JRELEASER_GPG_PUBLIC_KEY: ${{secrets.GPG_PUBLIC_KEY}}
JRELEASER_GPG_SECRET_KEY: ${{secrets.GPG_PRIVATE_KEY}}
JRELEASER_GPG_PASSPHRASE: ${{secrets.GPG_PASSPHRASE}}
JRELEASER_MAVENCENTRAL_USERNAME: ${{secrets.OSSRH_USERNAME}}
JRELEASER_MAVENCENTRAL_PASSWORD: ${{secrets.OSSRH_PASSWORD}}
JRELEASER_DRY_RUN: ${{ github.event_name == 'schedule' && false || github.event.inputs.dry_run }}
JRELEASER_PRERELEASE_ENABLED: true