diff --git a/.github/release.yaml b/.github/release.yaml new file mode 100644 index 00000000..53555240 --- /dev/null +++ b/.github/release.yaml @@ -0,0 +1,18 @@ +# This file determines how the auto-generated Release Notes in GitHub releases are structured. + +changelog: + exclude: + labels: + - no-changelog + authors: + - dependabot[bot] + categories: + - title: Bugfixes + labels: + - bug + - title: New Features & Improvements + labels: + - "*" + - title: Documentation + labels: + - documentation \ No newline at end of file diff --git a/.github/workflows/release-runtime-metamodel.yml b/.github/workflows/release-runtime-metamodel.yml new file mode 100644 index 00000000..be44763b --- /dev/null +++ b/.github/workflows/release-runtime-metamodel.yml @@ -0,0 +1,77 @@ +name: Create Runtime Metamodel Release +on: + workflow_dispatch: + inputs: + metamodel_version: + description: 'Version string that is used for publishing (e.g. "1.0.0", NOT "v1.0.0"). Appending -SNAPSHOT will create a snapshot release.' + required: true + type: string + + +env: + METAMODEL_VERSION: ${{ github.event.inputs.metamodel_version || inputs.metamodel_version }} + +jobs: + Prepare-Release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + # create tag on the current branch using GitHub's own API + - name: Create tag on current branch (main) + uses: actions/github-script@v6 + with: + script: | + github.rest.git.createRef({ + owner: context.repo.owner, + repo: context.repo.repo, + ref: 'refs/tags/v${{ env.METAMODEL_VERSION }}', + sha: context.sha + }) + + # create merge commit main -> releases encoding the version in the commit message + - name: Merge main -> releases + uses: everlytic/branch-merge@1.1.4 + with: + github_token: ${{ github.token }} + source_ref: ${{ github.ref }} + target_branch: 'releases' + commit_message_template: 'Merge commit for release of version v${{ env.METAMODEL_VERSION }}' + + # Trigger EF Jenkins. This job waits for Jenkins to complete the publishing, which may take a long time, because every + # module is signed individually, and parallelism is not available. Hence, the increased timeout of 3600 seconds. + # There is no way to cancel the process on Jenkins from withing GitHub. + - name: Trigger Release on EF Jenkins + uses: toptal/jenkins-job-trigger-action@master + with: + jenkins_url: "https://ci.eclipse.org/dataspaceconnector/" + jenkins_user: ${{ secrets.EF_JENKINS_USER }} + jenkins_token: ${{ secrets.EF_JENKINS_TOKEN }} + job_name: "Runtime-Metamodel-Autobuild-Release" + job_params: | + { + "VERSION": "${{ env.METAMODEL_VERSION }}" + } + job_timeout: "3600" # Default 30 sec. (optional) + outputs: + metamodel-version: ${{ env.METAMODEL_VERSION }} + + Github-Release: + # cannot use the workflow-level env yet as it does not yet exist, must take output from previous job + if: ${{ !endsWith( needs.Prepare-Release.outputs.metamodel-version, '-SNAPSHOT') }} + needs: + - Prepare-Release + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/checkout@v3 + with: + ref: main + - name: Create GitHub Release + uses: ncipollo/release-action@v1 + with: + generateReleaseNotes: true + tag: "v${{ env.METAMODEL_VERSION }}" + token: ${{ secrets.GITHUB_TOKEN }} + removeArtifacts: true \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index 1343c77e..6c8d46b9 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -10,18 +10,21 @@ plugins { id("com.gradle.plugin-publish") version "1.0.0" apply false } -val groupId: String by project; -val projectVersion: String by project; -var deployUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/" +val groupId: String by project +val defaultVersion: String by project +val jupiterVersion: String by project +val assertj: String by project +val mockitoVersion: String by project -// cannot do snapshots for gradle plugins -//if (projectVersion.contains("SNAPSHOT")) { -// deployUrl = "https://oss.sonatype.org/content/repositories/snapshots/" -//} + +var actualVersion: String = (project.findProperty("version") ?: defaultVersion) as String +if (actualVersion == "unspecified") { + actualVersion = defaultVersion +} subprojects { apply(plugin = "checkstyle") - version = projectVersion + version = actualVersion group = groupId // for all gradle plugins: @@ -34,8 +37,13 @@ subprojects { pluginManager.withPlugin("java-library") { apply(plugin = "maven-publish") if (!project.hasProperty("skip.signing")) { - apply(plugin = "signing") + + //set the deploy-url only for java libraries + val deployUrl = if (actualVersion.contains("SNAPSHOT")) + "https://oss.sonatype.org/service/local/staging/deploy/maven2/" + else + "https://oss.sonatype.org/content/repositories/snapshots/" publishing { repositories { maven { @@ -63,8 +71,10 @@ subprojects { tasks.withType(JavaCompile::class.java) { // making sure the code does not use any APIs from a more recent version. // Ref: https://docs.gradle.org/current/userguide/building_java_projects.html#sec:java_cross_compilation - options.release.set(javaVersion.toInt()) + options.release.set(javaVersion) } + withJavadocJar() + withSourcesJar() } } diff --git a/gradle.properties b/gradle.properties index 9714d73c..5bc78ef2 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ assertj=3.23.1 jupiterVersion=5.9.0 groupId=org.eclipse.dataspaceconnector -projectVersion=0.0.1 +defaultVersion=0.0.1-SNAPSHOT jacksonVersion=2.13.3 jetBrainsAnnotationsVersion=15.0 \ No newline at end of file diff --git a/runtime-metamodel/build.gradle.kts b/runtime-metamodel/build.gradle.kts index 9fbf07e0..997a1558 100644 --- a/runtime-metamodel/build.gradle.kts +++ b/runtime-metamodel/build.gradle.kts @@ -1,5 +1,6 @@ plugins { `java-library` + `maven-publish` } val jupiterVersion: String by project