Skip to content

Commit 410d622

Browse files
committed
Improve GitHub Action workflows
1 parent ab98091 commit 410d622

2 files changed

Lines changed: 39 additions & 9 deletions

File tree

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
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/blob/main/docs/advanced-usage.md#apache-maven-with-a-settings-path
3+
4+
name: Maven Package
5+
6+
on:
7+
release:
8+
types: [created]
9+
10+
jobs:
11+
build:
12+
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: read
16+
packages: write
17+
18+
steps:
19+
- uses: actions/checkout@v4
20+
- name: Set up JDK 11
21+
uses: actions/setup-java@v4
22+
with:
23+
java-version: '11'
24+
distribution: 'temurin'
25+
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
26+
settings-path: ${{ github.workspace }} # location for the settings.xml file
27+
28+
- name: Build with Maven
29+
run: mvn -B package --file pom.xml
30+
31+
- name: Publish to GitHub Packages Apache Maven
32+
run: mvn deploy -s $GITHUB_WORKSPACE/settings.xml
33+
env:
34+
GITHUB_TOKEN: ${{ github.token }}

.github/workflows/maven.yml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,7 @@
88

99
name: Java CI with Maven
1010

11-
on:
12-
push:
13-
branches: [ "**" ]
14-
pull_request:
15-
branches: [ "**" ]
11+
on: [push, pull_request]
1612

1713
jobs:
1814
build:
@@ -21,10 +17,10 @@ jobs:
2117

2218
steps:
2319
- uses: actions/checkout@v4
24-
- name: Set up JDK 8
25-
uses: actions/setup-java@v3
20+
- name: Set up JDK 17
21+
uses: actions/setup-java@v4
2622
with:
27-
java-version: '8'
23+
java-version: '17'
2824
distribution: 'temurin'
2925
cache: maven
3026
- name: Build with Maven
@@ -35,6 +31,6 @@ jobs:
3531
uses: advanced-security/maven-dependency-submission-action@571e99aab1055c2e71a1e2309b9691de18d6b7d6
3632

3733
- name: Upload coverage reports to Codecov
38-
uses: codecov/codecov-action@v4.0.1
34+
uses: codecov/codecov-action@v5
3935
with:
4036
token: ${{ secrets.CODECOV_TOKEN }}

0 commit comments

Comments
 (0)