Update maven.yml
This commit is contained in:
parent
4d61117d7f
commit
3dc9d904c9
1 changed files with 31 additions and 21 deletions
52
.github/workflows/maven.yml
vendored
52
.github/workflows/maven.yml
vendored
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue