Skip to content

Commit 1163894

Browse files
add github action
1 parent b0da09f commit 1163894

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

.github/workflows/maven-publish.yml

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
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+
workflow_dispatch:
10+
inputs:
11+
logLevel:
12+
description: 'Log level'
13+
required: true
14+
default: 'warning'
15+
type: choice
16+
options:
17+
- info
18+
- warning
19+
- debug
20+
21+
jobs:
22+
build:
23+
24+
runs-on: ubuntu-latest
25+
permissions:
26+
contents: read
27+
packages: write
28+
29+
steps:
30+
- uses: actions/checkout@v3
31+
- name: Set up JDK 18
32+
uses: actions/setup-java@v3
33+
with:
34+
java-version: '18'
35+
distribution: 'temurin'
36+
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
37+
settings-path: ${{ github.workspace }} # location for the settings.xml file
38+
39+
- name: Build with Maven
40+
env:
41+
GITHUB_TOKEN: ${{ secrets.MAVEN_REGISTRY_TOKEN }}
42+
run: mvn -B package -s $GITHUB_WORKSPACE/settings.xml --file pom.xml
43+
44+
- name: Publish to GitHub Packages Apache Maven
45+
run: mvn deploy -s $GITHUB_WORKSPACE/settings.xml
46+
env:
47+
GITHUB_TOKEN: ${{ secrets.MAVEN_REGISTRY_TOKEN }}

0 commit comments

Comments
 (0)