diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 618a8b22..a927b539 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -85,11 +85,6 @@ jobs: run: | ./gradlew jpackage --info --warning-mode=summary -PjavaVersion=${{ matrix.java }} - - name: Stop Gradle Daemon - run: | - ./gradlew -status - ./gradlew -stop - - name: Archive native package for ${{ runner.os }} uses: actions/upload-artifact@v4 if: ${{ env.DEFAULT_JAVA == matrix.java }} diff --git a/.github/workflows/github_release.sh b/.github/workflows/github_release.sh index 6e355691..5cafb4e9 100755 --- a/.github/workflows/github_release.sh +++ b/.github/workflows/github_release.sh @@ -16,7 +16,7 @@ echo "Read project version '$project_version' from Gradle project" release_artifacts=$(find build/release-artifacts -type f) readonly release_artifacts readonly title="Release $project_version" -readonly tag="$project_version" +readonly tag="v$project_version" echo "Creating release:" echo "Git tag : $tag" echo "Title : $title" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5aabf702..bbb4c0cf 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -25,6 +25,14 @@ jobs: steps: - name: Checkout the repository uses: actions/checkout@v4 + + - name: Fail if not running on main branch + if: ${{ github.ref != 'refs/heads/main' }} + uses: actions/github-script@v7 + with: + script: | + core.setFailed('Not running on main branch, github.ref is ${{ github.ref }}. Please start this workflow only on main') + - name: Set up Java uses: actions/setup-java@v4 with: @@ -68,7 +76,6 @@ jobs: cancel-in-progress: false permissions: contents: write # Required for creating GitHub release - actions: read # Required for checking build status steps: - name: Checkout the repository uses: actions/checkout@v4 @@ -81,21 +88,21 @@ jobs: - name: Setup Gradle uses: gradle/actions/setup-gradle@v4 -# - name: Fail if not running on main branch -# if: ${{ github.ref != 'refs/heads/main' }} -# uses: actions/github-script@v7 -# with: -# script: | -# core.setFailed('Not running on main branch, github.ref is ${{ github.ref }}. Please start this workflow only on main') + - name: Fail if not running on main branch + if: ${{ github.ref != 'refs/heads/main' }} + uses: actions/github-script@v7 + with: + script: | + core.setFailed('Not running on main branch, github.ref is ${{ github.ref }}. Please start this workflow only on main') -# - name: Publish to Central Repository -# if: ${{ ! inputs.skip-maven-central }} -# run: ./gradlew publish closeAndReleaseRepository --info --warning-mode all -# env: -# ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.OSSRH_USERNAME }} -# ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.OSSRH_PASSWORD }} -# ORG_GRADLE_PROJECT_signingKey: ${{ secrets.OSSRH_GPG_SECRET_KEY }} -# ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }} + - name: Publish to Central Repository + if: ${{ ! inputs.skip-maven-central }} + run: ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository --info --warning-mode all + env: + ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.OSSRH_USERNAME }} + ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.OSSRH_PASSWORD }} + ORG_GRADLE_PROJECT_signingKey: ${{ secrets.OSSRH_GPG_SECRET_KEY }} + ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }} - name: Download artifacts uses: actions/download-artifact@v4 diff --git a/CHANGELOG.md b/CHANGELOG.md index c706be1c..0259a360 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 See [Release](https://github.com/itsallcode/white-rabbit/releases/tag/v1.10.0) / [Milestone](https://github.com/itsallcode/white-rabbit/milestone/12?closed=1) -## [1.9.0] - 2024-??-?? +## [1.9.0] - 2024-09-08 See [Release](https://github.com/itsallcode/white-rabbit/releases/tag/v1.9.0) / [Milestone](https://github.com/itsallcode/white-rabbit/milestone/11?closed=1) @@ -42,6 +42,11 @@ This release requires Java 21. * [#132](https://github.com/itsallcode/white-rabbit/issues/132): Fix display of negative zero duration * [#272](https://github.com/itsallcode/white-rabbit/pull/272): Fix startup under Linux +### Refactoring + +* [#280](https://github.com/itsallcode/white-rabbit/pull/280) & [#281](https://github.com/itsallcode/white-rabbit/pull/281): Upgrade dependencies and enable automatic release +* [#278](https://github.com/itsallcode/white-rabbit/pull/278): Code cleanup + ## [1.8.0] - 2022-01-22 See [Release](https://github.com/itsallcode/white-rabbit/releases/tag/v1.8.0) / [Milestone](https://github.com/itsallcode/white-rabbit/milestone/10?closed=1) diff --git a/api/build.gradle b/api/build.gradle index 591eb969..8bcebd45 100644 --- a/api/build.gradle +++ b/api/build.gradle @@ -17,14 +17,6 @@ dependencies { testImplementation libs.bundles.testUtils } -def getOptionalProperty(String name) { - if(project.hasProperty(name)) { - return project.property(name) - } - logger.info("Project property '${name}' not available. Please add it to ~/.gradle/gradle.properties") - return null -} - publishing { publications { mavenJava(MavenPublication) { @@ -56,21 +48,11 @@ publishing { } } } - - repositories { - maven { - def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/" - def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots/" - url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl - allowInsecureProtocol = false - credentials(PasswordCredentials) { - username = getOptionalProperty("ossrhUsername") - password = getOptionalProperty("ossrhPassword") - } - } - } } signing { - sign publishing.publications.mavenJava + def signingKey = findProperty("signingKey") + def signingPassword = findProperty("signingPassword") + useInMemoryPgpKeys(signingKey, signingPassword) + sign(publishing.publications["mavenJava"]) } diff --git a/build.gradle b/build.gradle index f94a2d1b..b0a49506 100644 --- a/build.gradle +++ b/build.gradle @@ -8,6 +8,7 @@ plugins { id "com.github.ben-manes.versions" version "0.51.0" id "org.panteleyev.jpackageplugin" version "1.6.0" apply false id "org.gradle.crypto.checksum" version "1.4.0" apply false + id "io.github.gradle-nexus.publish-plugin" version "2.0.0" } version = "1.9.0" @@ -103,3 +104,12 @@ tasks.named("dependencyUpdates").configure { isNonStable(it.candidate.version) && !isNonStable(it.currentVersion) } } + +nexusPublishing { + packageGroup = project.group + repositories { + sonatype { + stagingProfileId = "546ea6ce74787e" + } + } +} diff --git a/docs/developer_guide.md b/docs/developer_guide.md index f757863a..825f808b 100644 --- a/docs/developer_guide.md +++ b/docs/developer_guide.md @@ -66,35 +66,21 @@ Precondition for Windows: Install the [WiX Toolset](https://wixtoolset.org) and ```sh ./gradlew jpackage --info ``` +### Creating a Release -## Deployment +#### Preparations -This will build WhiteRabbit and publish the plugin api to Maven Central. +1. Checkout the `main` branch, create a new branch. +2. Update version number in `build.gradle` and `README.md`. +3. Add changes in new version to `CHANGELOG.md`. +4. Commit and push changes. +5. Create a new pull request, have it reviewed and merged to `main`. -### Initial setup +#### Perform the Release -Add the following to your `~/.gradle/gradle.properties`: - - ```properties - ossrhUsername= - ossrhPassword= - - signing.keyId= - signing.password= - signing.secretKeyRingFile= - ``` - -### Build and deploy - -1. Make sure the [Changelog](../CHANGELOG.md) is updated -2. Run the following command: - - ```sh - ./gradlew clean build publish closeAndReleaseRepository --info - ``` - - The release will be written to `jfxui/build/libs/white-rabbit-fx-.jar`. Snapshots will be available at [oss.sonatype.org](https://oss.sonatype.org/content/repositories/snapshots/org/itsallcode/whiterabbit/). - -3. Create a new [release](https://github.com/itsallcode/white-rabbit/releases) in GitHub and attach the built jar. -4. Close the [milestone](https://github.com/itsallcode/white-rabbit/milestones) in GitHub. -5. After some time the release will be available at [Maven Central](https://repo1.maven.org/maven2/org/itsallcode/whiterabbit/). +1. Start the release workflow + * Run command `gh workflow run release.yml --repo itsallcode/white-rabbit --ref main` + * or go to [GitHub Actions](https://github.com/itsallcode/white-rabbit/actions/workflows/release.yml) and start the `release.yml` workflow on branch `main`. +2. Update title and description of the newly created [GitHub release](https://github.com/itsallcode/white-rabbit/releases). +3. Close the [milestone](https://github.com/itsallcode/white-rabbit/milestones) in GitHub. +4. After some time the release will be available at [Maven Central](https://repo1.maven.org/maven2/org/itsallcode/whiterabbit/).