55 lines
1.3 KiB
YAML
55 lines
1.3 KiB
YAML
name: Build the Jar
|
|
|
|
on:
|
|
push:
|
|
branches: [ main ]
|
|
pull_request:
|
|
branches: [ main ]
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-24.04
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up JDK 20
|
|
uses: actions/setup-java@v5
|
|
with:
|
|
java-version: '20'
|
|
distribution: 'temurin'
|
|
|
|
- name: Create output directories
|
|
run: |
|
|
mkdir -p out/production/Calc
|
|
mkdir -p dist
|
|
|
|
- name: Compile Java files
|
|
run: |
|
|
javac -encoding UTF-8 -cp "lib/flatlaf-3.7.jar" -d out/production/Calc \
|
|
$(find src/main/java -name "*.java")
|
|
|
|
- name: Copy resources
|
|
run: |
|
|
if [ -d "src/main/resources" ]; then
|
|
cp -r src/main/resources/* out/production/Calc/ 2>/dev/null || true
|
|
fi
|
|
|
|
- name: Create manifest
|
|
run: |
|
|
echo "Manifest-Version: 1.0" > manifest.txt
|
|
echo "Main-Class: dev.sillyangel.calc.Calculator" >> manifest.txt
|
|
echo "Class-Path: lib/flatlaf-3.7.jar" >> manifest.txt
|
|
|
|
- name: Create JAR
|
|
run: |
|
|
cd out/production/Calc
|
|
jar cfm ../../../dist/CalcShortforCalculator.jar ../../../manifest.txt .
|
|
cd ../../..
|
|
|
|
- name: Upload JAR artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: CalcShortforCalculator
|
|
path: dist/CalcShortforCalculator.jar
|