Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 33 additions & 37 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@


name: Java Maven Build & Publish Artifact
name: Java Maven Build & Artifact Download

on:
push:
Expand All @@ -9,41 +7,39 @@ on:
branches: [ "main" ]

jobs:
build_test:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Java 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: maven

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

- name: Upload JAR Artifact
uses: actions/upload-artifact@v4
with:
name: my-built-jar
path: target/*.jar

download:
runs-on: ubuntu-latest
needs: build

steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: maven
- name: Build with Maven
run: mvn -B package --file pom.xml

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'

- name: Build and test with Maven
run: mvn --batch-mode --update-snapshots verify

- name: Upload build artifact
uses: actions/upload-artifact@v3
with:
name: my-app-jar
path: target/*.jar



- name: Download JAR Artifact
uses: actions/download-artifact@v4
with:
name: my-built-jar
path: ./downloaded-artifacts

- name: List downloaded files
run: ls -lh ./downloaded-artifacts