Skip to content

Commit 78947b1

Browse files
committed
Maven build and publish
1 parent 7f5eedd commit 78947b1

File tree

2 files changed

+66
-0
lines changed

2 files changed

+66
-0
lines changed

.github/workflows/maven-build.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven
3+
4+
name: Maven Test and Build
5+
6+
on:
7+
push:
8+
branches:
9+
- master
10+
pull_request:
11+
branches:
12+
- master
13+
14+
jobs:
15+
build:
16+
17+
runs-on: ubuntu-latest
18+
strategy:
19+
matrix:
20+
java: ['21']
21+
22+
steps:
23+
- uses: actions/checkout@v4
24+
- name: Set up Java ${{ matrix.java }}
25+
uses: actions/setup-java@v4
26+
with:
27+
java-version: ${{ matrix.java }}
28+
distribution: 'temurin'
29+
cache: maven
30+
- name: Build with Maven
31+
run: mvn -B package --file pom.xml
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
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 Publish Snapshot
5+
6+
on:
7+
push:
8+
branches:
9+
- master
10+
11+
jobs:
12+
build:
13+
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: read
17+
packages: write
18+
19+
steps:
20+
- uses: actions/checkout@v4
21+
- name: Set up JDK 21
22+
uses: actions/setup-java@v4
23+
with:
24+
java-version: '21'
25+
distribution: 'temurin'
26+
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
27+
settings-path: ${{ github.workspace }} # ___location for the settings.xml file
28+
29+
- name: Build with Maven
30+
run: mvn -B package --file pom.xml
31+
32+
- name: Publish to GitHub Packages Apache Maven
33+
run: mvn deploy -s $GITHUB_WORKSPACE/settings.xml
34+
env:
35+
GITHUB_TOKEN: ${{ github.token }}

0 commit comments

Comments
 (0)