Skip to content

Commit

Permalink
Migrated publish to camundala.
Browse files Browse the repository at this point in the history
  • Loading branch information
pme123 committed Dec 12, 2024
1 parent c710de3 commit 4d9b9f9
Show file tree
Hide file tree
Showing 11 changed files with 533 additions and 46 deletions.
30 changes: 30 additions & 0 deletions 00-documentation/src/docs/development/projectDev.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,3 +196,33 @@ This creates the following files:
// the domain NoInput -> NoOutput
02-bpmn - main -> mycompany.myproject.bpmn.myProcess.v1.MyTimerEvent
```

## publish

Creates a new Release for the BPMN project and publishes to the repository(e.g. Artifactory)

Usage:
```
./helper.scala publish <VERSION>
```

Example:
```
./helper.scala publish 0.2.5
```

The following steps are executed:
- Check if there are no SNAPSHOTs as dependencies.
- Release your dependencies first.
- Check if the `CHANGELOG.md` is updated.
- Check and adjust manually `CHANGELOG.md`.
- Remove `//---DRAFT start` / `//---DRAFT end`.
- Run the command again.
- Push the `develop` branch.
- Adjust the version in `ProjectDef.scala` and `ApiProjectCreator.scala`.
- Run `ApiProjectCreator.scala`.
- Publish the project to the repository.
- Uploads the documentation to a webserver.
- Merge the branch (`develop`) into `master`.
- Tag the GIT repository with the version.
- Increase the version to the next minor _SNAPSHOT_ version.
81 changes: 81 additions & 0 deletions 04-helper/src/main/resources/OpenApi.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<!DOCTYPE html>
<html>
<head>
<title>ReDoc</title>
<!-- needed for adaptive design -->
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://fonts.googleapis.com/css?family=Montserrat:300,400,700|Roboto:300,400,700" rel="stylesheet">

<!-- bpmn styles -->
<link rel="stylesheet" href="https://unpkg.com/bpmn-js@11.5.0/dist/assets/bpmn-js.css">
<!-- dmn styles -->
<link rel="stylesheet" href="https://unpkg.com/dmn-js@14.1.0/dist/assets/dmn-js-shared.css">
<link rel="stylesheet" href="https://unpkg.com/dmn-js@14.1.0/dist/assets/dmn-js-drd.css">
<link rel="stylesheet" href="https://unpkg.com/dmn-js@14.1.0/dist/assets/dmn-js-decision-table.css">
<link rel="stylesheet" href="https://unpkg.com/dmn-js@14.1.0/dist/assets/dmn-js-literal-expression.css">
<link rel="stylesheet" href="https://unpkg.com/dmn-js@14.1.0/dist/assets/dmn-font/css/dmn.css">

<!--
ReDoc doesn't change outer page styles
-->
<style>
body {
margin: 0;
padding: 0;
}
.diagramCanvas {
border: solid 1px grey;
height:500px;
}
.diagram {
padding: 5px;
height: 100%;
}
</style>
<script>
function downloadSVG(id) {
const container = document.getElementById(id);
const svg = container.getElementsByTagName('svg')[1];
console.log(svg)
svg.setAttribute('xmlns', 'http://www.w3.org/2000/svg')
const blob = new Blob([svg.outerHTML.toString()]);
const element = document.createElement("a");
element.download = id +".svg";
element.href = window.URL.createObjectURL(blob);
element.click();
element.remove();
}
</script>
</head>
<body>
<!-- bpmn viewer -->
<script src="https://unpkg.com/bpmn-js@11.5.0/dist/bpmn-viewer.development.js"></script>
<!-- dmn viewer -->
<script src="https://unpkg.com/dmn-js@14.1.0/dist/dmn-viewer.development.js"></script>
<!-- jquery (required for bpmn / dmn example) -->
<script src="https://unpkg.com/jquery@3.3.1/dist/jquery.js"></script>
<script>
function openFromUrl(url, viewer) {
console.log('attempting to open <' + url + '>');
$.ajax("diagrams/" + url, {dataType: 'text'}).done(async function (xml) {

try {
await viewer.importXML(xml);
if(url.endsWith(".bpmn"))
viewer.get('canvas').zoom('fit-viewport');
else {
const activeEditor = viewer.getActiveViewer();
activeEditor.get('canvas').zoom('fit-viewport');
}
} catch (err) {
console.error(err);
}
});
}
</script>
<redoc spec-url='./openApi.yml'></redoc>
<script src="https://cdn.jsdelivr.net/npm/redoc@next/bundles/redoc.standalone.js"> </script>

</body>
</html>
54 changes: 24 additions & 30 deletions 04-helper/src/main/scala/camundala/helper/dev/DevHelper.scala
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
package camundala.helper.dev

import camundala.helper.util.DevConfig
import camundala.api.ApiConfig
import camundala.helper.dev.publish.PublishHelper
import camundala.helper.util.{DevConfig, PublishConfig}
import camundala.helper.dev.update.*

import scala.util.{Failure, Success, Try}

object DevHelper:
trait DevHelper:
def apiConfig: ApiConfig
def devConfig: DevConfig
def publishConfig: Option[PublishConfig]
given DevConfig = devConfig
given ApiConfig = apiConfig
given Option[PublishConfig] = publishConfig

def run(command: String, arguments: String*)(using DevConfig): Unit =
def run(command: String, arguments: String*): Unit =
val args = arguments.toSeq
println(s"Running command: $command with args: $args")
Try(Command.valueOf(command)) match
Expand All @@ -19,7 +27,7 @@ object DevHelper:
end match
end run

private def runCommand(command: Command, args: Seq[String])(using DevConfig): Unit =
private def runCommand(command: Command, args: Seq[String]): Unit =
command match
case Command.update =>
update
Expand Down Expand Up @@ -89,15 +97,15 @@ object DevHelper:
createTimerEvent(processName, bpmnName, version.toIntOption)
case other =>
printBadActivity(command, other)
/*
case Command.publish =>
args match
case Seq(version) =>
PublishHelper().publish(version)
case other =>
println(s"Invalid arguments for command $command: $other")
println(s"Usage: $command <version>")
println(s"Example: $command 1.23.3")
println(s"Example: $command 1.23.3")/*
case Command.deploy =>
args match
case Seq(simulation) =>
Expand Down Expand Up @@ -127,14 +135,12 @@ object DevHelper:
case update, process, customTask, serviceTask, userTask, decision, signalEvent, messageEvent,
timerEvent, publish, deploy, dockerUp, dockerStop, dockerDown

def update(using config: DevConfig): Unit =
println(s"Update Project: ${config.projectName}")
println(s" - with Subprojects: ${config.subProjects}")
def update: Unit =
println(s"Update Project: ${devConfig.projectName}")
println(s" - with Subprojects: ${devConfig.subProjects}")
SetupGenerator().generate

def createProcess(processName: String, version: Option[Int])(using
config: DevConfig
): Unit =
def createProcess(processName: String, version: Option[Int]): Unit =
SetupGenerator().createProcess(SetupElement(
"Process",
processName.asProcessName,
Expand All @@ -143,53 +149,41 @@ object DevHelper:
))
end createProcess

def createCustomTask(processName: String, bpmnName: String, version: Option[Int])(
using config: DevConfig
): Unit =
def createCustomTask(processName: String, bpmnName: String, version: Option[Int]): Unit =
SetupGenerator().createProcessElement(SetupElement(
"CustomTask",
processName.asProcessName,
bpmnName.asElemName,
version
))

def createServiceTask(processName: String, bpmnName: String, version: Option[Int])(
using config: DevConfig
): Unit =
def createServiceTask(processName: String, bpmnName: String, version: Option[Int]): Unit =
SetupGenerator().createProcessElement(SetupElement(
"ServiceTask",
processName.asProcessName,
bpmnName.asElemName,
version
))

def createUserTask(processName: String, bpmnName: String, version: Option[Int])(
using config: DevConfig
): Unit =
def createUserTask(processName: String, bpmnName: String, version: Option[Int]): Unit =
SetupGenerator().createUserTask(
SetupElement("UserTask", processName.asProcessName, bpmnName.asElemName, version)
)

def createDecision(processName: String, bpmnName: String, version: Option[Int])(
using config: DevConfig
): Unit =
def createDecision(processName: String, bpmnName: String, version: Option[Int]): Unit =
SetupGenerator().createDecision(
SetupElement("Decision", processName.asProcessName, bpmnName.asElemName, version)
)

def createSignalEvent(processName: String, bpmnName: String, version: Option[Int])(
using config: DevConfig
): Unit =
def createSignalEvent(processName: String, bpmnName: String, version: Option[Int]): Unit =
SetupGenerator().createEvent(SetupElement(
"Signal",
processName.asProcessName,
bpmnName.asElemName,
version
))

def createMessageEvent(processName: String, bpmnName: String, version: Option[Int])(
using config: DevConfig
): Unit =
def createMessageEvent(processName: String, bpmnName: String, version: Option[Int]): Unit =
SetupGenerator().createEvent(SetupElement(
"Message",
processName.asProcessName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,12 @@ case class CompanyWrapperGenerator()(using config: DevConfig):
|trait CompanyApiCreator extends ApiCreator, ApiDsl, CamundaPostmanApiCreator:
|
| // override the config if needed
| protected def apiConfig: ApiConfig = ApiConfig(companyId = "$companyName")
| protected def apiConfig: ApiConfig = CompanyApiCreator.apiConfig
|
| lazy val companyDescr = ??? //TODO Add your Company Description!
|
|object CompanyApiCreator:
| lazy val apiConfig = ApiConfig(companyId = "$companyName")
|""".stripMargin

private lazy val dmnWrapper =
Expand Down Expand Up @@ -130,14 +133,20 @@ case class CompanyWrapperGenerator()(using config: DevConfig):
private lazy val helperWrapper =
s"""package $companyName.camundala.helper
|
|import camundala.api.ApiConfig
|import camundala.helper.dev.*
|import camundala.helper.util.*
|import mycompany.camundala.api.CompanyApiCreator
|
|case class CompanyDevHelper(projectName: String, subProjects: Seq[String] = Seq.empty) extends DevHelper:
|
| lazy val apiConfig: ApiConfig = CompanyApiCreator.apiConfig
|
|object CompanyDevHelper:
| lazy val devConfig: DevConfig =
| DevConfig.defaultConfig(projectName) //TODO Implement your Config!
| .copy(subProjects = subProjects)
|
| def config(projectName: String, subProjects: Seq[String] = Seq.empty): DevConfig =
| DevConfig.defaultConfig(projectName) //TODO Implement your Config!
| .copy(subProjects = subProjects)
| lazy val publishConfig: Option[PublishConfig] = None //TODO If you have a webdav server to publish the docs, add the config here
|""".stripMargin
end helperWrapper

Expand Down
Loading

0 comments on commit 4d9b9f9

Please sign in to comment.