mirror of
https://github.com/davidalves04/Trabalho-Pratico-SD.git
synced 2025-12-08 12:33:31 +00:00
Add Windows build job to Maven workflow
This commit is contained in:
91
.github/workflows/maven.yml
vendored
91
.github/workflows/maven.yml
vendored
@@ -11,10 +11,35 @@ on:
|
||||
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
|
||||
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/**
|
||||
|
||||
build-windows:
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up JDK 17
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
@@ -22,41 +47,67 @@ jobs:
|
||||
distribution: 'temurin'
|
||||
cache: maven
|
||||
|
||||
- name: Build with Maven
|
||||
# mvn package includes the 'test' phase, so unit tests run here automatically.
|
||||
run: mvn -B package
|
||||
- name: Build with Maven (Skip Tests)
|
||||
# We skip tests here because they ran on Linux already; saves billable minutes.
|
||||
run: mvn -B package -DskipTests
|
||||
working-directory: main
|
||||
|
||||
- name: Upload built JAR
|
||||
- name: Create JPackage App Image
|
||||
shell: pwsh
|
||||
run: |
|
||||
# Create output directory to avoid recursive copying (Ouroboros fix)
|
||||
New-Item -ItemType Directory -Force -Path "dist"
|
||||
|
||||
# Run jpackage
|
||||
# Adjust 'main-1.0-SNAPSHOT.jar' if your pom versioning differs
|
||||
jpackage --name "DTSS" `
|
||||
--input main/target `
|
||||
--main-jar main-1.0-SNAPSHOT.jar `
|
||||
--dest dist `
|
||||
--type app-image `
|
||||
--win-console
|
||||
|
||||
- name: Inject java.exe (Fix Process Spawning)
|
||||
shell: pwsh
|
||||
run: |
|
||||
# Your code spawns 'bin/java'. We must copy it from the host JDK into the bundle.
|
||||
$javaPath = (Get-Command java).Source
|
||||
Copy-Item -Path $javaPath -Destination "dist/DTSS/runtime/bin/"
|
||||
Write-Host "Injected java.exe into runtime/bin for process spawning support."
|
||||
|
||||
- name: Zip Windows Release
|
||||
shell: pwsh
|
||||
run: |
|
||||
Compress-Archive -Path "dist/DTSS" -DestinationPath "dist/DTSS-Windows.zip"
|
||||
|
||||
- name: Upload Windows Artifact
|
||||
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/**
|
||||
name: windows-package
|
||||
path: dist/DTSS-Windows.zip
|
||||
|
||||
publish-release:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [build]
|
||||
needs: [build, build-windows]
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
steps:
|
||||
- name: Download built JAR
|
||||
- name: Download Linux JAR
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: package
|
||||
path: main/target/
|
||||
|
||||
- name: Download Windows Zip
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: windows-package
|
||||
path: windows-dist/
|
||||
|
||||
- name: Create GitHub Release
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
files: main/target/*.jar
|
||||
files: |
|
||||
main/target/*.jar
|
||||
windows-dist/*.zip
|
||||
|
||||
Reference in New Issue
Block a user