From 833a00e49eaede8e28469a9f8a89d894a92c6fec Mon Sep 17 00:00:00 2001 From: William Bergamin Date: Wed, 8 Oct 2025 10:46:07 -0400 Subject: [PATCH 1/2] feat: support snapshot releases in release process --- .github/maintainers_guide.md | 25 ++++++++++++- pom.xml | 71 ------------------------------------ scripts/release.sh | 22 ++++++++--- 3 files changed, 39 insertions(+), 79 deletions(-) diff --git a/.github/maintainers_guide.md b/.github/maintainers_guide.md index 6c2aa1d62..10cd8d61d 100644 --- a/.github/maintainers_guide.md +++ b/.github/maintainers_guide.md @@ -10,7 +10,7 @@ Maintaining this project requires installing [OpenJDK](https://openjdk.java.net/ ### Testing -This project has tests for individual packages inside of each's respective `src/test/java` directory. All the tests under `test_locally` package are executed in every single GitHub Actions CI build as below. +This project has tests for individual packages inside each's respective `src/test/java` directory. All the tests under `test_locally` package are executed in every single GitHub Actions CI build as below. ```bash ./scripts/run_no_prep_tests.sh @@ -109,7 +109,28 @@ Place `$HOME/.m2/settings.xml` with your Sonatype account information. ``` -#### Operations +#### Snapshot Release + +Snapshot releases are intended for developers to make pre-release versions of their projects available for testing. +To learn more about snapshot releases in maven central repository check out [publish-portal-snapshots](https://central.sonatype.org/publish/publish-portal-snapshots/) + +* From the upstream repository +* Preparation + * `git switch main && git pull origin main` + * Make sure there are no build failures at https://github.com/slackapi/java-slack-sdk/actions +* Set a new version + * It is **critical** that the version ends with `-SNAPSHOT`. This is how [central-publishing-maven-plugin](https://central.sonatype.org/publish/publish-portal-snapshots/#publishing-with-the-central-publishing-maven-plugin) automatically recognizes snapshot releases and uploads them the right location. + * If you don't have `gnu-sed`, check out [Prerequisites](#prerequisites) + * Run `scripts/set_version.sh (the version)` (e.g., `scripts/set_version.sh 1.0.0-SNAPSHOT`) +* Ship the libraries + * Switch to **JDK 17** to publish all modules (on macOS, you can run `export JAVA_HOME=$(/usr/libexec/java_home -v 17)` for it) + * Run `scripts/release.sh` (it takes a bit long) + * (If you encounter an error, log in https://oss.sonatype.org/ to check detailed information) +* No need to create a GitHub Release, since this is intended for developers to make pre-release versions of their projects. +* `-SNAPSHOT` versions are intended to be overwritten. + * This enables developers to work with the latest version of a library without needing to update their dependencies repeatedly. + +#### Stable Release * From the upstream repository * Preparation diff --git a/pom.xml b/pom.xml index ceef24cbe..7c72402fe 100644 --- a/pom.xml +++ b/pom.xml @@ -343,77 +343,6 @@ - - snapshot-releases - - - performRelease - true - - - - - - maven-release-plugin - ${maven-release-plugin.version} - - deploy,site-deploy - - - - org.apache.maven.plugins - maven-gpg-plugin - ${maven-gpg-plugin.version} - - - sign-artifacts - verify - - sign - - - - - - org.projectlombok - lombok-maven-plugin - ${lombok-maven-plugin.version} - - ${project.basedir}/src/main/java - ${delombok.output} - false - - - - generate-sources - - delombok - - - - - - maven-javadoc-plugin - ${maven-javadoc-plugin.version} - - 8 - - - - attach-sources - - jar - - - -Xdoclint:none - ${delombok.output} - - - - - - - building-with-jdk-17 diff --git a/scripts/release.sh b/scripts/release.sh index 0d8b5bd88..04587a0ce 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -1,7 +1,7 @@ #!/bin/bash -is_jdk_8=`echo $JAVA_HOME | grep 8.` -is_travis_jdk_8=`echo $TRAVIS_JDK | grep openjdk8` +is_jdk_8=$(echo "$JAVA_HOME" | grep 8.) +is_travis_jdk_8=$(echo "$TRAVIS_JDK" | grep openjdk8) if [[ "${is_jdk_8}" != "" && "${is_travis_jdk_8}" != "" ]]; then echo "Please use OpenJDK 11 for releasing these libraries." @@ -10,19 +10,29 @@ fi exclusion="-pl !bolt-kotlin-examples -pl !bolt-quarkus-examples" -dir=`dirname $0`/.. -release_version=`sed -n 's/\([^\$]\..*\)<\/version>$/\1/p' < ${dir}/pom.xml` +dir=$(dirname "$0")/.. +release_version=$(sed -n 's/^[[:space:]]*\([^\$]\..*\)<\/version>[[:space:]]*$/\1/p' < "${dir}"/pom.xml) export MAVEN_OPTS="--add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.text=ALL-UNNAMED --add-opens=java.desktop/java.awt.font=ALL-UNNAMED" if [[ "${release_version}" =~ ^.+-SNAPSHOT$ ]]; then - profile=snapshot-releases + echo "🚀 Releasing a SNAPSHOT version ($release_version) of the project." + profile=production-releases mvn clean \ deploy \ - -P snapshot-releases \ + -P production-releases \ -D maven.test.skip=true \ ${exclusion} else + echo "You are releasing a stable version ($release_version) of the project." + read -r -p "This will be available publicly. Is this correct? (y/N): " confirmation + + if [[ ! "$confirmation" =~ ^[Yy]$ ]]; then + echo "Release cancelled by user!" + exit 0 + fi + echo "Confirmed. Proceeding with the official release." + profile=production-releases mvn clean \ deploy \ From 79992815565d5954b56920c0997f853b8d5ab745 Mon Sep 17 00:00:00 2001 From: William Bergamin Date: Wed, 8 Oct 2025 10:50:52 -0400 Subject: [PATCH 2/2] Update phrasing --- scripts/release.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/release.sh b/scripts/release.sh index 04587a0ce..bbc14b80e 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -31,7 +31,7 @@ else echo "Release cancelled by user!" exit 0 fi - echo "Confirmed. Proceeding with the official release." + echo "Confirmed. Proceeding with the stable release." profile=production-releases mvn clean \