Skip to content

Commit a4399a7

Browse files
chore: update GH Actions workflows (#156)
* chore: update `pull_request` workflow * chore: update `push` workflow * fix: stop ignoring paths for `pullrequest`
1 parent 9e5609e commit a4399a7

File tree

2 files changed

+59
-49
lines changed

2 files changed

+59
-49
lines changed

.github/workflows/pullrequest.yml

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,36 @@
1-
# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created
2-
# For more information see: https://github.com/actions/setup-java#apache-maven-with-a-settings-path
3-
41
name: maven-build
52

63
on:
7-
pull_request:
8-
branches:
9-
- master
4+
pull_request:
5+
branches:
6+
- master
7+
# Do not execute only for specific paths if workflow is required.
8+
# https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/collaborating-on-repositories-with-code-quality-features/troubleshooting-required-status-checks#handling-skipped-but-required-checks
109

1110
jobs:
1211
build:
1312
runs-on: ubuntu-latest
14-
1513
steps:
16-
- uses: actions/checkout@v2
17-
- name: Set up JDK 1.11
18-
uses: actions/setup-java@v1
19-
with:
20-
java-version: 1.11
21-
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
22-
settings-path: ${{ github.workspace }} # location for the settings.xml file
2314

24-
- name: Build
25-
run: mvn -B package --file pom.xml -Pcoverage -Dsytle.colors=always --errors
26-
- name: Upload coverage to Codecov
27-
uses: codecov/codecov-action@v2
28-
with:
29-
token: ${{ secrets.CODECOV_TOKEN }}
15+
- uses: actions/checkout@v4
16+
17+
- uses: actions/setup-java@v3
18+
with:
19+
java-version: 11
20+
distribution: corretto
21+
cache: maven
22+
23+
- name: Build with Maven
24+
run: >
25+
mvn
26+
--batch-mode
27+
--file pom.xml
28+
-Pcoverage
29+
-Dsytle.colors=always
30+
--errors
31+
package
32+
33+
- name: Upload coverage to Codecov
34+
uses: codecov/codecov-action@v2
35+
with:
36+
token: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/release.yml

Lines changed: 32 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,45 @@
1-
# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created
2-
# For more information see: https://github.com/actions/setup-java#apache-maven-with-a-settings-path
3-
41
name: maven-release
52

63
on:
74
push:
85
branches:
96
- master
7+
paths-ignore:
8+
- '*.md'
9+
- '.gitignore'
1010

1111
jobs:
1212
build:
13-
1413
runs-on: ubuntu-latest
15-
1614
steps:
17-
- uses: actions/checkout@v2
18-
- name: Set up JDK 1.11
19-
uses: actions/setup-java@v1
20-
with:
21-
java-version: 1.11
22-
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
23-
settings-path: ${{ github.workspace }} # location for the settings.xml file
2415

25-
- name: Publish
26-
uses: samuelmeuli/action-maven-publish@v1
27-
with:
28-
gpg_private_key: ${{ secrets.gpg_private_key }}
29-
gpg_passphrase: ${{ secrets.gpg_passphrase }}
30-
nexus_username: ${{ secrets.nexus_username }}
31-
nexus_password: ${{ secrets.nexus_password }}
32-
maven_args: '-Pcoverage'
16+
- uses: actions/checkout@v4
17+
18+
- uses: actions/setup-java@v3
19+
with:
20+
java-version: 11
21+
distribution: corretto
22+
cache: maven
23+
server-id: ossrh # Value of distributionManagement.repository.id field of pom.xml
24+
server-username: MAVEN_USERNAME
25+
server-password: MAVEN_PASSWORD
26+
settings-path: ${{ github.workspace }} # Location for settings.xml file
27+
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
28+
gpg-passphrase: GPG_PASSPHRASE
29+
30+
- name: Publish with Maven deploy
31+
run: >
32+
mvn
33+
--batch-mode
34+
--activate-profiles deploy
35+
-Pcoverage
36+
clean deploy
37+
env:
38+
MAVEN_USERNAME: ${{ secrets.NEXUS_USERNAME }}
39+
MAVEN_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
40+
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
3341

34-
- name: Upload coverage to Codecov
35-
uses: codecov/codecov-action@v2
36-
with:
37-
token: ${{ secrets.CODECOV_TOKEN }}
38-
# - name: Release
39-
# uses: softprops/action-gh-release@v1
40-
# if: startsWith(github.ref, 'refs/tags/')
41-
# env:
42-
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42+
- name: Upload coverage to Codecov
43+
uses: codecov/codecov-action@v2
44+
with:
45+
token: ${{ secrets.CODECOV_TOKEN }}

0 commit comments

Comments
 (0)