diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e9815d7d..b800fd76 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -11,9 +11,13 @@ on: publish: description: Whether to publish the build result to Maven repositories type: boolean - default: false + default: 'false' required: false - + publish_rcp: + description: Whether to publish the RCP to Github packages + type: boolean + default: 'false' + required: true jobs: build: runs-on: ubuntu-latest @@ -72,7 +76,7 @@ jobs: publish: # Only publish on push (to maintenance or master) or on dispatch if requested - if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.publish == 'true') + if: ${{ github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.publish == 'true') }} runs-on: ubuntu-latest steps: @@ -94,3 +98,33 @@ jobs: -Pgpr.token=${{ secrets.GITHUB_TOKEN }} \ -Partifacts.itemis.cloud.user=${{ secrets.ARTIFACTS_ITEMIS_CLOUD_USER }} \ -Partifacts.itemis.cloud.pw=${{ secrets.ARTIFACTS_ITEMIS_CLOUD_PW }} + + publish_rcps: + # Only publish on push (to maintenance or master) or on dispatch if requested + if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.publish_rcp == 'true' }} + + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: 17 + + - name: Set up Gradle + uses: gradle/actions/setup-gradle@v3 + + - name: Publish FASTEN-Windows RCP to Github Packages + run: | + ./gradlew publishFASTEN_WIN_RCPPublicationToGitHubPackagesRepository \ + -Pgpr.user=${{ github.actor }} \ + -Pgpr.token=${{ secrets.GITHUB_TOKEN }} \ + + - name: Publish FASTEN-Linux RCPs to Github Packages + run: | + ./gradlew publishFASTEN_LINUX_RCPPublicationToGitHubPackagesRepository \ + -Pgpr.user=${{ github.actor }} \ + -Pgpr.token=${{ secrets.GITHUB_TOKEN }} \ + diff --git a/build.gradle.kts b/build.gradle.kts index f35ab44e..70fee371 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -16,6 +16,7 @@ plugins { } val jbrVers = "17.0.8.1-b1000.32" +val jbrWindowsVers = "jbr_jcef-17.0.8.1-windows-x64-b1000.32" downloadJbr { jbrVersion = jbrVers @@ -363,21 +364,40 @@ tasks { val deleteJBR by registering(Delete::class) { dependsOn(unpackDistribution) - delete("$artifactsDir/com.mbeddr.formal.safetyDistribution/tmp/fasten-${version}/jbr") + delete("$artifactsDir/com.mbeddr.formal.safetyDistribution/tmp/fasten-${version}/jbr/") } - val removeJBR by registering(Zip::class) { - dependsOn(deleteJBR) - from("$artifactsDir/com.mbeddr.formal.safetyDistribution/tmp/fasten-${version}") - archiveFileName.set("fasten-${version}_with_removed_JBR.zip") - destinationDirectory.set(file("$artifactsDir/com.mbeddr.formal.safetyDistribution")) + val fix_JNA_for_Windows by registering(Copy::class) { + dependsOn(unpackDistribution) + from("$artifactsDir/com.mbeddr.formal.safetyDistribution/tmp/fasten-${version}/lib/jna/amd64/") + into("$artifactsDir/com.mbeddr.formal.safetyDistribution/tmp/fasten-${version}/lib/jna/") + } + + val fix_BIN_for_Windows by registering(Copy::class) { + dependsOn(unpackDistribution) + from("$artifactsDir/com.mbeddr.formal.safetyDistribution/tmp/fasten-${version}/bin/win/") + into("$artifactsDir/com.mbeddr.formal.safetyDistribution/tmp/fasten-${version}/bin/") + } + + val unpack_windows_JBR by registering(Copy::class) { + dependsOn(resolveJBR_Win, deleteJBR, fix_JNA_for_Windows, fix_BIN_for_Windows) + from(tarTree("$jdkDir/jbr_jcef-windows-x64.tgz")) + into("$artifactsDir/com.mbeddr.formal.safetyDistribution/tmp") } val package_fasten_safety_distribution_win by registering(Zip::class) { - dependsOn(resolveJBR_Win, build_fasten_safety_distribution, removeJBR) + dependsOn(resolveJBR_Win, build_fasten_safety_distribution, unpack_windows_JBR) archiveBaseName.set("fasten-${version}-Win") - from(zipTree("$artifactsDir/com.mbeddr.formal.safetyDistribution/fasten-${version}_with_removed_JBR.zip")) - from(tarTree("$jdkDir/jbr_jcef-windows-x64.tgz")) + from("$artifactsDir/com.mbeddr.formal.safetyDistribution/tmp/fasten-${version}/") + from("$artifactsDir/com.mbeddr.formal.safetyDistribution/tmp/$jbrWindowsVers") { + into("jbr") + } + } + + val package_fasten_safety_distribution_linux by registering(Zip::class) { + dependsOn(build_fasten_safety_distribution) + archiveBaseName.set("fasten-${version}-Linux") + from("$artifactsDir/com.mbeddr.formal.safetyDistribution/fasten-${version}.zip") } val build_all_languages by registering { @@ -517,6 +537,16 @@ publishing { } } } + create("FASTEN_WIN_RCP") { + groupId = "fasten" + artifactId = "win.rcp" + artifact(tasks.named("package_fasten_safety_distribution_win")) + } + create("FASTEN_LINUX_RCP") { + groupId = "fasten" + artifactId = "linux.rcp" + artifact(tasks.named("package_fasten_safety_distribution_linux")) + } } }