-
Notifications
You must be signed in to change notification settings - Fork 1
81 lines (72 loc) · 2.71 KB
/
_reusable_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
name: Build
on:
workflow_call:
inputs:
ref:
type: string
default: ${{ github.ref }}
description: 'The branch ref to build. Leave empty to use workflow branch.'
publishToArtifactory:
type: boolean
default: false
description: 'Publish the built artifacts to our Artifactory repository'
publishToCentral:
type: boolean
default: false
description: 'Publish the built artifacts to Maven Central (ignored for Weekly builds)'
secrets:
KSM_CONFIG:
required: true
BONITA_CI_PAT:
required: true
jobs:
build:
# Allow dependabot to publish tests results
permissions:
contents: read
issues: read
checks: write
pull-requests: write
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}
repository: bonitasoft/bonita-project
token: ${{ secrets.BONITA_CI_PAT }}
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17
- uses: bonitasoft/maven-settings-action@v1
with:
keeper-secret-config: ${{ secrets.KSM_CONFIG }}
- name: Build
run: ./mvnw --no-transfer-progress -B verify -Ptests
- name: Publish Test Report
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
files: |
tests/**/target/*-reports/TEST-*.xml
- name: Upload IT logs
uses: actions/upload-artifact@v4
if: always()
with:
name: it-logs
path: tests/target/it/**/*.log
retention-days: 5
- name: Get Version
id: version
if: ${{ inputs.publishToArtifactory || inputs.publishToCentral }}
run: echo "version=$(./mvnw --no-transfer-progress help:evaluate -Dexpression=project.version -q -DforceStdout --non-recursive)" >> "$GITHUB_OUTPUT"
- name: Publish ${{ steps.version.outputs.version }} to Artifactory
if: ${{ inputs.publishToArtifactory }}
env:
ALT_DEPLOYMENT_REPOSITORY: ${{ endsWith(steps.version.outputs.version,'-SNAPSHOT') && format('snapshots::{0}', vars.SNAPSHOTS_REPOSITORY_URL) || format('staging::{0}', vars.STAGING_REPOSITORY_URL) }}
run: ./mvnw --no-transfer-progress -B deploy -Prelease -DaltDeploymentRepository=${{env.ALT_DEPLOYMENT_REPOSITORY}}
- name: Publish ${{ steps.version.outputs.version }} to Central
# Never publish a Weekly build to Maven Central
if: ${{ inputs.publishToCentral && !contains(steps.version.outputs.version,'W')}}
run: ./mvnw --no-transfer-progress -B deploy -Prelease,ossrh