Skip to content

Commit

Permalink
feature/publish rcp as maven packages (#117)
Browse files Browse the repository at this point in the history
* .github: added "Publish RCPs" task to the workflow
* build.gradle: fixed the patching of the Windows RCP + enable publication to the github packages repo
  • Loading branch information
danielratiu authored Nov 24, 2024
1 parent 56c8491 commit a1c4699
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 12 deletions.
40 changes: 37 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -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 }} \
48 changes: 39 additions & 9 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -517,6 +537,16 @@ publishing {
}
}
}
create<MavenPublication>("FASTEN_WIN_RCP") {
groupId = "fasten"
artifactId = "win.rcp"
artifact(tasks.named("package_fasten_safety_distribution_win"))
}
create<MavenPublication>("FASTEN_LINUX_RCP") {
groupId = "fasten"
artifactId = "linux.rcp"
artifact(tasks.named("package_fasten_safety_distribution_linux"))
}
}
}

Expand Down

0 comments on commit a1c4699

Please sign in to comment.