Skip to content

Commit 1cea1ba

Browse files
committed
ci: Make the publishing into maven repo automatic.
1 parent fa993d0 commit 1cea1ba

File tree

1 file changed

+23
-24
lines changed

1 file changed

+23
-24
lines changed

.github/workflows/maven-publish.yml

+23-24
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,29 @@
11
# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created
22
# For more information see: https://github.com/actions/setup-java#apache-maven-with-a-settings-path
33

4-
name: Maven Package
4+
name: Maven Package to Unnamed Repo and github packages
55

66
on:
7-
release:
8-
types: released
9-
7+
release:
8+
types: [created]
109
jobs:
11-
build:
12-
13-
runs-on: ubuntu-latest
14-
15-
steps:
16-
- uses: actions/checkout@v2
17-
- name: Set up JDK 1.8
18-
uses: actions/setup-java@v1
19-
with:
20-
java-version: 1.8
21-
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
22-
settings-path: ${{ github.workspace }} # location for the settings.xml file
23-
24-
- name: Build with Maven
25-
run: mvn -B package --file pom.xml
26-
27-
- name: Publish to GitHub Packages Apache Maven
28-
run: mvn deploy -s $GITHUB_WORKSPACE/settings.xml
29-
env:
30-
GITHUB_TOKEN: ${{ github.token }}
10+
publish:
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: read
14+
packages: write
15+
steps:
16+
- uses: actions/checkout@v4
17+
- name: Set up Java for publishing to unnamed repo
18+
uses: actions/setup-java@v3
19+
with:
20+
java-version: '17'
21+
distribution: 'temurin'
22+
server-id: unnamed-releases
23+
server-username: MAVEN_USERNAME
24+
server-password: MAVEN_PASSWORD
25+
- name: Publish to unnamed repo
26+
run: mvn --batch-mode deploy
27+
env:
28+
MAVEN_USERNAME: ${{ secrets.USERNAME }}
29+
MAVEN_PASSWORD: ${{ secrets.TOKEN }}

0 commit comments

Comments
 (0)