Update maven.yml
This commit is contained in:
parent
4d61117d7f
commit
3dc9d904c9
1 changed files with 31 additions and 21 deletions
50
.github/workflows/maven.yml
vendored
50
.github/workflows/maven.yml
vendored
|
@ -1,32 +1,42 @@
|
||||||
name: Java Build and File Update
|
|
||||||
|
|
||||||
|
name: Java Maven Build & Publish Artifact
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches: [ "main" ]
|
||||||
- main
|
pull_request:
|
||||||
|
branches: [ "main" ]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build_test:
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- uses: actions/checkout@v3
|
||||||
uses: actions/checkout@v2
|
- name: Set up JDK 17
|
||||||
|
uses: actions/setup-java@v3
|
||||||
- name: Set up JDK
|
|
||||||
uses: actions/setup-java@v2
|
|
||||||
with:
|
with:
|
||||||
java-version: '17'
|
java-version: '17'
|
||||||
distribution: 'adopt'
|
distribution: 'temurin'
|
||||||
server-id: 'github'
|
cache: maven
|
||||||
server-username: ${{ github.actor }}
|
- name: Build with Maven
|
||||||
server-password: ${{ secrets.GITHUB_TOKEN }}
|
run: mvn -B package --file pom.xml
|
||||||
|
|
||||||
- name: Build Java project with Maven
|
|
||||||
run: mvn clean package
|
|
||||||
|
|
||||||
- name: Create builds directory
|
publish-job:
|
||||||
run: mkdir -p builds
|
runs-on: ubuntu-latest
|
||||||
|
needs: build_test
|
||||||
- name: Copy JAR file to builds directory
|
steps:
|
||||||
run: cp -r target/*.jar builds/
|
- 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