forked from ThreeTen/threetenbp
-
Notifications
You must be signed in to change notification settings - Fork 6
80 lines (77 loc) · 2.19 KB
/
BuildSnapshot.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
name: Build
on:
push:
branches:
- master
- GWT29
pull_request:
types: [opened, synchronize, reopened]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'zulu'
cache: maven
- uses: s4u/[email protected]
with:
sonatypeSnapshots: true
apacheSnapshots: true
servers: |
[{
"id": "ossrh",
"username": "${{ secrets.SONATYPE_USERNAME }}",
"password": "${{ secrets.SONATYPE_PASSWORD }}"
}]
- name: Package and test
run: mvn package -U -B
working-directory: pom
- name: Publish Unit Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
junit_files: "**/target/surefire-reports/*.xml"
- name: Deploy
run: mvn deploy -Dmaven.test.skip -B
working-directory: pom
sonar:
name: Run Sonar analysis
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
# Shallow clones should be disabled for a better relevancy of analysis
fetch-depth: 0
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'zulu'
cache: maven
- name: Cache SonarCloud packages
uses: actions/cache@v4
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- uses: s4u/[email protected]
with:
sonatypeSnapshots: true
apacheSnapshots: true
servers: |
[{
"id": "ossrh",
"username": "${{ secrets.SONATYPE_USERNAME }}",
"password": "${{ secrets.SONATYPE_PASSWORD }}"
}]
- name: Build and analyze
env:
# Needed to get PR information, if any
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: mvn -B verify sonar:sonar -Dsonar.projectKey=${{ secrets.SONAR_KEY }} -Dmaven.test.skip
working-directory: pom