mirror of
https://github.com/davidalves04/Trabalho-Pratico-SD.git
synced 2025-12-08 20:43:32 +00:00
63 lines
1.4 KiB
YAML
63 lines
1.4 KiB
YAML
name: Java CI with Maven
|
|
|
|
on:
|
|
push:
|
|
branches: [ "dev", "cleanup" ]
|
|
tags:
|
|
- 'v*.*.*'
|
|
pull_request:
|
|
branches: [ "main" ]
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up JDK 17
|
|
uses: actions/setup-java@v4
|
|
with:
|
|
java-version: '17'
|
|
distribution: 'temurin'
|
|
cache: maven
|
|
|
|
- name: Build with Maven
|
|
# mvn package includes the 'test' phase, so unit tests run here automatically.
|
|
run: mvn -B package
|
|
working-directory: main
|
|
|
|
- name: Upload built JAR
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: package
|
|
path: main/target/*.jar
|
|
|
|
- name: Generate dependency graph
|
|
run: mvn -B -f main/pom.xml com.github.ferstl:depgraph-maven-plugin:4.0.1:graph
|
|
|
|
- name: Upload dependency graph artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: dependency-graph
|
|
path: main/target/**
|
|
|
|
publish-release:
|
|
runs-on: ubuntu-latest
|
|
needs: [build]
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
permissions:
|
|
contents: write
|
|
|
|
steps:
|
|
- name: Download built JAR
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: package
|
|
path: main/target/
|
|
|
|
- name: Create GitHub Release
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
files: main/target/*.jar
|