Skip to content

Commit 8397885

Browse files
committed
Update GHA
Update GitHub Action building the project, to also include publication of snapshots for the master and bug fix branches
1 parent b19a9e6 commit 8397885

File tree

1 file changed

+68
-53
lines changed

1 file changed

+68
-53
lines changed

.github/workflows/maven.yml

Lines changed: 68 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
push:
55
branches:
66
- master
7+
- axon-kotlin-*.*.x
78
pull_request:
89

910
jobs:
@@ -15,64 +16,78 @@ jobs:
1516
strategy:
1617
matrix:
1718
include:
18-
- java-version: 8
19-
sonar-enabled: false
20-
- java-version: 11
21-
sonar-enabled: true
19+
- java-version: 8
20+
sonar-enabled: false
21+
deploy: true
22+
- java-version: 11
23+
sonar-enabled: true
24+
deploy: false
2225

2326
steps:
24-
- name: Checkout code
25-
uses: actions/checkout@v2
27+
- name: Checkout code
28+
uses: actions/checkout@v2
2629

27-
- name: Set up JDK ${{ matrix.java-version }}
28-
uses: actions/setup-java@v1.4.3
29-
with:
30-
java-version: ${{ matrix.java-version }}
30+
- name: Set up JDK ${{ matrix.java-version }}
31+
uses: actions/setup-java@v1.4.3
32+
with:
33+
java-version: ${{ matrix.java-version }}
34+
server-id: sonatype
35+
server-username: MAVEN_USERNAME
36+
server-password: MAVEN_PASSWORD
3137

32-
- name: Cache .m2
33-
uses: actions/cache@v2.1.3
34-
with:
35-
path: ~/.m2/repository
36-
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
37-
restore-keys: |
38-
${{ runner.os }}-maven
38+
- name: Cache .m2
39+
uses: actions/cache@v2.1.3
40+
with:
41+
path: ~/.m2/repository
42+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
43+
restore-keys: |
44+
${{ runner.os }}-maven
3945
40-
- name: Maven operation with Sonar
41-
if: matrix.sonar-enabled
42-
run: |
43-
mvn -B -U -Pcoverage \
44-
clean verify \
45-
sonar:sonar \
46-
-Dsonar.projectKey=AxonFramework_extension-reactor \
47-
-Dsonar.organization=axonframework \
48-
-Dsonar.host.url=https://sonarcloud.io \
49-
-Dsonar.login=${{ secrets.SONAR_TOKEN }}
50-
env:
51-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46+
- name: Maven operation with Sonar
47+
if: matrix.sonar-enabled
48+
run: |
49+
mvn -B -U -Pcoverage \
50+
clean verify \
51+
sonar:sonar \
52+
-Dsonar.projectKey=AxonFramework_extension-reactor \
53+
-Dsonar.organization=axonframework \
54+
-Dsonar.host.url=https://sonarcloud.io \
55+
-Dsonar.login=${{ secrets.SONAR_TOKEN }}
56+
env:
57+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5258

53-
- name: Maven operation without Sonar
54-
if: matrix.sonar-enabled != true
55-
run: |
56-
mvn -B -U clean verify
57-
env:
58-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
59+
- name: Maven operation without Sonar
60+
if: matrix.sonar-enabled != true
61+
run: |
62+
mvn -B -U clean verify
63+
env:
64+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5965

60-
- name: Notify success to Slack
61-
if: success()
62-
env:
63-
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
64-
uses: voxmedia/github-action-slack-notify-build@v1.1.2
65-
with:
66-
channel_id: CAGSEC92A
67-
status: SUCCESS
68-
color: good
66+
- name: Deploy to Sonatype
67+
if: github.github.head_ref == null && success() && matrix.deploy
68+
run: |
69+
./mvnw -B -U deploy -DskipTests=true
70+
env:
71+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
72+
MAVEN_USERNAME: ${{ secrets.SONATYPE_TOKEN_ID }}
73+
MAVEN_PASSWORD: ${{ secrets.SONATYPE_TOKEN_PASS }}
6974

70-
- name: Notify failure to Slack
71-
if: failure()
72-
env:
73-
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
74-
uses: voxmedia/github-action-slack-notify-build@v1.1.2
75-
with:
76-
channel_id: CAGSEC92A
77-
status: FAILED
78-
color: danger
75+
- name: Notify success to Slack
76+
if: success()
77+
env:
78+
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
79+
uses: voxmedia/github-action-slack-notify-build@v1.1.2
80+
with:
81+
channel_id: CAGSEC92A
82+
status: SUCCESS
83+
color: good
84+
85+
- name: Notify failure to Slack
86+
if: failure()
87+
env:
88+
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
89+
uses: voxmedia/github-action-slack-notify-build@v1.1.2
90+
with:
91+
channel_id: CAGSEC92A
92+
status: FAILED
93+
color: danger

0 commit comments

Comments
 (0)