-
Notifications
You must be signed in to change notification settings - Fork 0
105 lines (99 loc) · 3.39 KB
/
ci.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
---
name: CI
on:
workflow_call:
inputs:
java_version:
description: Java version to use for running Sonar and publishing docs & artifacts
type: string
required: false
default: 17
java_test_versions:
description: Java versions to use for testing the project
type: string
required: false
default: '[11, 17, 21]'
publish_snapshots:
description: Whether to attempt publishing snapshots. When false, the workflow will only run build.
type: boolean
default: true
required: false
pages:
description: Path expression for GitHub pages to upload.
type: string
required: false
secrets:
ossrh_username:
required: true
ossrh_password:
required: true
ossrh_signing_key:
required: false
ossrh_signing_password:
required: false
sonar_token:
required: true
permissions:
contents: write
jobs:
build:
name: Build with java ${{ matrix.java_version }}
runs-on: ubuntu-latest
strategy:
matrix:
java_version: ${{ fromJson(inputs.java_test_versions) }}
steps:
- uses: actions/checkout@v3
- uses: ts-graphviz/setup-graphviz@v1
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: ${{ matrix.java_version }}
cache: 'maven'
- uses: s4u/[email protected]
with:
sonatypeSnapshots: true
- name: Build and test with Java ${{ matrix.java_version }}
run: mvn --batch-mode --update-snapshots -P IT install
- name: Execute SonarCloud analysis
run: |
if [ ${{ matrix.java_version == inputs.java_version && github.actor != 'dependabot[bot]' }} = "true" ]; then
mvn --batch-mode -P sonar sonar:sonar
fi
env:
SONARCLOUD_LOGIN: ${{ secrets.SONAR_TOKEN }}
- name: Deploy GitHub Pages to snapshot
if: ${{ inputs.pages != '' && matrix.java_version == inputs.java_version }}
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ${{ inputs.pages }}
destination_dir: ./snapshot
keep_files: true
publish-snapshots:
runs-on: ubuntu-latest
needs: build
if: contains(fromJSON('["buschmais", "jqassistant-plugin", "jqassistant-tooling", "jQAssistant"]'), github.repository_owner) && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') && github.event_name != 'pull_request'
steps:
- uses: actions/checkout@v3
- uses: ts-graphviz/setup-graphviz@v1
- uses: actions/setup-java@v3
with:
distribution: temurin
java-version: ${{ inputs.java_version }}
cache: 'maven'
- uses: s4u/[email protected]
with:
sonatypeSnapshots: true
servers: |
[{
"id": "sonatype-nexus-snapshots",
"username": "${{ secrets.OSSRH_USERNAME }}",
"password": "${{ secrets.OSSRH_PASSWORD }}"
}]
- name: publish-snapshots
run: mvn deploy --batch-mode -DskipTests
env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
OSSRH_SIGNING_PASSWORD: ${{ secrets.OSSRH_SIGNING_PASSWORD }}