Skip to content

Commit a855654

Browse files
authored
Update maven-publish.yml
1 parent ea1e6e5 commit a855654

File tree

1 file changed

+18
-19
lines changed

1 file changed

+18
-19
lines changed
Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
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+
14
name: Maven Package
25

36
on:
@@ -6,30 +9,26 @@ on:
69

710
jobs:
811
build:
12+
913
runs-on: ubuntu-latest
1014
permissions:
1115
contents: read
1216
packages: write
1317

1418
steps:
15-
- name: Checkout Repository
16-
uses: actions/checkout@v4
17-
18-
- name: Set up JDK 21
19-
uses: actions/setup-java@v4
20-
with:
21-
java-version: '21'
22-
distribution: 'temurin'
23-
server-id: github
24-
server-username: ${{ github.actor }}
25-
server-password: ${{ secrets.TOKEN_GITHUB }}
26-
settings-path: ${{ github.workspace }}
19+
- uses: actions/checkout@v4
20+
- name: Set up JDK 21
21+
uses: actions/setup-java@v4
22+
with:
23+
java-version: '21'
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
2727

28-
- name: Build with Maven
29-
run: mvn clean install
28+
- name: Build with Maven
29+
run: mvn -B package --file pom.xml
3030

31-
- name: Publish to GitHub Packages
32-
run: mvn deploy -X -s ${{ github.workspace }}/settings.xml -DaltDeploymentRepository=github::https://maven.pkg.github.com/gabrielldn/java-api-with-otlp-sdk
33-
env:
34-
USERNAME: ${{ github.actor }}
35-
TOKEN: ${{ secrets.TOKEN_GITHUB }}
31+
- name: Publish to GitHub Packages Apache Maven
32+
run: mvn deploy -s $GITHUB_WORKSPACE/settings.xml
33+
env:
34+
GITHUB_TOKEN: ${{ github.token }}

0 commit comments

Comments
 (0)