Skip to content

Commit c419810

Browse files
committed
Add Github actions and publishing flow
1 parent e1dbc3b commit c419810

File tree

3 files changed

+76
-0
lines changed

3 files changed

+76
-0
lines changed

.github/workflows/maven-publish.yml

+34
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 17
21+
uses: actions/setup-java@v4
22+
with:
23+
java-version: '17'
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

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
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+
# This workflow uses actions that are not certified by GitHub.
5+
# They are provided by a third-party and are governed by
6+
# separate terms of service, privacy policy, and support
7+
# documentation.
8+
9+
name: Java CI with Maven
10+
11+
on:
12+
push:
13+
branches: [ "main" ]
14+
pull_request:
15+
branches: [ "main" ]
16+
17+
jobs:
18+
build:
19+
20+
runs-on: ubuntu-latest
21+
22+
steps:
23+
- uses: actions/checkout@v4
24+
- name: Set up JDK 17
25+
uses: actions/setup-java@v4
26+
with:
27+
java-version: '17'
28+
distribution: 'temurin'
29+
cache: maven
30+
- name: Build with Maven
31+
run: mvn -B package --file pom.xml
32+
33+
# Optional: Uploads the full dependency graph to GitHub to improve the quality of Dependabot alerts this repository can receive
34+
- name: Update dependency graph
35+
uses: advanced-security/maven-dependency-submission-action@571e99aab1055c2e71a1e2309b9691de18d6b7d6

pom.xml

+7
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@
2323
<version>${gson.version}</version>
2424
</dependency>
2525
</dependencies>
26+
<distributionManagement>
27+
<repository>
28+
<id>github</id>
29+
<name>coderphonui</name>
30+
<url>https://maven.pkg.github.com/coderphonui/jsonautorepair</url>
31+
</repository>
32+
</distributionManagement>
2633
<build>
2734
<plugins>
2835
<plugin>

0 commit comments

Comments
 (0)