Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
205b849f25 | ||
|
|
16adfe1f59 | ||
|
|
397352c9f1 | ||
|
|
97675c2320 | ||
|
|
f4cfcb2ac7 | ||
|
|
56729648e9 | ||
|
|
2317642fdc |
67
.github/workflows/mac-unix-artifact-creation.yml
vendored
Normal file
67
.github/workflows/mac-unix-artifact-creation.yml
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
name: Create Application Bundles
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- 'mac'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
create-unix-bundle:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up JDK
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
java-version: '21'
|
||||
distribution: 'temurin'
|
||||
|
||||
- name: Build with Gradle
|
||||
run: ./gradlew bootJar
|
||||
|
||||
- name: Create tar.gz Bundle
|
||||
run: |
|
||||
mkdir -p Stirling-PDF-unix
|
||||
cp build/libs/Stirling-PDF-*.jar Stirling-PDF-unix/Stirling-PDF.jar
|
||||
cp scripts/launcher.sh Stirling-PDF-unix/Stirling-PDF
|
||||
cp src/main/resources/static/favicon.ico Stirling-PDF-unix/icon.png
|
||||
chmod +x Stirling-PDF-unix/Stirling-PDF
|
||||
tar -czf Stirling-PDF-unix.tar.gz Stirling-PDF-unix/
|
||||
|
||||
- name: Upload Unix Bundle
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: unix-bundle
|
||||
path: Stirling-PDF-unix.tar.gz
|
||||
|
||||
create-mac-bundle:
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up JDK
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
java-version: '21'
|
||||
distribution: 'temurin'
|
||||
|
||||
- name: Build with Gradle
|
||||
run: ./gradlew bootJar
|
||||
|
||||
- name: Create Mac App Bundle
|
||||
run: |
|
||||
cp build/libs/Stirling-PDF-*.jar build/libs/Stirling-PDF.jar
|
||||
chmod +x scripts/create-mac-launcher.sh
|
||||
./scripts/create-mac-launcher.sh
|
||||
|
||||
- name: Create DMG
|
||||
run: |
|
||||
hdiutil create -volname "Stirling-PDF" -srcfolder "Stirling-PDF.app" -ov -format UDZO "Stirling-PDF-mac.dmg"
|
||||
|
||||
- name: Upload Mac Bundle
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: mac-bundle
|
||||
path: Stirling-PDF-mac.dmg
|
||||
76
scripts/create-mac-launcher.sh
Normal file
76
scripts/create-mac-launcher.sh
Normal file
@@ -0,0 +1,76 @@
|
||||
#!/bin/bash
|
||||
# scripts/create-mac-launcher.sh
|
||||
|
||||
# Create app structure
|
||||
APP_NAME="Stirling-PDF"
|
||||
APP_BUNDLE="$APP_NAME.app"
|
||||
mkdir -p "$APP_BUNDLE/Contents/"{MacOS,Resources,Java}
|
||||
|
||||
# Convert icon
|
||||
sips -s format icns "src/main/resources/static/favicon.ico" --out "$APP_BUNDLE/Contents/Resources/AppIcon.icns"
|
||||
|
||||
# Create Info.plist
|
||||
cat > "$APP_BUNDLE/Contents/Info.plist" << EOF
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$APP_NAME</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>AppIcon</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.frooodle.stirlingpdf</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>$APP_NAME</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>10.10.0</string>
|
||||
<key>LSEnvironment</key>
|
||||
<dict>
|
||||
<key>BROWSER_OPEN</key>
|
||||
<string>true</string>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
EOF
|
||||
|
||||
# Create launcher script
|
||||
cat > "$APP_BUNDLE/Contents/MacOS/$APP_NAME" << 'EOF'
|
||||
#!/bin/bash
|
||||
|
||||
# Configuration
|
||||
MIN_JAVA_VERSION="17"
|
||||
PREFERRED_JAVA_VERSION="21"
|
||||
JAVA_DOWNLOAD_URL="https://download.oracle.com/java/21/latest/jdk-21_macos-x64_bin.dmg"
|
||||
|
||||
# Check Java version
|
||||
if type -p java > /dev/null; then
|
||||
_java=java
|
||||
elif [[ -n "$JAVA_HOME" ]] && [[ -x "$JAVA_HOME/bin/java" ]]; then
|
||||
_java="$JAVA_HOME/bin/java"
|
||||
else
|
||||
osascript -e 'display dialog "Java not found. Please install Java 21." buttons {"Download Java", "Cancel"} default button "Download Java"' \
|
||||
&& open "$JAVA_DOWNLOAD_URL"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
version=$("$_java" -version 2>&1 | awk -F '"' '/version/ {print $2}' | cut -d'.' -f1)
|
||||
if [[ "$version" -lt "$MIN_JAVA_VERSION" ]]; then
|
||||
osascript -e 'display dialog "Wrong Java version. Please install Java 21." buttons {"Download Java", "Cancel"} default button "Download Java"' \
|
||||
&& open "$JAVA_DOWNLOAD_URL"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Run application
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
exec java -jar "$DIR/../Java/Stirling-PDF.jar" "$@"
|
||||
EOF
|
||||
|
||||
chmod +x "$APP_BUNDLE/Contents/MacOS/$APP_NAME"
|
||||
|
||||
# Copy JAR file
|
||||
cp "build/libs/Stirling-PDF.jar" "$APP_BUNDLE/Contents/Java/"
|
||||
36
scripts/create-unix-launcher.sh
Normal file
36
scripts/create-unix-launcher.sh
Normal file
@@ -0,0 +1,36 @@
|
||||
#!/bin/bash
|
||||
# scripts/create-unix-launcher.sh
|
||||
|
||||
cat > launcher.sh << 'EOF'
|
||||
#!/bin/bash
|
||||
|
||||
# Configuration
|
||||
APP_NAME="Stirling-PDF"
|
||||
MIN_JAVA_VERSION="17"
|
||||
PREFERRED_JAVA_VERSION="21"
|
||||
JAVA_DOWNLOAD_URL="https://download.oracle.com/java/21/latest/jdk-21_linux-x64_bin.tar.gz"
|
||||
BROWSER_OPEN="true"
|
||||
|
||||
# Check Java version
|
||||
if type -p java > /dev/null; then
|
||||
_java=java
|
||||
elif [[ -n "$JAVA_HOME" ]] && [[ -x "$JAVA_HOME/bin/java" ]]; then
|
||||
_java="$JAVA_HOME/bin/java"
|
||||
else
|
||||
echo "Java not found. Please install Java 21."
|
||||
xdg-open "$JAVA_DOWNLOAD_URL"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
version=$("$_java" -version 2>&1 | awk -F '"' '/version/ {print $2}' | cut -d'.' -f1)
|
||||
if [[ "$version" -lt "$MIN_JAVA_VERSION" ]]; then
|
||||
echo "Java version $version detected. Please install Java 21."
|
||||
xdg-open "$JAVA_DOWNLOAD_URL"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Run application
|
||||
exec java -jar "$(dirname "$0")/Stirling-PDF.jar" "$@"
|
||||
EOF
|
||||
|
||||
chmod +x launcher.sh
|
||||
28
scripts/scripts/launcher.sh
Normal file
28
scripts/scripts/launcher.sh
Normal file
@@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Configuration
|
||||
MIN_JAVA_VERSION="17"
|
||||
PREFERRED_JAVA_VERSION="21"
|
||||
JAVA_DOWNLOAD_URL="https://download.oracle.com/java/21/latest/jdk-21_linux-x64_bin.tar.gz"
|
||||
BROWSER_OPEN="true"
|
||||
|
||||
# Check Java version
|
||||
if type -p java > /dev/null; then
|
||||
_java=java
|
||||
elif [[ -n "$JAVA_HOME" ]] && [[ -x "$JAVA_HOME/bin/java" ]]; then
|
||||
_java="$JAVA_HOME/bin/java"
|
||||
else
|
||||
echo "Java not found. Please install Java 21."
|
||||
xdg-open "$JAVA_DOWNLOAD_URL"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
version=$("$_java" -version 2>&1 | awk -F '"' '/version/ {print $2}' | cut -d'.' -f1)
|
||||
if [[ "$version" -lt "$MIN_JAVA_VERSION" ]]; then
|
||||
echo "Java version $version detected. Please install Java 21."
|
||||
xdg-open "$JAVA_DOWNLOAD_URL"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Run application
|
||||
exec java -jar "$(dirname "$0")/Stirling-PDF.jar" "$@"
|
||||
Reference in New Issue
Block a user