Update maven.yml

This commit is contained in:
potzplitz 2024-03-03 11:26:14 +01:00 committed by GitHub
parent 4d61117d7f
commit 3dc9d904c9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,32 +1,42 @@
name: Java Build and File Update
name: Java Maven Build & Publish Artifact
on:
push:
branches:
- main
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
build_test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up JDK
uses: actions/setup-java@v2
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'adopt'
server-id: 'github'
server-username: ${{ github.actor }}
server-password: ${{ secrets.GITHUB_TOKEN }}
distribution: 'temurin'
cache: maven
- name: Build with Maven
run: mvn -B package --file pom.xml
- name: Build Java project with Maven
run: mvn clean package
- name: Create builds directory
run: mkdir -p builds
- name: Copy JAR file to builds directory
run: cp -r target/*.jar builds/
publish-job:
runs-on: ubuntu-latest
needs: build_test
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- run: mvn --batch-mode --update-snapshots verify
- run: mkdir staging && cp target/*.jar staging
- uses: actions/upload-artifact@v3
with:
name: Package
path: staging