mirror of
https://github.com/processing/processing4.git
synced 2026-03-14 16:37:42 +01:00
Github actions simplification
This commit is contained in:
18
.github/actions/setup/action.yml
vendored
Normal file
18
.github/actions/setup/action.yml
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
name: "Setup Processing"
|
||||
description: "Setup the required contents for Processing to build"
|
||||
inputs:
|
||||
arch:
|
||||
description: 'Architecture of the JDK to download'
|
||||
required: false
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Install Java
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
java-version: '17'
|
||||
distribution: 'temurin'
|
||||
architecture: ${{ inputs.arch }}
|
||||
|
||||
- name: Setup Gradle
|
||||
uses: gradle/actions/setup-gradle@v4
|
||||
40
.github/workflows/build.yml
vendored
40
.github/workflows/build.yml
vendored
@@ -4,6 +4,12 @@ on:
|
||||
paths-ignore:
|
||||
- '**/*.md'
|
||||
- '.all-contributorsrc'
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- '**/*.md'
|
||||
branches:
|
||||
- main
|
||||
|
||||
|
||||
jobs:
|
||||
test:
|
||||
@@ -12,13 +18,9 @@ jobs:
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Install Java
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
java-version: '17'
|
||||
distribution: 'temurin'
|
||||
- name: Setup Gradle
|
||||
uses: gradle/actions/setup-gradle@v4
|
||||
|
||||
- name: Setup Processing
|
||||
uses: ./.github/actions/setup
|
||||
|
||||
- name: Build with Gradle
|
||||
run: ./gradlew test
|
||||
@@ -33,11 +35,11 @@ jobs:
|
||||
- os: ubuntu-24.04-arm
|
||||
os_prefix: linux
|
||||
arch: aarch64
|
||||
binary: processing*.snap
|
||||
binary: deb/processing*.deb
|
||||
- os: ubuntu-latest
|
||||
os_prefix: linux
|
||||
arch: x64
|
||||
binary: processing*.snap
|
||||
binary: deb/processing*.deb
|
||||
- os: windows-latest
|
||||
os_prefix: windows
|
||||
arch: x64
|
||||
@@ -51,25 +53,13 @@ jobs:
|
||||
arch: aarch64
|
||||
binary: dmg/Processing-*.dmg
|
||||
steps:
|
||||
- name: Install Snapcraft
|
||||
if: runner.os == 'Linux'
|
||||
uses: samuelmeuli/action-snapcraft@v3
|
||||
- name: Install LXD
|
||||
if: runner.os == 'Linux'
|
||||
uses: canonical/setup-lxd@main
|
||||
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Install Java
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
java-version: '17'
|
||||
distribution: 'temurin'
|
||||
architecture: ${{ matrix.arch }}
|
||||
- name: Setup Gradle
|
||||
uses: gradle/actions/setup-gradle@v4
|
||||
|
||||
- name: Build with Gradle
|
||||
- name: Setup Processing
|
||||
uses: ./.github/actions/setup
|
||||
|
||||
- name: Package Processing with Gradle
|
||||
run: ./gradlew packageDistributionForCurrentOS
|
||||
|
||||
- name: Add artifact
|
||||
|
||||
32
.github/workflows/pr.yml
vendored
32
.github/workflows/pr.yml
vendored
@@ -13,13 +13,11 @@ jobs:
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Install Java
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
java-version: '17'
|
||||
distribution: 'temurin'
|
||||
- name: Setup Gradle
|
||||
uses: gradle/actions/setup-gradle@v4
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup Processing
|
||||
uses: ./.github/actions/setup
|
||||
|
||||
- name: Build with Gradle
|
||||
run: ./gradlew test
|
||||
@@ -34,11 +32,11 @@ jobs:
|
||||
- os: ubuntu-24.04-arm
|
||||
os_prefix: linux
|
||||
arch: aarch64
|
||||
binary: processing*.snap
|
||||
binary: deb/processing*.deb
|
||||
- os: ubuntu-latest
|
||||
os_prefix: linux
|
||||
arch: x64
|
||||
binary: processing*.snap
|
||||
binary: deb/processing*.deb
|
||||
- os: windows-latest
|
||||
os_prefix: windows
|
||||
arch: x64
|
||||
@@ -52,23 +50,11 @@ jobs:
|
||||
arch: aarch64
|
||||
binary: dmg/Processing-*.dmg
|
||||
steps:
|
||||
- name: Install Snapcraft
|
||||
if: runner.os == 'Linux'
|
||||
uses: samuelmeuli/action-snapcraft@v3
|
||||
- name: Install LXD
|
||||
if: runner.os == 'Linux'
|
||||
uses: canonical/setup-lxd@main
|
||||
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Install Java
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
java-version: '17'
|
||||
distribution: 'temurin'
|
||||
architecture: ${{ matrix.arch }}
|
||||
- name: Setup Gradle
|
||||
uses: gradle/actions/setup-gradle@v4
|
||||
|
||||
- name: Setup Processing
|
||||
uses: ./.github/actions/setup
|
||||
|
||||
- name: Build with Gradle
|
||||
run: ./gradlew packageDistributionForCurrentOS
|
||||
|
||||
300
.github/workflows/release.yml
vendored
300
.github/workflows/release.yml
vendored
@@ -49,20 +49,16 @@ jobs:
|
||||
asset_name: processing-${{ needs.version.outputs.version }}-reference.zip
|
||||
file: reference.zip
|
||||
|
||||
publish:
|
||||
publish-maven:
|
||||
name: Publish Processing Libraries to Maven Central
|
||||
runs-on: ubuntu-latest
|
||||
needs: version
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Setup Java
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: 17
|
||||
- name: Setup Gradle
|
||||
uses: gradle/actions/setup-gradle@v4
|
||||
|
||||
- name: Setup Processing
|
||||
uses: ./.github/actions/setup
|
||||
|
||||
- name: Build with Gradle
|
||||
run: ./gradlew publish
|
||||
@@ -78,8 +74,8 @@ jobs:
|
||||
|
||||
ORG_GRADLE_PROJECT_version: ${{ needs.version.outputs.version }}
|
||||
ORG_GRADLE_PROJECT_group: ${{ vars.GRADLE_GROUP }}
|
||||
build:
|
||||
name: (${{ matrix.os_prefix }}/${{ matrix.arch }}) Create Processing Release
|
||||
release-windows:
|
||||
name: (windows/${{ matrix.arch }}) Create Processing Release
|
||||
runs-on: ${{ matrix.os }}
|
||||
needs: version
|
||||
permissions:
|
||||
@@ -88,57 +84,16 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- os: ubuntu-24.04-arm
|
||||
os_prefix: linux
|
||||
arch: aarch64
|
||||
binary: ${{ vars.SNAP_NAME }}_${{ needs.version.outputs.version }}_arm64
|
||||
extension: snap
|
||||
- os: ubuntu-latest
|
||||
os_prefix: linux
|
||||
arch: x64
|
||||
binary: ${{ vars.SNAP_NAME }}_${{ needs.version.outputs.version }}_amd64
|
||||
extension: snap
|
||||
- os: windows-latest
|
||||
os_prefix: windows
|
||||
arch: x64
|
||||
binary: msi/Processing-${{ needs.version.outputs.version }}
|
||||
extension: msi
|
||||
- os: macos-latest
|
||||
os_prefix: macos
|
||||
arch: x64
|
||||
binary: dmg/Processing-${{ needs.version.outputs.version }}
|
||||
extension: dmg
|
||||
- os: macos-latest
|
||||
os_prefix: macos
|
||||
arch: aarch64
|
||||
binary: dmg/Processing-${{ needs.version.outputs.version }}
|
||||
extension: dmg
|
||||
- arch: x64
|
||||
os: windows-latest
|
||||
# - arch: aarch64
|
||||
# os: windows-11-arm
|
||||
steps:
|
||||
- name: Install Certificates for Code Signing
|
||||
if: runner.os == 'macOS'
|
||||
continue-on-error: true
|
||||
uses: apple-actions/import-codesign-certs@v3
|
||||
with:
|
||||
p12-file-base64: ${{ secrets.CERTIFICATES_P12 }}
|
||||
p12-password: ${{ secrets.CERTIFICATES_P12_PASSWORD }}
|
||||
|
||||
- name: Install Snapcraft
|
||||
if: runner.os == 'Linux'
|
||||
uses: samuelmeuli/action-snapcraft@v3
|
||||
- name: Install LXD
|
||||
if: runner.os == 'Linux'
|
||||
uses: canonical/setup-lxd@main
|
||||
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Install Java
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
java-version: '17.0.8'
|
||||
distribution: 'temurin'
|
||||
architecture: ${{ matrix.arch }}
|
||||
- name: Setup Gradle
|
||||
uses: gradle/actions/setup-gradle@v4
|
||||
|
||||
- name: Setup Processing
|
||||
uses: ./.github/actions/setup
|
||||
|
||||
- name: Build with Gradle
|
||||
run: ./gradlew packageDistributionForCurrentOS
|
||||
@@ -146,17 +101,8 @@ jobs:
|
||||
ORG_GRADLE_PROJECT_version: ${{ needs.version.outputs.version }}
|
||||
ORG_GRADLE_PROJECT_group: ${{ vars.GRADLE_GROUP }}
|
||||
ORG_GRADLE_PROJECT_revision: ${{ needs.version.outputs.revision }}
|
||||
ORG_GRADLE_PROJECT_compose.desktop.verbose: true
|
||||
ORG_GRADLE_PROJECT_compose.desktop.mac.sign: ${{ secrets.PROCESSING_SIGNING }}
|
||||
ORG_GRADLE_PROJECT_compose.desktop.mac.signing.identity: ${{ secrets.PROCESSING_SIGNING_IDENTITY }}
|
||||
ORG_GRADLE_PROJECT_compose.desktop.mac.notarization.appleID: ${{ secrets.PROCESSING_APPLE_ID }}
|
||||
ORG_GRADLE_PROJECT_compose.desktop.mac.notarization.password: ${{ secrets.PROCESSING_APP_PASSWORD }}
|
||||
ORG_GRADLE_PROJECT_compose.desktop.mac.notarization.teamID: ${{ secrets.PROCESSING_TEAM_ID }}
|
||||
ORG_GRADLE_PROJECT_snapname: ${{ vars.SNAP_NAME }}
|
||||
ORG_GRADLE_PROJECT_snapconfinement: ${{ vars.SNAP_CONFINEMENT }}
|
||||
|
||||
|
||||
- name: Sign files with Trusted Signing
|
||||
if: runner.os == 'Windows'
|
||||
uses: azure/trusted-signing-action@v0
|
||||
with:
|
||||
azure-tenant-id: ${{ secrets.AZURE_TENANT_ID }}
|
||||
@@ -171,24 +117,230 @@ jobs:
|
||||
timestamp-rfc3161: http://timestamp.acs.microsoft.com
|
||||
timestamp-digest: SHA256
|
||||
|
||||
- name: Upload portable version
|
||||
uses: svenstaro/upload-release-action@v2
|
||||
with:
|
||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
asset_name: processing-${{ needs.version.outputs.version }}-windows-${{ matrix.arch }}-portable.zip
|
||||
file: app/build/compose/binaries/main/Processing-${{ needs.version.outputs.version }}.zip
|
||||
|
||||
- name: Upload installer
|
||||
uses: svenstaro/upload-release-action@v2
|
||||
with:
|
||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
asset_name: processing-${{ needs.version.outputs.version }}-windows-${{ matrix.arch }}.msi
|
||||
file: app/build/compose/binaries/main/msi/Processing-${{ needs.version.outputs.version }}.msi
|
||||
|
||||
release-macos:
|
||||
name: (macOS/${{ matrix.arch }}) Create Processing Release
|
||||
runs-on: macos-latest
|
||||
needs: version
|
||||
permissions:
|
||||
contents: write
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- arch: x64
|
||||
- arch: aarch64
|
||||
steps:
|
||||
- name: Install Certificates for Code Signing
|
||||
continue-on-error: true
|
||||
uses: apple-actions/import-codesign-certs@v3
|
||||
with:
|
||||
p12-file-base64: ${{ secrets.CERTIFICATES_P12 }}
|
||||
p12-password: ${{ secrets.CERTIFICATES_P12_PASSWORD }}
|
||||
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Processing
|
||||
uses: ./.github/actions/setup
|
||||
with:
|
||||
arch: ${{ matrix.arch }}
|
||||
|
||||
- name: Build with Gradle
|
||||
run: ./gradlew packageDistributionForCurrentOS
|
||||
env:
|
||||
ORG_GRADLE_PROJECT_version: ${{ needs.version.outputs.version }}
|
||||
ORG_GRADLE_PROJECT_group: ${{ vars.GRADLE_GROUP }}
|
||||
ORG_GRADLE_PROJECT_revision: ${{ needs.version.outputs.revision }}
|
||||
ORG_GRADLE_PROJECT_compose.desktop.verbose: true
|
||||
ORG_GRADLE_PROJECT_compose.desktop.mac.sign: ${{ secrets.PROCESSING_SIGNING }}
|
||||
ORG_GRADLE_PROJECT_compose.desktop.mac.signing.identity: ${{ secrets.PROCESSING_SIGNING_IDENTITY }}
|
||||
ORG_GRADLE_PROJECT_compose.desktop.mac.notarization.appleID: ${{ secrets.PROCESSING_APPLE_ID }}
|
||||
ORG_GRADLE_PROJECT_compose.desktop.mac.notarization.password: ${{ secrets.PROCESSING_APP_PASSWORD }}
|
||||
ORG_GRADLE_PROJECT_compose.desktop.mac.notarization.teamID: ${{ secrets.PROCESSING_TEAM_ID }}
|
||||
|
||||
- name: Upload portables to release
|
||||
uses: svenstaro/upload-release-action@v2
|
||||
with:
|
||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
asset_name: processing-${{ needs.version.outputs.version }}-${{ matrix.os_prefix }}-${{ matrix.arch }}-portable.zip
|
||||
asset_name: processing-${{ needs.version.outputs.version }}-macos-${{ matrix.arch }}-portable.zip
|
||||
file: app/build/compose/binaries/main/Processing-${{ needs.version.outputs.version }}.zip
|
||||
|
||||
- name: Upload installers to release
|
||||
uses: svenstaro/upload-release-action@v2
|
||||
with:
|
||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
asset_name: processing-${{ needs.version.outputs.version }}-${{ matrix.os_prefix }}-${{ matrix.arch }}.${{ matrix.extension }}
|
||||
file: app/build/compose/binaries/main/${{ matrix.binary }}.${{ matrix.extension }}
|
||||
asset_name: processing-${{ needs.version.outputs.version }}-macos-${{ matrix.arch }}.dmg
|
||||
file: app/build/compose/binaries/main/dmg/Processing-${{ needs.version.outputs.version }}.dmg
|
||||
|
||||
release-linux:
|
||||
name: (linux/${{ matrix.arch }}) Create Processing Release
|
||||
runs-on: ${{ matrix.os }}
|
||||
needs: version
|
||||
permissions:
|
||||
contents: write
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- os: ubuntu-24.04-arm
|
||||
arch: aarch64
|
||||
deb: arm64
|
||||
- os: ubuntu-latest
|
||||
arch: x64
|
||||
deb: amd64
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Processing
|
||||
uses: ./.github/actions/setup
|
||||
|
||||
- name: Build with Gradle
|
||||
run: ./gradlew packageDistributionForCurrentOS
|
||||
env:
|
||||
ORG_GRADLE_PROJECT_version: ${{ needs.version.outputs.version }}
|
||||
ORG_GRADLE_PROJECT_group: ${{ vars.GRADLE_GROUP }}
|
||||
ORG_GRADLE_PROJECT_revision: ${{ needs.version.outputs.revision }}
|
||||
ORG_GRADLE_PROJECT_compose.desktop.verbose: true
|
||||
|
||||
- name: Upload portable to release
|
||||
uses: svenstaro/upload-release-action@v2
|
||||
with:
|
||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
asset_name: processing-${{ needs.version.outputs.version }}-linux-${{ matrix.arch }}-portable.zip
|
||||
file: app/build/compose/binaries/main/Processing-${{ needs.version.outputs.version }}.zip
|
||||
|
||||
- name: Upload installer to release
|
||||
uses: svenstaro/upload-release-action@v2
|
||||
with:
|
||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
asset_name: processing-${{ needs.version.outputs.version }}-linux-${{ matrix.arch }}.deb
|
||||
file: app/build/compose/binaries/main/deb/processing_${{ needs.version.outputs.version }}-1_${{ matrix.deb }}.deb
|
||||
|
||||
- name: Add artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: processing_${{ needs.version.outputs.version }}-1_${{ matrix.deb }}.deb
|
||||
retention-days: 1
|
||||
path: app/build/compose/binaries/main/deb/processing_${{ needs.version.outputs.version }}-1_${{ matrix.deb }}.deb
|
||||
|
||||
release-linux-snap:
|
||||
name: (linux/${{ matrix.arch }}) Create Processing Snap Release
|
||||
runs-on: ${{ matrix.os }}
|
||||
needs: [version, release-linux]
|
||||
permissions:
|
||||
contents: write
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- os: ubuntu-24.04-arm
|
||||
arch: aarch64
|
||||
deb: arm64
|
||||
- os: ubuntu-latest
|
||||
arch: x64
|
||||
deb: amd64
|
||||
steps:
|
||||
- name: Install Snapcraft
|
||||
uses: samuelmeuli/action-snapcraft@v3
|
||||
|
||||
- name: Install LXD
|
||||
uses: canonical/setup-lxd@main
|
||||
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Download artifact
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: processing_${{ needs.version.outputs.version }}-1_${{ matrix.deb }}.deb
|
||||
path: app/build/compose/binaries/main/deb/
|
||||
|
||||
- name: Build with Gradle
|
||||
run: ./gradlew packageSnap
|
||||
env:
|
||||
ORG_GRADLE_PROJECT_version: ${{ needs.version.outputs.version }}
|
||||
ORG_GRADLE_PROJECT_group: ${{ vars.GRADLE_GROUP }}
|
||||
ORG_GRADLE_PROJECT_revision: ${{ needs.version.outputs.revision }}
|
||||
ORG_GRADLE_PROJECT_snapname: ${{ vars.SNAP_NAME }}
|
||||
ORG_GRADLE_PROJECT_snapconfinement: ${{ vars.SNAP_CONFINEMENT }}
|
||||
|
||||
- name: Upload snap to release
|
||||
uses: svenstaro/upload-release-action@v2
|
||||
with:
|
||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
asset_name: processing-${{ needs.version.outputs.version }}-linux-${{ matrix.arch }}.snap
|
||||
file: app/build/compose/binaries/main/${{ vars.SNAP_NAME }}_${{ needs.version.outputs.version }}_${{ matrix.deb }}.snap
|
||||
|
||||
- name: Upload snap to Snap Store
|
||||
if: runner.os == 'Linux'
|
||||
run: snapcraft upload --release=beta app/build/compose/binaries/main/${{ matrix.binary }}.${{ matrix.extension }}
|
||||
run: snapcraft upload --release=beta app/build/compose/binaries/main/${{ vars.SNAP_NAME }}_${{ needs.version.outputs.version }}_${{ matrix.deb }}.snap
|
||||
env:
|
||||
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.PROCESSING_SNAPCRAFT_TOKEN }}
|
||||
release-linux-flatpak:
|
||||
name: (linux/${{ matrix.arch }}) Create Processing Flatpak Release
|
||||
runs-on: ${{ matrix.os }}
|
||||
needs: [ version, release-linux ]
|
||||
container:
|
||||
image: ghcr.io/flathub-infra/flatpak-github-actions:gnome-48
|
||||
options: --privileged
|
||||
permissions:
|
||||
contents: write
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- os: ubuntu-24.04-arm
|
||||
arch: aarch64
|
||||
deb: arm64
|
||||
farch: aarch64
|
||||
- os: ubuntu-latest
|
||||
arch: x64
|
||||
deb: amd64
|
||||
farch: x86_64
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
|
||||
- name: Download artifact
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: processing_${{ needs.version.outputs.version }}-1_${{ matrix.deb }}.deb
|
||||
path: app/build/compose/binaries/main/deb/
|
||||
|
||||
- name: Setup Processing
|
||||
uses: ./.github/actions/setup
|
||||
|
||||
- name: Build with Gradle
|
||||
run: ./gradlew generateFlatpakConfiguration
|
||||
env:
|
||||
ORG_GRADLE_PROJECT_version: ${{ needs.version.outputs.version }}
|
||||
ORG_GRADLE_PROJECT_group: ${{ vars.GRADLE_GROUP }}
|
||||
ORG_GRADLE_PROJECT_revision: ${{ needs.version.outputs.revision }}
|
||||
|
||||
- uses: flatpak/flatpak-github-actions/flatpak-builder@v6
|
||||
with:
|
||||
bundle: processing.flatpak
|
||||
manifest-path: app/build/compose/binaries/main/flatpak/org.processing.pde.yml
|
||||
cache-key: flatpak-builder-${{ github.sha }}
|
||||
arch: ${{ matrix.farch }}
|
||||
|
||||
- name: Upload Flatpak to release
|
||||
uses: svenstaro/upload-release-action@v2
|
||||
with:
|
||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
asset_name: processing-${{ needs.version.outputs.version }}-linux-${{ matrix.arch }}.flatpak
|
||||
file: processing.flatpak
|
||||
@@ -167,6 +167,12 @@ tasks.register("lsp-develop"){
|
||||
}
|
||||
|
||||
val version = if(project.version == "unspecified") "1.0.0" else project.version
|
||||
val distributable = { tasks.named<AbstractJPackageTask>("createDistributable").get() }
|
||||
val arch = when (System.getProperty("os.arch")) {
|
||||
"amd64", "x86_64" -> "amd64"
|
||||
"aarch64" -> "arm64"
|
||||
else -> System.getProperty("os.arch")
|
||||
}
|
||||
|
||||
tasks.register<Exec>("installCreateDmg") {
|
||||
onlyIf { OperatingSystem.current().isMacOsX }
|
||||
@@ -176,11 +182,10 @@ tasks.register<Exec>("packageCustomDmg"){
|
||||
onlyIf { OperatingSystem.current().isMacOsX }
|
||||
group = "compose desktop"
|
||||
|
||||
val distributable = tasks.named<AbstractJPackageTask>("createDistributable").get()
|
||||
dependsOn(distributable, "installCreateDmg")
|
||||
dependsOn(distributable(), "installCreateDmg")
|
||||
|
||||
val packageName = distributable.packageName.get()
|
||||
val dir = distributable.destinationDir.get()
|
||||
val packageName = distributable().packageName.get()
|
||||
val dir = distributable().destinationDir.get()
|
||||
val dmg = dir.file("../dmg/$packageName-$version.dmg").asFile
|
||||
val app = dir.file("$packageName.app").asFile
|
||||
|
||||
@@ -235,64 +240,123 @@ tasks.register<Exec>("packageCustomMsi"){
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
tasks.register("generateSnapConfiguration"){
|
||||
onlyIf { OperatingSystem.current().isLinux }
|
||||
|
||||
val distributable = tasks.named<AbstractJPackageTask>("createDistributable").get()
|
||||
dependsOn(distributable)
|
||||
|
||||
val name = findProperty("snapname") as String? ?: rootProject.name
|
||||
val arch = when (System.getProperty("os.arch")) {
|
||||
"amd64", "x86_64" -> "amd64"
|
||||
"aarch64" -> "arm64"
|
||||
else -> System.getProperty("os.arch")
|
||||
}
|
||||
val confinement = findProperty("snapconfinement") as String? ?: "strict"
|
||||
val dir = distributable.destinationDir.get()
|
||||
val base = layout.projectDirectory.file("linux/snapcraft.base.yml")
|
||||
val confinement = (findProperty("snapconfinement") as String?).takeIf { !it.isNullOrBlank() } ?: "strict"
|
||||
val dir = distributable().destinationDir.get()
|
||||
val base = layout.projectDirectory.file("linux/snapcraft.yml")
|
||||
|
||||
doFirst {
|
||||
|
||||
var content = base
|
||||
.asFile
|
||||
.readText()
|
||||
.replace("\$name", name)
|
||||
.replace("\$arch", arch)
|
||||
.replace("\$version", version as String)
|
||||
.replace("\$confinement", confinement)
|
||||
.let {
|
||||
if (confinement != "classic") return@let it
|
||||
// If confinement is not strict, remove the PLUGS section
|
||||
val start = it.indexOf("# PLUGS START")
|
||||
val end = it.indexOf("# PLUGS END")
|
||||
if (start != -1 && end != -1) {
|
||||
val before = it.substring(0, start)
|
||||
val after = it.substring(end + "# PLUGS END".length)
|
||||
return@let before + after
|
||||
}
|
||||
return@let it
|
||||
}
|
||||
dir.file("../snapcraft.yaml").asFile.writeText(content)
|
||||
replaceVariablesInFile(
|
||||
base,
|
||||
dir.file("../snapcraft.yaml"),
|
||||
mapOf(
|
||||
"name" to name,
|
||||
"arch" to arch,
|
||||
"version" to version as String,
|
||||
"confinement" to confinement,
|
||||
"deb" to "deb/${rootProject.name}_${version}-1_${arch}.deb"
|
||||
),
|
||||
if (confinement == "classic") listOf("PLUGS") else emptyList()
|
||||
)
|
||||
}
|
||||
}
|
||||
tasks.register("generateFlatpakConfiguration"){
|
||||
val identifier = findProperty("flathubidentifier") as String? ?: "org.processing.pde"
|
||||
|
||||
val dir = distributable().destinationDir.get()
|
||||
val base = layout.projectDirectory.file("linux/flathub.yml")
|
||||
|
||||
doFirst {
|
||||
replaceVariablesInFile(
|
||||
base,
|
||||
dir.file("../flatpak/$identifier.yml"),
|
||||
mapOf(
|
||||
"identifier" to identifier,
|
||||
"deb" to dir.file("../deb/${rootProject.name}_${version}-1_${arch}.deb").asFile.absolutePath
|
||||
),
|
||||
emptyList()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
fun replaceVariablesInFile(
|
||||
source: RegularFile,
|
||||
target: RegularFile,
|
||||
variables: Map<String, String>,
|
||||
sections: List<String>
|
||||
){
|
||||
var content = source.asFile.readText()
|
||||
for ((key, value) in variables) {
|
||||
content = content.replace("\$$key", value)
|
||||
}
|
||||
if (sections.isNotEmpty()) {
|
||||
for (section in sections) {
|
||||
val start = content.indexOf("# $section START")
|
||||
val end = content.indexOf("# $section END")
|
||||
if (start != -1 && end != -1) {
|
||||
val before = content.substring(0, start)
|
||||
val after = content.substring(end + "# $section END".length)
|
||||
content = before + after
|
||||
}
|
||||
}
|
||||
}
|
||||
target.asFile.parentFile.mkdirs()
|
||||
target.asFile.writeText(content)
|
||||
}
|
||||
|
||||
tasks.register<Exec>("packageSnap"){
|
||||
onlyIf { OperatingSystem.current().isLinux }
|
||||
dependsOn("packageDeb", "generateSnapConfiguration")
|
||||
dependsOn("generateSnapConfiguration")
|
||||
group = "compose desktop"
|
||||
|
||||
val distributable = tasks.named<AbstractJPackageTask>("createDistributable").get()
|
||||
workingDir = distributable.destinationDir.dir("../").get().asFile
|
||||
workingDir = distributable().destinationDir.dir("../").get().asFile
|
||||
commandLine("snapcraft")
|
||||
}
|
||||
|
||||
tasks.register<Exec>("buildFlatpak"){
|
||||
onlyIf { OperatingSystem.current().isLinux }
|
||||
dependsOn("generateFlatpakConfiguration")
|
||||
group = "compose desktop"
|
||||
|
||||
val dir = distributable().destinationDir.get()
|
||||
val identifier = findProperty("flathubidentifier") as String? ?: "org.processing.pde"
|
||||
|
||||
workingDir = dir.file("../flatpak").asFile
|
||||
commandLine(
|
||||
"flatpak-builder",
|
||||
"--install-deps-from=https://flathub.org/repo/flathub.flatpakrepo",
|
||||
"--user",
|
||||
"--force-clean",
|
||||
"--repo=repo",
|
||||
"output",
|
||||
"$identifier.yml"
|
||||
)
|
||||
}
|
||||
|
||||
tasks.register<Exec>("packageFlatpak"){
|
||||
onlyIf { OperatingSystem.current().isLinux }
|
||||
dependsOn("buildFlatpak")
|
||||
group = "compose desktop"
|
||||
|
||||
val dir = distributable().destinationDir.get()
|
||||
val identifier = findProperty("flathubidentifier") as String? ?: "org.processing.pde"
|
||||
|
||||
workingDir = dir.file("../flatpak").asFile
|
||||
commandLine(
|
||||
"flatpak",
|
||||
"build-bundle",
|
||||
"./repo",
|
||||
"$identifier.flatpak",
|
||||
identifier
|
||||
)
|
||||
}
|
||||
tasks.register<Zip>("zipDistributable"){
|
||||
dependsOn("createDistributable", "setExecutablePermissions")
|
||||
group = "compose desktop"
|
||||
|
||||
val distributable = tasks.named<AbstractJPackageTask>("createDistributable").get()
|
||||
val dir = distributable.destinationDir.get()
|
||||
val packageName = distributable.packageName.get()
|
||||
val dir = distributable().destinationDir.get()
|
||||
val packageName = distributable().packageName.get()
|
||||
|
||||
from(dir){ eachFile{ permissions{ unix("755") } } }
|
||||
archiveBaseName.set(packageName)
|
||||
@@ -318,7 +382,7 @@ afterEvaluate{
|
||||
){
|
||||
dependsOn("notarizeDmg")
|
||||
}
|
||||
dependsOn("packageSnap", "zipDistributable")
|
||||
dependsOn("zipDistributable")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
id: org.processing.pde
|
||||
id: $identifier
|
||||
runtime: org.freedesktop.Platform
|
||||
runtime-version: '24.08'
|
||||
sdk: org.freedesktop.Sdk
|
||||
@@ -22,17 +22,17 @@ modules:
|
||||
- find /app/lib/app/resources/jdk/bin -type f -exec chmod +x {} +
|
||||
|
||||
# Install the desktop file and icon
|
||||
- install -D /app/lib/processing-Processing.desktop /app/share/applications/org.processing.pde.desktop
|
||||
- sed -i 's/^Icon=.*/Icon=org.processing.pde/' /app/share/applications/org.processing.pde.desktop
|
||||
- sed -i 's/^Exec=.*/Exec=\/app\/bin\/Processing/' /app/share/applications/org.processing.pde.desktop
|
||||
- install -D /app/lib/processing-Processing.desktop /app/share/applications/$identifier.desktop
|
||||
- sed -i 's/^Icon=.*/Icon=$identifier/' /app/share/applications/$identifier.desktop
|
||||
- sed -i 's/^Exec=.*/Exec=\/app\/bin\/Processing/' /app/share/applications/$identifier.desktop
|
||||
|
||||
# Install the mimetype info
|
||||
- install -D /app/lib/processing-Processing-MimeInfo.xml /app/share/mime/packages/org.processing.pde.xml
|
||||
- install -D /app/lib/processing-Processing-MimeInfo.xml /app/share/mime/packages/$identifier.xml
|
||||
|
||||
# - install -D /app/lib/Processing.png /app/share/icons/hicolor/512x512/apps/org.processing.pde.png
|
||||
- install -D /app/lib/application-x-processing.png /app/share/icons/hicolor/512x512/mimetypes/org.processing.pde-text-x-processing.png
|
||||
# - install -D /app/lib/Processing.png /app/share/icons/hicolor/512x512/apps/$identifier.png
|
||||
- install -D /app/lib/application-x-processing.png /app/share/icons/hicolor/512x512/mimetypes/$identifier-text-x-processing.png
|
||||
|
||||
sources:
|
||||
- type: file
|
||||
path: ../build/compose/binaries/main/deb/processing_1.0.0-1_amd64.deb
|
||||
path: $deb
|
||||
dest-filename: processing.deb
|
||||
@@ -32,7 +32,7 @@ apps:
|
||||
parts:
|
||||
processing:
|
||||
plugin: dump
|
||||
source: deb/processing_$version-1_$arch.deb
|
||||
source: $deb
|
||||
source-type: deb
|
||||
stage-packages:
|
||||
- openjdk-17-jre
|
||||
Reference in New Issue
Block a user