Skip to content

Commit

Permalink
ci: Make the publishing into maven repo automatic.
Browse files Browse the repository at this point in the history
  • Loading branch information
FixedDev committed Dec 29, 2023
1 parent fa993d0 commit 1cea1ba
Showing 1 changed file with 23 additions and 24 deletions.
47 changes: 23 additions & 24 deletions .github/workflows/maven-publish.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,29 @@
# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created
# For more information see: https://github.com/actions/setup-java#apache-maven-with-a-settings-path

name: Maven Package
name: Maven Package to Unnamed Repo and github packages

on:
release:
types: released

release:
types: [created]
jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
settings-path: ${{ github.workspace }} # location for the settings.xml file

- name: Build with Maven
run: mvn -B package --file pom.xml

- name: Publish to GitHub Packages Apache Maven
run: mvn deploy -s $GITHUB_WORKSPACE/settings.xml
env:
GITHUB_TOKEN: ${{ github.token }}
publish:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- name: Set up Java for publishing to unnamed repo
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
server-id: unnamed-releases
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
- name: Publish to unnamed repo
run: mvn --batch-mode deploy
env:
MAVEN_USERNAME: ${{ secrets.USERNAME }}
MAVEN_PASSWORD: ${{ secrets.TOKEN }}

0 comments on commit 1cea1ba

Please sign in to comment.