Skip to content

Commit b2b0f8e

Browse files
authored
Fix release build (#281)
* Update release instructions * Add v as version tag prefix * Configure maven central publishing * Update changelog entry --------- Co-authored-by: kaklakariada <kaklakariada@users.noreply.github.com>
1 parent b43f1ac commit b2b0f8e

File tree

7 files changed

+57
-72
lines changed

7 files changed

+57
-72
lines changed

.github/workflows/build.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,6 @@ jobs:
8585
run: |
8686
./gradlew jpackage --info --warning-mode=summary -PjavaVersion=${{ matrix.java }}
8787
88-
- name: Stop Gradle Daemon
89-
run: |
90-
./gradlew -status
91-
./gradlew -stop
92-
9388
- name: Archive native package for ${{ runner.os }}
9489
uses: actions/upload-artifact@v4
9590
if: ${{ env.DEFAULT_JAVA == matrix.java }}

.github/workflows/github_release.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ echo "Read project version '$project_version' from Gradle project"
1616
release_artifacts=$(find build/release-artifacts -type f)
1717
readonly release_artifacts
1818
readonly title="Release $project_version"
19-
readonly tag="$project_version"
19+
readonly tag="v$project_version"
2020
echo "Creating release:"
2121
echo "Git tag : $tag"
2222
echo "Title : $title"

.github/workflows/release.yml

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,14 @@ jobs:
2525
steps:
2626
- name: Checkout the repository
2727
uses: actions/checkout@v4
28+
29+
- name: Fail if not running on main branch
30+
if: ${{ github.ref != 'refs/heads/main' }}
31+
uses: actions/github-script@v7
32+
with:
33+
script: |
34+
core.setFailed('Not running on main branch, github.ref is ${{ github.ref }}. Please start this workflow only on main')
35+
2836
- name: Set up Java
2937
uses: actions/setup-java@v4
3038
with:
@@ -68,7 +76,6 @@ jobs:
6876
cancel-in-progress: false
6977
permissions:
7078
contents: write # Required for creating GitHub release
71-
actions: read # Required for checking build status
7279
steps:
7380
- name: Checkout the repository
7481
uses: actions/checkout@v4
@@ -81,21 +88,21 @@ jobs:
8188
- name: Setup Gradle
8289
uses: gradle/actions/setup-gradle@v4
8390

84-
# - name: Fail if not running on main branch
85-
# if: ${{ github.ref != 'refs/heads/main' }}
86-
# uses: actions/github-script@v7
87-
# with:
88-
# script: |
89-
# core.setFailed('Not running on main branch, github.ref is ${{ github.ref }}. Please start this workflow only on main')
91+
- name: Fail if not running on main branch
92+
if: ${{ github.ref != 'refs/heads/main' }}
93+
uses: actions/github-script@v7
94+
with:
95+
script: |
96+
core.setFailed('Not running on main branch, github.ref is ${{ github.ref }}. Please start this workflow only on main')
9097
91-
# - name: Publish to Central Repository
92-
# if: ${{ ! inputs.skip-maven-central }}
93-
# run: ./gradlew publish closeAndReleaseRepository --info --warning-mode all
94-
# env:
95-
# ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.OSSRH_USERNAME }}
96-
# ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.OSSRH_PASSWORD }}
97-
# ORG_GRADLE_PROJECT_signingKey: ${{ secrets.OSSRH_GPG_SECRET_KEY }}
98-
# ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }}
98+
- name: Publish to Central Repository
99+
if: ${{ ! inputs.skip-maven-central }}
100+
run: ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository --info --warning-mode all
101+
env:
102+
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.OSSRH_USERNAME }}
103+
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.OSSRH_PASSWORD }}
104+
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.OSSRH_GPG_SECRET_KEY }}
105+
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }}
99106

100107
- name: Download artifacts
101108
uses: actions/download-artifact@v4

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88

99
See [Release](https://github.com/itsallcode/white-rabbit/releases/tag/v1.10.0) / [Milestone](https://github.com/itsallcode/white-rabbit/milestone/12?closed=1)
1010

11-
## [1.9.0] - 2024-??-??
11+
## [1.9.0] - 2024-09-08
1212

1313
See [Release](https://github.com/itsallcode/white-rabbit/releases/tag/v1.9.0) / [Milestone](https://github.com/itsallcode/white-rabbit/milestone/11?closed=1)
1414

@@ -42,6 +42,11 @@ This release requires Java 21.
4242
* [#132](https://github.com/itsallcode/white-rabbit/issues/132): Fix display of negative zero duration
4343
* [#272](https://github.com/itsallcode/white-rabbit/pull/272): Fix startup under Linux
4444

45+
### Refactoring
46+
47+
* [#280](https://github.com/itsallcode/white-rabbit/pull/280) & [#281](https://github.com/itsallcode/white-rabbit/pull/281): Upgrade dependencies and enable automatic release
48+
* [#278](https://github.com/itsallcode/white-rabbit/pull/278): Code cleanup
49+
4550
## [1.8.0] - 2022-01-22
4651

4752
See [Release](https://github.com/itsallcode/white-rabbit/releases/tag/v1.8.0) / [Milestone](https://github.com/itsallcode/white-rabbit/milestone/10?closed=1)

api/build.gradle

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,6 @@ dependencies {
1717
testImplementation libs.bundles.testUtils
1818
}
1919

20-
def getOptionalProperty(String name) {
21-
if(project.hasProperty(name)) {
22-
return project.property(name)
23-
}
24-
logger.info("Project property '${name}' not available. Please add it to ~/.gradle/gradle.properties")
25-
return null
26-
}
27-
2820
publishing {
2921
publications {
3022
mavenJava(MavenPublication) {
@@ -56,21 +48,11 @@ publishing {
5648
}
5749
}
5850
}
59-
60-
repositories {
61-
maven {
62-
def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
63-
def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots/"
64-
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
65-
allowInsecureProtocol = false
66-
credentials(PasswordCredentials) {
67-
username = getOptionalProperty("ossrhUsername")
68-
password = getOptionalProperty("ossrhPassword")
69-
}
70-
}
71-
}
7251
}
7352

7453
signing {
75-
sign publishing.publications.mavenJava
54+
def signingKey = findProperty("signingKey")
55+
def signingPassword = findProperty("signingPassword")
56+
useInMemoryPgpKeys(signingKey, signingPassword)
57+
sign(publishing.publications["mavenJava"])
7658
}

build.gradle

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ plugins {
88
id "com.github.ben-manes.versions" version "0.51.0"
99
id "org.panteleyev.jpackageplugin" version "1.6.0" apply false
1010
id "org.gradle.crypto.checksum" version "1.4.0" apply false
11+
id "io.github.gradle-nexus.publish-plugin" version "2.0.0"
1112
}
1213

1314
version = "1.9.0"
@@ -103,3 +104,12 @@ tasks.named("dependencyUpdates").configure {
103104
isNonStable(it.candidate.version) && !isNonStable(it.currentVersion)
104105
}
105106
}
107+
108+
nexusPublishing {
109+
packageGroup = project.group
110+
repositories {
111+
sonatype {
112+
stagingProfileId = "546ea6ce74787e"
113+
}
114+
}
115+
}

docs/developer_guide.md

Lines changed: 14 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -66,35 +66,21 @@ Precondition for Windows: Install the [WiX Toolset](https://wixtoolset.org) and
6666
```sh
6767
./gradlew jpackage --info
6868
```
69+
### Creating a Release
6970

70-
## Deployment
71+
#### Preparations
7172

72-
This will build WhiteRabbit and publish the plugin api to Maven Central.
73+
1. Checkout the `main` branch, create a new branch.
74+
2. Update version number in `build.gradle` and `README.md`.
75+
3. Add changes in new version to `CHANGELOG.md`.
76+
4. Commit and push changes.
77+
5. Create a new pull request, have it reviewed and merged to `main`.
7378

74-
### Initial setup
79+
#### Perform the Release
7580

76-
Add the following to your `~/.gradle/gradle.properties`:
77-
78-
```properties
79-
ossrhUsername=<your maven central username>
80-
ossrhPassword=<your maven central passwort>
81-
82-
signing.keyId=<gpg key id (last 8 chars)>
83-
signing.password=<gpg key password>
84-
signing.secretKeyRingFile=<path to secret keyring file>
85-
```
86-
87-
### <a name="build_and_deploy"></a>Build and deploy
88-
89-
1. Make sure the [Changelog](../CHANGELOG.md) is updated
90-
2. Run the following command:
91-
92-
```sh
93-
./gradlew clean build publish closeAndReleaseRepository --info
94-
```
95-
96-
The release will be written to `jfxui/build/libs/white-rabbit-fx-<version>.jar`. Snapshots will be available at [oss.sonatype.org](https://oss.sonatype.org/content/repositories/snapshots/org/itsallcode/whiterabbit/).
97-
98-
3. Create a new [release](https://github.com/itsallcode/white-rabbit/releases) in GitHub and attach the built jar.
99-
4. Close the [milestone](https://github.com/itsallcode/white-rabbit/milestones) in GitHub.
100-
5. After some time the release will be available at [Maven Central](https://repo1.maven.org/maven2/org/itsallcode/whiterabbit/).
81+
1. Start the release workflow
82+
* Run command `gh workflow run release.yml --repo itsallcode/white-rabbit --ref main`
83+
* or go to [GitHub Actions](https://github.com/itsallcode/white-rabbit/actions/workflows/release.yml) and start the `release.yml` workflow on branch `main`.
84+
2. Update title and description of the newly created [GitHub release](https://github.com/itsallcode/white-rabbit/releases).
85+
3. Close the [milestone](https://github.com/itsallcode/white-rabbit/milestones) in GitHub.
86+
4. After some time the release will be available at [Maven Central](https://repo1.maven.org/maven2/org/itsallcode/whiterabbit/).

0 commit comments

Comments
 (0)