Skip to content

Commit 1595819

Browse files
feat: support snapshot releases in release process (#1514)
* feat: support snapshot releases in release process * Update phrasing
1 parent a8f837f commit 1595819

File tree

3 files changed

+39
-79
lines changed

3 files changed

+39
-79
lines changed

.github/maintainers_guide.md

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Maintaining this project requires installing [OpenJDK](https://openjdk.java.net/
1010

1111
### Testing
1212

13-
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.
13+
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.
1414

1515
```bash
1616
./scripts/run_no_prep_tests.sh
@@ -109,7 +109,28 @@ Place `$HOME/.m2/settings.xml` with your Sonatype account information.
109109
</settings>
110110
```
111111

112-
#### Operations
112+
#### Snapshot Release
113+
114+
Snapshot releases are intended for developers to make pre-release versions of their projects available for testing.
115+
To learn more about snapshot releases in maven central repository check out [publish-portal-snapshots](https://central.sonatype.org/publish/publish-portal-snapshots/)
116+
117+
* From the upstream repository
118+
* Preparation
119+
* `git switch main && git pull origin main`
120+
* Make sure there are no build failures at https://github.com/slackapi/java-slack-sdk/actions
121+
* Set a new version
122+
* 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.
123+
* If you don't have `gnu-sed`, check out [Prerequisites](#prerequisites)
124+
* Run `scripts/set_version.sh (the version)` (e.g., `scripts/set_version.sh 1.0.0-SNAPSHOT`)
125+
* Ship the libraries
126+
* Switch to **JDK 17** to publish all modules (on macOS, you can run `export JAVA_HOME=$(/usr/libexec/java_home -v 17)` for it)
127+
* Run `scripts/release.sh` (it takes a bit long)
128+
* (If you encounter an error, log in https://oss.sonatype.org/ to check detailed information)
129+
* No need to create a GitHub Release, since this is intended for developers to make pre-release versions of their projects.
130+
* `-SNAPSHOT` versions are intended to be overwritten.
131+
* This enables developers to work with the latest version of a library without needing to update their dependencies repeatedly.
132+
133+
#### Stable Release
113134

114135
* From the upstream repository
115136
* Preparation

pom.xml

Lines changed: 0 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -343,77 +343,6 @@
343343
</plugins>
344344
</build>
345345
</profile>
346-
<profile>
347-
<id>snapshot-releases</id>
348-
<activation>
349-
<property>
350-
<name>performRelease</name>
351-
<value>true</value>
352-
</property>
353-
</activation>
354-
<build>
355-
<plugins>
356-
<plugin>
357-
<artifactId>maven-release-plugin</artifactId>
358-
<version>${maven-release-plugin.version}</version>
359-
<configuration>
360-
<goals>deploy,site-deploy</goals>
361-
</configuration>
362-
</plugin>
363-
<plugin>
364-
<groupId>org.apache.maven.plugins</groupId>
365-
<artifactId>maven-gpg-plugin</artifactId>
366-
<version>${maven-gpg-plugin.version}</version>
367-
<executions>
368-
<execution>
369-
<id>sign-artifacts</id>
370-
<phase>verify</phase>
371-
<goals>
372-
<goal>sign</goal>
373-
</goals>
374-
</execution>
375-
</executions>
376-
</plugin>
377-
<plugin>
378-
<groupId>org.projectlombok</groupId>
379-
<artifactId>lombok-maven-plugin</artifactId>
380-
<version>${lombok-maven-plugin.version}</version>
381-
<configuration>
382-
<sourceDirectory>${project.basedir}/src/main/java</sourceDirectory>
383-
<outputDirectory>${delombok.output}</outputDirectory>
384-
<addOutputDirectory>false</addOutputDirectory>
385-
</configuration>
386-
<executions>
387-
<execution>
388-
<phase>generate-sources</phase>
389-
<goals>
390-
<goal>delombok</goal>
391-
</goals>
392-
</execution>
393-
</executions>
394-
</plugin>
395-
<plugin>
396-
<artifactId>maven-javadoc-plugin</artifactId>
397-
<version>${maven-javadoc-plugin.version}</version>
398-
<configuration>
399-
<source>8</source>
400-
</configuration>
401-
<executions>
402-
<execution>
403-
<id>attach-sources</id>
404-
<goals>
405-
<goal>jar</goal>
406-
</goals>
407-
<configuration>
408-
<additionalJOption>-Xdoclint:none</additionalJOption>
409-
<sourcepath>${delombok.output}</sourcepath>
410-
</configuration>
411-
</execution>
412-
</executions>
413-
</plugin>
414-
</plugins>
415-
</build>
416-
</profile>
417346
<profile>
418347
<id>building-with-jdk-17</id>
419348
<activation>

scripts/release.sh

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22

3-
is_jdk_8=`echo $JAVA_HOME | grep 8.`
4-
is_travis_jdk_8=`echo $TRAVIS_JDK | grep openjdk8`
3+
is_jdk_8=$(echo "$JAVA_HOME" | grep 8.)
4+
is_travis_jdk_8=$(echo "$TRAVIS_JDK" | grep openjdk8)
55
if [[ "${is_jdk_8}" != "" && "${is_travis_jdk_8}" != "" ]];
66
then
77
echo "Please use OpenJDK 11 for releasing these libraries."
@@ -10,19 +10,29 @@ fi
1010

1111
exclusion="-pl !bolt-kotlin-examples -pl !bolt-quarkus-examples"
1212

13-
dir=`dirname $0`/..
14-
release_version=`sed -n 's/<version>\([^\$]\..*\)<\/version>$/\1/p' < ${dir}/pom.xml`
13+
dir=$(dirname "$0")/..
14+
release_version=$(sed -n 's/^[[:space:]]*<version>\([^\$]\..*\)<\/version>[[:space:]]*$/\1/p' < "${dir}"/pom.xml)
1515

1616
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"
1717

1818
if [[ "${release_version}" =~ ^.+-SNAPSHOT$ ]]; then
19-
profile=snapshot-releases
19+
echo "🚀 Releasing a SNAPSHOT version ($release_version) of the project."
20+
profile=production-releases
2021
mvn clean \
2122
deploy \
22-
-P snapshot-releases \
23+
-P production-releases \
2324
-D maven.test.skip=true \
2425
${exclusion}
2526
else
27+
echo "You are releasing a stable version ($release_version) of the project."
28+
read -r -p "This will be available publicly. Is this correct? (y/N): " confirmation
29+
30+
if [[ ! "$confirmation" =~ ^[Yy]$ ]]; then
31+
echo "Release cancelled by user!"
32+
exit 0
33+
fi
34+
echo "Confirmed. Proceeding with the stable release."
35+
2636
profile=production-releases
2737
mvn clean \
2838
deploy \

0 commit comments

Comments
 (0)