Skip to content

Commit 122d88e

Browse files
committed
Update github actions
1 parent 8f1e305 commit 122d88e

File tree

1 file changed

+27
-12
lines changed

1 file changed

+27
-12
lines changed

.github/workflows/main.yml

+27-12
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,17 @@ on:
44
branches:
55
- master
66
- "3.0"
7+
- "2.14"
78
- "2.13"
89
paths-ignore:
910
- "README.md"
1011
- "release-notes/*"
1112
pull_request:
1213
branches:
1314
- master
15+
- "3.0"
16+
- "2.14"
17+
- "2.13"
1418
paths-ignore:
1519
- "README.md"
1620
- "release-notes/*"
@@ -25,27 +29,38 @@ jobs:
2529
env:
2630
JAVA_OPTS: "-XX:+TieredCompilation -XX:TieredStopAtLevel=1"
2731
steps:
28-
- uses: actions/checkout@v2
32+
- uses: actions/checkout@v3
2933
- name: Set up JDK
30-
uses: actions/setup-java@v2
34+
uses: actions/setup-java@v3
3135
with:
32-
distribution: "adopt"
36+
distribution: 'temurin'
3337
java-version: ${{ matrix.java_version }}
38+
cache: 'maven'
3439
server-id: sonatype-nexus-snapshots
3540
server-username: CI_DEPLOY_USERNAME
3641
server-password: CI_DEPLOY_PASSWORD
37-
- uses: actions/cache@v2.1.6
38-
with:
39-
path: ~/.m2/repository
40-
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
41-
restore-keys: |
42-
${{ runner.os }}-maven-
42+
# See https://github.com/actions/setup-java/blob/v2/docs/advanced-usage.md#Publishing-using-Apache-Maven
43+
# gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Value of the GPG private key to import
44+
# gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase
4345
- name: Build
44-
run: ./mvnw -V -B -ff -ntp verify
46+
run: ./mvnw -B -q -ff -ntp verify
47+
- name: Extract project Maven version
48+
id: projectVersion
49+
run: echo ::set-output name=version::$(./mvnw org.apache.maven.plugins:maven-help-plugin:3.2.0:evaluate -DforceStdout -Dexpression=project.version -q)
4550
- name: Deploy snapshot
46-
if: github.event_name != 'pull_request' && matrix.java_version == '8'
51+
if: github.event_name != 'pull_request' && matrix.java_version == '8' && endsWith(steps.projectVersion.outputs.version, '-SNAPSHOT')
4752
env:
4853
CI_DEPLOY_USERNAME: ${{ secrets.CI_DEPLOY_USERNAME }}
4954
CI_DEPLOY_PASSWORD: ${{ secrets.CI_DEPLOY_PASSWORD }}
5055
# MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
51-
run: ./mvnw -V -B -ff -DskipTests -ntp source:jar deploy
56+
run: ./mvnw -B -q -ff -DskipTests -ntp source:jar deploy
57+
- name: Generate code coverage
58+
if: github.event_name != 'pull_request' && matrix.java_version == '8'
59+
run: ./mvnw -B -q -ff -ntp test
60+
- name: Publish code coverage
61+
if: github.event_name != 'pull_request' && matrix.java_version == '8'
62+
uses: codecov/codecov-action@v1
63+
with:
64+
token: ${{ secrets.CODECOV_TOKEN }}
65+
file: ./target/site/jacoco/jacoco.xml
66+
flags: unittests

0 commit comments

Comments
 (0)