-
Notifications
You must be signed in to change notification settings - Fork 1
91 lines (78 loc) · 2.44 KB
/
maven.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
name: Axon Server Plugin API
on:
push:
branches:
- master
- axonserver-plugin-api-*.*.x
workflow_dispatch:
jobs:
build:
name: Test and Build on JDK ${{ matrix.java-version }}
runs-on: ubuntu-latest
strategy:
matrix:
include:
- java-version: 11
sonar-enabled: false
deploy: true
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up JDK ${{ matrix.java-version }}
uses: actions/setup-java@v1.4.3
with:
java-version: ${{ matrix.java-version }}
server-id: sonatype
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
- name: Cache .m2
uses: actions/cache@v2.1.3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven
- name: Maven operation with Sonar
if: matrix.sonar-enabled
run: |
mvn -B -U \
clean verify \
sonar:sonar \
-Dsonar.projectKey=axon-server-plugin-api \
-Dsonar.organization=AxonIQ \
-Dsonar.host.url=https://sonarcloud.io \
-Dsonar.login=${{ secrets.SONAR_TOKEN }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Maven operation without Sonar
if: matrix.sonar-enabled != true
run: |
mvn -B -U clean verify
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Deploy to Sonatype
if: github.github.head_ref == null && success() && matrix.deploy
run: |
mvn -B -U deploy -DskipTests=true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MAVEN_USERNAME: ${{ secrets.SONATYPE_TOKEN_ID }}
MAVEN_PASSWORD: ${{ secrets.SONATYPE_TOKEN_PASS }}
- name: Notify success to Slack
if: success()
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
uses: voxmedia/github-action-slack-notify-build@v1.1.2
with:
channel_id: C015XFURSJU
status: SUCCESS
color: good
- name: Notify failure to Slack
if: failure()
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
uses: voxmedia/github-action-slack-notify-build@v1.1.2
with:
channel_id: C015XFURSJU
status: FAILED
color: danger