Skip to content

Commit

Permalink
Merge pull request #2538 from mbeddr/bugfix/github-release
Browse files Browse the repository at this point in the history
Fix GitHub release
  • Loading branch information
sergej-koscejev authored Sep 25, 2024
2 parents 37941d5 + f32967c commit 6f2587d
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 66 deletions.
2 changes: 0 additions & 2 deletions build/com.mbeddr/distribution/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ task build_all_in_one(type: BuildLanguages, dependsOn: [':com.mbeddr:platform:co

task build_platform_distribution(type: BuildLanguages, dependsOn: [':com.mbeddr:platform:copy_allScripts', resolve_mbeddr]) {
script scriptFile('com.mbeddr.platform/build-distribution.xml')
// Support incremental build
inputs.file(script)
}

task package_tutorial(type: Zip) {
Expand Down
6 changes: 0 additions & 6 deletions build/com.mbeddr/platform/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,6 @@ task test_mbeddr_platform(type: TestLanguages, dependsOn: build_platform) {

task build_platform_distribution(type: BuildLanguages, dependsOn: [build_platform, test_mbeddr_platform]) {
script scriptFile('com.mbeddr.platform/build-distribution.xml')

// Support incremental build
inputs.file(script)
inputs.dir("$rootDir/artifacts/mps-sl-all")
inputs.dir("$rootDir/artifacts/com.mbeddr.platform")
outputs.dir("$rootDir/artifacts/com.mbeddr.platform.distribution")
}

task package_mbeddrPlatform(type: Zip, dependsOn: test_mbeddr_platform) {
Expand Down
88 changes: 30 additions & 58 deletions build/publishing/build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import java.nio.file.Files
import java.nio.file.Paths
import java.nio.file.StandardCopyOption
import java.time.*
import de.itemis.mps.gradle.GitBasedVersioning

plugins {
id "co.riiid.gradle" version "0.4.2"
id "com.github.breadmoirai.github-release" version "2.5.2"
}

def artifactsRoot = rootProject.projectDir.absolutePath + "/artifacts"
Expand All @@ -20,80 +23,49 @@ LocalDateTime t = LocalDateTime.now();

def releaseNotes = """Automated Nighly build from ${t as String}."""

def windowsFileName = "mbeddr-win-" + t.getYear() + "-" +
t.getMonthValue() +"-"+ t.getDayOfMonth() +".exe"

def macosFileName = "mbeddr-macos-" + t.getYear() + "-" +
t.getMonthValue() +"-"+ t.getDayOfMonth() +".dmg"


def allInOneFileName = "com.mbeddr.allInOne-${ext.mbeddrBuildNumber}-MPS-${mpsBuild}.zip"
def tutorialFileName = "com.mbeddr.tutorial-${ext.mbeddrBuildNumber}-MPS-${mpsBuild}.zip"
def platformFileName = "platform-distribution-${ext.mbeddrPlatformBuildNumber}-MPS-${mpsBuild}.zip"

github {
githubRelease {
owner = 'mbeddr'
repo = 'mbeddr.core'
token = rootProject.hasProperty("github.token") ? rootProject.getProperty("github.token") : "empty"
tagName = 'nightly-' + buildNumber
targetCommitish = GitBasedVersioning.getGitCommitHash()
name = 'Nighly Build ' + buildNumber
releaseName = 'Nighly Build ' + buildNumber
body = releaseNotes
prerelease = true
assets = [
artifactsRoot + "/com.mbeddr.allInOne/" + allInOneFileName,
releaseAssets = [
artifactsRoot + "/com.mbeddr.tutorial/" + tutorialFileName,
artifactsRoot + "/com.mbeddr.platform.distribution/" + platformFileName,
artifactsRoot + "/rcp/" + windowsFileName,
artifactsRoot + "/rcp/" + macosFileName
]
dryRun = project.hasProperty("githubReleaseDryRun")
}

task renameWindowsFile(type: Copy) {
from(artifactsRoot+ "/rcp")
into(artifactsRoot + "/rcp")
include('Setup.exe')
rename ('Setup.exe', windowsFileName)
}

task renameMacosFile(type: Copy) {
from(artifactsRoot+ "/rcp")
into(artifactsRoot + "/rcp")
include('mbeddr-macos.dmg')
rename ('mbeddr-macos.dmg', macosFileName)
}

task renameAllInOne(type: Copy, dependsOn: ':com.mbeddr:distribution:build_all_in_one') {
from(artifactsRoot + "/com.mbeddr.allInOne/")
into(artifactsRoot + "/com.mbeddr.allInOne/")
include("com.mbeddr.allInOne.zip")
rename("com.mbeddr.allInOne.zip", allInOneFileName)
}

task renameTutorial(type: Copy, dependsOn: ':com.mbeddr:distribution:package_tutorial') {
from(artifactsRoot + "/com.mbeddr.tutorial/")
into(artifactsRoot + "/com.mbeddr.tutorial/")
include("com.mbeddr.tutorial.zip")
rename("com.mbeddr.tutorial.zip", tutorialFileName)
tasks.register('renameTutorial') {
dependsOn(':com.mbeddr:distribution:package_tutorial')
doLast {
def dir = Paths.get(artifactsRoot, 'com.mbeddr.tutorial')
Files.copy(
dir.resolve('com.mbeddr.tutorial.zip'),
dir.resolve(tutorialFileName),
StandardCopyOption.REPLACE_EXISTING
)
}
}

task renamePlarform(type: Copy, dependsOn: ':com.mbeddr:distribution:build_platform_distribution') {
from(artifactsRoot + "/com.mbeddr.platform.distribution/")
into(artifactsRoot + "/com.mbeddr.platform.distribution/")
include("platform-distribution.zip")
rename("platform-distribution.zip", platformFileName)
tasks.register('renamePlatform') {
dependsOn(':com.mbeddr:platform:build_platform_distribution')
doLast {
def dir = Paths.get(artifactsRoot, 'com.mbeddr.platform.distribution')
Files.copy(
dir.resolve('platform-distribution.zip'),
dir.resolve(platformFileName),
StandardCopyOption.REPLACE_EXISTING
)
}
}

task copyRenameAndDeleteWindowsSetupFile(type: Delete, dependsOn: [renameWindowsFile]) {
delete artifactsRoot + "/rcp/Setup.exe"
tasks.named('githubRelease') {
dependsOn renamePlatform, renameTutorial
}

task copyRenameAndDeleteMacosSetupFile(type: Delete, dependsOn: [renameMacosFile]) {
delete artifactsRoot + "/rcp/mbeddr-macos.dmg"
}

githubRelease.dependsOn copyRenameAndDeleteWindowsSetupFile,
//copyRenameAndDeleteMacosSetupFile,
renameAllInOne,
renamePlarform,
renameTutorial

0 comments on commit 6f2587d

Please sign in to comment.