Skip to content

Commit

Permalink
Fix release build (#281)
Browse files Browse the repository at this point in the history
* Update release instructions

* Add v as version tag prefix

* Configure maven central publishing

* Update changelog entry

---------

Co-authored-by: kaklakariada <[email protected]>
  • Loading branch information
kaklakariada and kaklakariada authored Sep 8, 2024
1 parent b43f1ac commit b2b0f8e
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 72 deletions.
5 changes: 0 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/github_release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
37 changes: 22 additions & 15 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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)
Expand Down
26 changes: 4 additions & 22 deletions api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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"])
}
10 changes: 10 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -103,3 +104,12 @@ tasks.named("dependencyUpdates").configure {
isNonStable(it.candidate.version) && !isNonStable(it.currentVersion)
}
}

nexusPublishing {
packageGroup = project.group
repositories {
sonatype {
stagingProfileId = "546ea6ce74787e"
}
}
}
42 changes: 14 additions & 28 deletions docs/developer_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -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=<your maven central username>
ossrhPassword=<your maven central passwort>

signing.keyId=<gpg key id (last 8 chars)>
signing.password=<gpg key password>
signing.secretKeyRingFile=<path to secret keyring file>
```

### <a name="build_and_deploy"></a>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-<version>.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/).

0 comments on commit b2b0f8e

Please sign in to comment.