diff --git a/.github/workflows/multiOSReleases.yml b/.github/workflows/multiOSReleases.yml new file mode 100644 index 000000000..6b610ad09 --- /dev/null +++ b/.github/workflows/multiOSReleases.yml @@ -0,0 +1,86 @@ +name: Test Installers Build + +on: + push: + branches: + - testStuff + workflow_dispatch: + +permissions: + contents: write + packages: write + +jobs: + build-installers: + strategy: + matrix: + include: + - os: windows-latest + platform: win + ext: exe + - os: macos-latest + platform: mac + ext: dmg + - os: ubuntu-latest + platform: linux + ext: deb + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v4 + + - name: Set up JDK 21 + uses: actions/setup-java@v4 + with: + java-version: "21" + distribution: "temurin" + + - uses: gradle/actions/setup-gradle@v4 + with: + gradle-version: 8.7 + + # Install Windows dependencies + - name: Install WiX Toolset + if: matrix.os == 'windows-latest' + run: | + curl -L -o wix.exe https://github.com/wixtoolset/wix3/releases/download/wix3141rtm/wix314.exe + .\wix.exe /install /quiet + + # Install Linux dependencies + - name: Install Linux Dependencies + if: matrix.os == 'ubuntu-latest' + run: | + sudo apt-get update + sudo apt-get install -y fakeroot rpm + + # Get version number + - name: Get version number + id: versionNumber + run: echo "versionNumber=$(./gradlew printVersion --quiet | tail -1)" >> $GITHUB_OUTPUT + shell: bash + + # Build installer + - name: Build Installer + run: ./gradlew jpackage + + # Rename and collect artifacts based on OS + - name: Prepare artifacts + id: prepare + shell: bash + run: | + if [ "${{ matrix.os }}" = "windows-latest" ]; then + mv Stirling-PDF.exe "Stirling-PDF-${{ steps.versionNumber.outputs.versionNumber }}-${{ matrix.platform }}.${{ matrix.ext }}" + elif [ "${{ matrix.os }}" = "macos-latest" ]; then + mv build/jpackage/Stirling-PDF-${{ steps.versionNumber.outputs.versionNumber }}.dmg "Stirling-PDF-${{ steps.versionNumber.outputs.versionNumber }}-${{ matrix.platform }}.${{ matrix.ext }}" + else + mv build/jpackage/stirling-pdf_${{ steps.versionNumber.outputs.versionNumber }}-1_amd64.deb "Stirling-PDF-${{ steps.versionNumber.outputs.versionNumber }}-${{ matrix.platform }}.${{ matrix.ext }}" + fi + + # Upload installer as artifact for testing + - name: Upload Installer Artifact + uses: actions/upload-artifact@v4 + with: + name: Stirling-PDF-${{ matrix.platform }}.${{ matrix.ext }} + path: Stirling-PDF-${{ steps.versionNumber.outputs.versionNumber }}-${{ matrix.platform }}.${{ matrix.ext }} + retention-days: 1 + if-no-files-found: error diff --git a/build.gradle b/build.gradle index 5363a4cc4..ed557e065 100644 --- a/build.gradle +++ b/build.gradle @@ -8,6 +8,7 @@ plugins { id "com.diffplug.spotless" version "6.25.0" id "com.github.jk1.dependency-license-report" version "2.9" //id "nebula.lint" version "19.0.3" + id("org.panteleyev.jpackageplugin") version "1.6.0" } @@ -87,6 +88,114 @@ openApi { outputFileName = "SwaggerDoc.json" } +jpackage { + // Input directory containing the jar + input = "build/libs" + + // Application details + appName = "Stirling-PDF" + appVersion = "0.36.3" + vendor = "Stirling-Software" + + // Main application configuration + mainJar = "Stirling-PDF-${project.version}.jar" + mainClass = "stirling.software.SPDF.StirlingPdfApplication" + + // Default icon configuration + icon = "src/main/resources/static/favicon.ico" + + // Application description + appDescription = "Stirling PDF - Your Local PDF Editor" + + // JVM Options + javaOptions = [ + "-DBROWSER_OPEN=true", + "-DSTIRLING_PDF_DESKTOP_UI=true" + ] + + // Enable verbose output + verbose = true + + // Windows-specific configuration + windows { + winConsole = false + winDirChooser = true + winMenu = true + winShortcut = true + winPerUserInstall = true + winMenuGroup = "Stirling Software" + winUpgradeUuid = "2a43ed0c-b8c2-40cf-89e1-751129b87641" // Unique identifier for updates + winHelpUrl = "https://github.com/Stirling-Tools/Stirling-PDF" + winUpdateUrl = "https://github.com/Stirling-Tools/Stirling-PDF/releases" + type = "exe" + } + + // macOS-specific configuration + mac { + icon = "src/main/resources/static/favicon.icns" + type = "dmg" + macPackageIdentifier = "com.stirling.software.pdf" + macPackageName = "Stirling-PDF" + macAppCategory = "public.app-category.productivity" + macSign = false // Enable signing + macAppStore = false // Not targeting App Store initially + + // Add license and other documentation to DMG + macDmgContent = [ + "README.md", + "LICENSE", + "CHANGELOG.md" + ] + + // Enable Mac-specific entitlements + //macEntitlements = "entitlements.plist" // You'll need to create this file + } + + // Linux-specific configuration + linux { + icon = "src/main/resources/static/favicon.png" + type = "deb" // Can also use "rpm" for Red Hat-based systems + + // Debian package configuration + linuxPackageName = "stirling-pdf" + linuxDebMaintainer = "support@stirling-software.com" + linuxMenuGroup = "Office;PDF;Productivity" + linuxAppCategory = "Office" + linuxAppRelease = "1" + linuxPackageDeps = true + linuxShortcut = true + + // RPM-specific settings + linuxRpmLicenseType = "MIT" + } + + // Common additional options + //jLinkOptions = [ + // "--strip-debug", + // "--compress=2", + // "--no-header-files", + // "--no-man-pages" + //] + + // Add any additional modules required + /*addModules = [ + "java.base", + "java.desktop", + "java.logging", + "java.sql", + "java.xml", + "jdk.crypto.ec" + ]*/ + + // Add copyright and license information + copyright = "Copyright © 2024 Stirling Software" + licenseFile = "LICENSE" + + // Set installation directory + installDir = "Stirling-PDF" +} + + launch4j { icon = "${projectDir}/src/main/resources/static/favicon.ico" diff --git a/src/main/resources/static/favicon.icns b/src/main/resources/static/favicon.icns new file mode 100644 index 000000000..7b281937e Binary files /dev/null and b/src/main/resources/static/favicon.icns differ