Skip to content

Commit 94550f5

Browse files
authored
Release 4.3.0 isaacbrodsky (#171)
* begin release workflow * add release workflow file * sequence * debug output * prettier, enable * change per review * changelog * revert mac changes * change per review * changelog * wip: release io.github.isaacbrodsky * test on this repo * fix * env name * fix url * no close * uncomment * not on pr * release 4.3.0 from isaacbrodsky
1 parent e83574f commit 94550f5

File tree

5 files changed

+262
-18
lines changed

5 files changed

+262
-18
lines changed

.github/workflows/release.yml

Lines changed: 224 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,224 @@
1+
name: Release to Maven Central
2+
3+
on:
4+
# Manual trigger
5+
workflow_dispatch:
6+
inputs:
7+
release_version:
8+
description: "Version to release (if empty, derive from project version)"
9+
required: false
10+
# Automatic trigger on pushing a version tag (e.g., "v1.2.3")
11+
push:
12+
tags:
13+
- "v*"
14+
15+
jobs:
16+
# Corresponds to tests in tests.yml
17+
build-with-docker:
18+
name: Build ${{ matrix.dockcross-only }} (Dockcross)
19+
runs-on: ${{ matrix.os }}
20+
21+
strategy:
22+
matrix:
23+
os: [ubuntu-latest]
24+
java-distribution: [adopt]
25+
java-version: [8]
26+
dockcross-only:
27+
[
28+
"android-arm",
29+
"android-arm64",
30+
"linux-arm64",
31+
"linux-armv5",
32+
"linux-armv7",
33+
"linux-s390x",
34+
"linux-ppc64le",
35+
"linux-x64",
36+
"linux-x86",
37+
"windows-static-x64",
38+
"windows-static-x86",
39+
]
40+
41+
steps:
42+
- uses: actions/checkout@v4
43+
with:
44+
submodules: recursive
45+
46+
- uses: actions/setup-java@v2
47+
with:
48+
distribution: "${{ matrix.java-distribution }}"
49+
java-version: "${{ matrix.java-version }}"
50+
51+
- uses: gradle/actions/setup-gradle@v3
52+
with:
53+
gradle-version: wrapper
54+
55+
- uses: actions/cache@v4
56+
id: gradle-cache
57+
with:
58+
path: |
59+
~/.gradle/caches
60+
~/.gradle/wrapper
61+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
62+
restore-keys: |
63+
${{ runner.os }}-gradle-
64+
65+
- name: Tests
66+
run: ./gradlew clean test -Ph3SystemPrune=true "-Ph3DockcrossOnly=${{ matrix.dockcross-only }}"
67+
env:
68+
OCI_EXE: docker
69+
70+
- uses: actions/upload-artifact@v4
71+
name: Upload artifacts
72+
with:
73+
name: docker-built-shared-objects-${{ matrix.dockcross-only }}
74+
path: |
75+
src/main/resources/*/*.so
76+
src/main/resources/*/*.dll
77+
if-no-files-found: error
78+
79+
# Corresponsd to tests-no-docker in tests.yml
80+
build:
81+
name: Build ${{ matrix.os }}
82+
runs-on: ${{ matrix.os }}
83+
84+
strategy:
85+
matrix:
86+
os: [macos-latest]
87+
java-distribution: [adopt]
88+
java-version: [8]
89+
90+
steps:
91+
- uses: actions/checkout@v4
92+
with:
93+
submodules: recursive
94+
95+
- uses: actions/setup-java@v2
96+
with:
97+
distribution: "${{ matrix.java-distribution }}"
98+
java-version: "${{ matrix.java-version }}"
99+
100+
- uses: gradle/actions/setup-gradle@v3
101+
with:
102+
gradle-version: wrapper
103+
104+
- uses: actions/cache@v4
105+
id: gradle-cache
106+
with:
107+
path: |
108+
~/.gradle/caches
109+
~/.gradle/wrapper
110+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
111+
restore-keys: |
112+
${{ runner.os }}-gradle-
113+
114+
- name: Tests
115+
run: ./gradlew clean test
116+
117+
- uses: actions/upload-artifact@v4
118+
name: Upload Mac OS Artifacts
119+
with:
120+
name: macos-built-shared-objects
121+
path: src/main/resources/*/*.dylib
122+
if-no-files-found: error
123+
124+
release:
125+
runs-on: ubuntu-latest
126+
permissions:
127+
contents: write # allow pushing commits/tags
128+
129+
needs:
130+
- build-with-docker
131+
- build
132+
133+
steps:
134+
- name: Check out code
135+
uses: actions/checkout@v3
136+
137+
- name: Set up JDK
138+
uses: actions/setup-java@v3
139+
with:
140+
distribution: "temurin"
141+
java-version: "21"
142+
143+
- name: Determine release version
144+
id: vars
145+
run: |
146+
# Derive the release version (drop "-SNAPSHOT") from Gradle project or input
147+
VERSION_INPUT="${{ github.event.inputs.release_version || '' }}"
148+
if [ -n "$VERSION_INPUT" ]; then
149+
RELEASE_VERSION="$VERSION_INPUT"
150+
else
151+
RELEASE_VERSION=$(grep -E 'version=' gradle.properties | sed -E 's/version=//')
152+
fi
153+
echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV
154+
155+
- name: Remove -SNAPSHOT suffix (prepare release version)
156+
if: ${{ github.event_name == 'workflow_dispatch' }}
157+
run: |
158+
sed -i -E "s/${RELEASE_VERSION}-SNAPSHOT/$RELEASE_VERSION/" gradle.properties || true
159+
git config user.name "github-actions"
160+
git config user.email "[email protected]"
161+
git commit -am "chore: release $RELEASE_VERSION [skip ci]"
162+
163+
- name: Create Git tag for release
164+
if: ${{ github.event_name == 'workflow_dispatch' }}
165+
run: |
166+
git tag -a "v${RELEASE_VERSION}" -m "Release $RELEASE_VERSION"
167+
git push origin HEAD:master --follow-tags
168+
169+
- name: Download Docker binaries
170+
uses: actions/[email protected]
171+
with:
172+
pattern: docker-built-shared-objects-*
173+
merge-multiple: true
174+
path: src/main/resources/
175+
176+
- name: Download Mac binaries
177+
uses: actions/[email protected]
178+
with:
179+
name: macos-built-shared-objects
180+
path: src/main/resources/
181+
182+
- name: Download and test
183+
run: |
184+
./gradlew clean test assemble -Ph3GithubArtifactsUse=true -Ph3GithubArtifactsByRun=true
185+
186+
- name: List files in jars
187+
run: |
188+
ls -lh build/libs
189+
for f in build/libs/*.jar; do
190+
echo "File: $f"
191+
unzip -l "$f"
192+
done
193+
194+
- name: Publish to Sonatype OSSRH (Maven Central)
195+
env:
196+
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
197+
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
198+
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
199+
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
200+
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
201+
OSSRH_STAGING_PROFILE_ID: ${{ secrets.OSSRH_STAGING_PROFILE_ID }}
202+
run: ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository -Ph3GithubArtifactsUse=true -Ph3GithubArtifactsByRun=true
203+
204+
- name: Create GitHub Release (with changelog notes)
205+
# This uses an action to create a release on GitHub
206+
uses: softprops/action-gh-release@v1
207+
with:
208+
tag_name: "v${{ env.RELEASE_VERSION }}"
209+
name: "${{ env.RELEASE_VERSION }}"
210+
body_path: CHANGELOG.md # assumes changelog contains latest release notes at top
211+
env:
212+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
213+
214+
- name: Bump to next snapshot version
215+
if: ${{ github.event_name != 'workflow_dispatch' }}
216+
run: |
217+
# Bump minor version (for example) and append -SNAPSHOT for continued development
218+
NEXT_VERSION=$(echo $RELEASE_VERSION | awk -F. -v OFS="." '{$NF += 1; print $0}') # increment last segment
219+
NEXT_VERSION="$NEXT_VERSION-SNAPSHOT"
220+
sed -i -E "s/$RELEASE_VERSION/$NEXT_VERSION/" gradle.properties || true
221+
git config user.name "github-actions"
222+
git config user.email "[email protected]"
223+
git commit -am "chore: start next development cycle $NEXT_VERSION [skip ci]"
224+
git push origin HEAD:master

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,21 @@ file [H3Core.java](./src/main/java/com/uber/h3core/H3Core.java), and support
77
for the Linux x64 and Darwin x64 platforms.
88

99
## Unreleased Changes
10+
## Added
11+
- `polygonToCellsExperimental` functions from H3 v4.2.0. (#163)
12+
- `gridRing` function from H3 v4.3.0. (#169)
13+
14+
## Fixed
15+
- Corrected order of `polygonToCellsExperimental` arguments. (#166)
16+
- Fixed build on ARM Linux. (#162)
17+
18+
## Changed
19+
- Converted build system to Gradle and automated deploys. Added separate build steps for mac OS on M1 (ARM) and x64. (#167, #168)
20+
- Upgraded the core library to v4.2.1. (#165)
1021

1122
## [4.1.2] - 2024-11-01
23+
Note: This release is not available in Maven Central.
24+
1225
## Fixed
1326
- Fixed a memory leak in `polygonToCells` and optimize JNI calls. (#150)
1427
- Use `Files.createTempFile` so temporary file permissions are more restrictive. (#141)

build.gradle

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ plugins {
1818
id 'io.github.gradle-nexus.publish-plugin' version '1.3.0'
1919
}
2020

21-
group = 'com.uber'
22-
version = '4.1.3-SNAPSHOT'
21+
group = 'io.github.isaacbrodsky'
2322
description = 'Java bindings for H3, a hierarchical hexagonal geospatial indexing system.'
2423

2524
java {
@@ -124,7 +123,7 @@ publishing {
124123
from components.java
125124
pom {
126125
name = 'h3'
127-
url = 'https://github.com/uber/h3-java'
126+
url = 'https://github.com/isaacbrodsky/h3-java'
128127
description = project.description
129128
licenses {
130129
license {
@@ -133,22 +132,20 @@ publishing {
133132
distribution = 'repo'
134133
}
135134
}
136-
organization {
137-
name = 'Uber Open Source'
138-
url = 'https://github.com/uber/'
139-
}
135+
// organization {
136+
// name = 'Uber Open Source'
137+
// url = 'https://github.com/uber/'
138+
// }
140139
scm {
141-
connection = 'scm:git:git://github.com/uber/h3-java.git'
142-
developerConnection = 'scm:git:ssh://[email protected]/uber/h3-java.git'
143-
url = 'http://github.com/uber/h3-java/tree/master'
140+
connection = 'scm:git:git://github.com/isaacbrodsky/h3-java.git'
141+
developerConnection = 'scm:git:ssh://[email protected]/isaacbrodsky/h3-java.git'
142+
url = 'http://github.com/isaacbrodsky/h3-java/tree/master'
144143
}
145144
developers {
146145
developer {
147146
id = 'isaacbrodsky'
148147
name = 'Isaac Brodsky'
149148
150-
organization = 'Uber Technologies, Inc.'
151-
organizationUrl = 'https://github.com/uber/'
152149
}
153150
}
154151
}
@@ -181,12 +178,15 @@ signing {
181178
nexusPublishing {
182179
repositories {
183180
sonatype {
184-
stagingProfileId.set(System.getenv("OSSRH_STAGING_PROFILE_ID"))
181+
// Performance optimization, not needed:
182+
// stagingProfileId.set(System.getenv("OSSRH_STAGING_PROFILE_ID"))
185183
username.set(System.getenv("OSSRH_USERNAME"))
186184
password.set(System.getenv("OSSRH_PASSWORD"))
187185
// For newer Sonatype accounts (after Feb 2021) use "s01.oss.sonatype.org":
188-
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
189-
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
186+
// nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
187+
// snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
188+
nexusUrl.set(uri("https://ossrh-staging-api.central.sonatype.com/service/local/"))
189+
snapshotRepositoryUrl.set(uri("https://central.sonatype.com/repository/maven-snapshots/"))
190190
}
191191
}
192192
}

docs/releasing.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
The H3-Java library is published to Maven Central via OSSRH.
44

5+
The release is triggered via GitHub Actions, when a tag of the form `v1.2.3` is pushed, or via workflow dispatch. The release workflow handles all parts of the release.
6+
7+
## Old instructions for manual releasing
8+
59
You must be a member of the `com.uber` group to release the library via OSSRH. You must have a [signing key](http://central.sonatype.org/pages/working-with-pgp-signatures.html) setup, and you must have your OSSRH username and password in the appropriate [Maven settings file](http://central.sonatype.org/pages/apache-maven.html).
610

711
Release builds pull artifacts from Github Actions. This is needed so that the deployed artifact contains all supported operating system/architecture combinations. (In particular, Mac OS artifacts must be built natively.) In order to release, there must be a completed build of the Git commit to release on Github. The build must be less than 30 days old, as artifacts are only kept for that time.
@@ -13,14 +17,14 @@ Release builds pull artifacts from Github Actions. This is needed so that the de
1317
5. If this looks good, close and release the build in [Sonatype Nexus Manager](https://oss.sonatype.org/).
1418
6. Update `CHANGELOG.md` to have an Unreleased section, and commit. The release is now done and development can resume from this point.
1519

16-
## Troubleshooting
20+
### Troubleshooting
1721

18-
### Dependencies for `pull-from-github.sh`
22+
#### Dependencies for `pull-from-github.sh`
1923

2024
* You should install the [Github CLI](https://cli.github.com) and authenticate with it first. You may need to use a personal access token (classic) with workflows scope.
2125
* `jq`
2226

23-
### gpg: signing failed: Inappropriate ioctl for device
27+
#### gpg: signing failed: Inappropriate ioctl for device
2428

2529
Per [StackOverflow](https://stackoverflow.com/questions/57591432/gpg-signing-failed-inappropriate-ioctl-for-device-on-macos-with-maven), run the following before `mvn release:perform`:
2630

gradle.properties

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,6 @@
44
# Blocked on https://github.com/nbaztec/coveralls-jacoco-gradle-plugin/issues/66
55
org.gradle.configuration-cache=false
66

7+
# No spaces on the following line, needed by release.tml
8+
version=4.3.0
9+

0 commit comments

Comments
 (0)