forked from operaton/operaton
-
Notifications
You must be signed in to change notification settings - Fork 0
131 lines (125 loc) · 4.75 KB
/
nighly-build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
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