Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 9 additions & 59 deletions .github/maintainers_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,58 +106,11 @@ Refer to the [README](https://github.com/slackapi/java-slack-sdk/blob/main/docs/

### Releasing

#### Prerequisites

* If you don't have `gnu-sed`, run `brew install gnu-sed` & `brew install gnupg`
* Make sure you've set up your key https://central.sonatype.org/publish/requirements/gpg/
* Make sure the account you are using has the permission to make releases [under com.slack groupId](https://central.sonatype.com/publishing/com.slack/users)

Place `$HOME/.m2/settings.xml` with your Sonatype account information.
* Generate user token: https://central.sonatype.org/publish/generate-portal-token/
* Set the user token id/password: https://central.sonatype.org/publish/publish-portal-maven/#credentials

```xml
<settings>
<localRepository>/${your-home-dir}/.m2/repository</localRepository>
<servers>
<server>
<id>central</id>
<username>${your-username}</username>
<password>${your-password}</password>
</server>
<server>
<id>central-snapshots</id>
<username>${your-username}</username>
<password>${your-password}</password>
</server>
</servers>
<pluginGroups>
<pluginGroup>org.apache.maven.plugins</pluginGroup>
<pluginGroup>org.codehaus.mojo</pluginGroup>
</pluginGroups>
</settings>
```

#### 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/)
Snapshot releases are published by starting and approving the [release workflow](https://github.com/slackapi/java-slack-sdk/actions/workflows/release.yml) with `workflow_dispatch` for any branch with a `-SNAPSHOT` version, including the `main` branch.

* From the upstream repository
* Preparation
* `git switch main && git pull origin main` (or the branch you want to release from)
* 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.
These `-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. To learn more about snapshot releases in maven central repository check out [publish-portal-snapshots](https://central.sonatype.org/publish/publish-portal-snapshots/).

#### Stable Release

Expand All @@ -166,19 +119,16 @@ To learn more about snapshot releases in maven central repository check out [pub
* `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
* 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`)
* 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)
* Create GitHub Release(s) and add release notes
* [Look at previous releases](https://github.com/slackapi/java-slack-sdk/releases) and follow their layouts
* Prepare a release note by `git log --pretty=format:'%h %s by %an' --abbrev-commit | grep -v "Merge pull request " | head -50`
* Run `scripts/set_version.sh (the version)` (e.g., `scripts/set_version.sh 1.0.0`) — requires `gnu-sed` on macOS (`brew install gnu-sed`)
* `git add . -v && git commit -m'version (your version here)'`
* `git tag v(your version here)`
* `git push & git push --tags`
* `git push && git push --tags`
* Publish to Maven Central
* Start and approve the [release workflow](https://github.com/slackapi/java-slack-sdk/actions/workflows/release.yml) using `workflow_dispatch` on `main`
* Create a GitHub Release
* Open https://github.com/slackapi/java-slack-sdk/releases/new?tag=v${version}
* [Look at previous releases](https://github.com/slackapi/java-slack-sdk/releases) and follow their layouts
* Prepare a release note by `git log --pretty=format:'%h %s by %an' --abbrev-commit | grep -v "Merge pull request " | head -50`
* (Slack Internal) Communicate the release internally. Include a link to the GitHub Release(s).
* (Slack Internal) Tweet? Not necessary for patch updates, might be needed for minor updates, definitely needed for
major updates. Include a link to the GitHub Release(s).
Expand Down
61 changes: 61 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Release

on:
workflow_dispatch:

jobs:
publish:
name: Publish
if: github.repository == 'slackapi/java-slack-sdk'
runs-on: ubuntu-latest
environment: central
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🌲 praise: This was well documented here I found!

🔗 https://blog.7ori.dev/blog/2025/04/06/publishing-to-maven-central-with-github-actions/

permissions:
contents: read
steps:
- name: Checkout the repo
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
persist-credentials: false

- name: Set up JDK 17
uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4.8.0
with:
java-version: "17"
distribution: "adopt"
server-id: central
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.GPG_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE

- name: Add snapshot server credentials
run: |
sed -i '/<\/servers>/i \
<server>\
<id>central-snapshots</id>\
<username>${env.MAVEN_USERNAME}</username>\
<password>${env.MAVEN_PASSWORD}</password>\
</server>' ~/.m2/settings.xml

- name: Configure GPG
run: |
echo "use-agent" >> ~/.gnupg/gpg.conf
echo "pinentry-mode loopback" >> ~/.gnupg/gpg.conf
echo "allow-loopback-pinentry" >> ~/.gnupg/gpg-agent.conf
echo RELOADAGENT | gpg-connect-agent

- name: Publish to Maven Central
run: |
./mvnw clean deploy \
-P production-releases \
-D maven.test.skip=true \
-D gpg.passphrase="${MAVEN_GPG_PASSPHRASE}" \
-pl !bolt-kotlin-examples \
-pl !bolt-quarkus-examples \
--batch-mode \
--no-transfer-progress
env:
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
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"
4 changes: 2 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -608,8 +608,8 @@ Documentation: https://docs.slack.dev/tools/java-slack-sdk/guides/bolt-basics

Releases publish all modules simultaneously to Maven Central via Sonatype.

- **Snapshot**: Version must end with `-SNAPSHOT`. Run `scripts/set_version.sh 1.x.y-SNAPSHOT` then `scripts/release.sh`
- **Stable**: Run `scripts/set_version.sh 1.x.y` then `scripts/release.sh`. Requires JDK 17, GPG signing, and Sonatype credentials in `~/.m2/settings.xml`
- **Snapshot**: Trigger the [release workflow](.github/workflows/release.yml) via `workflow_dispatch` on any branch with a `-SNAPSHOT` version.
- **Stable**: Run `scripts/set_version.sh 1.x.y`, commit, tag `v1.x.y`, push to `main`, then trigger the [release workflow](.github/workflows/release.yml) via `workflow_dispatch`.
- Version is set across all `pom.xml` files AND three generated version classes (generated by `scripts/set_version.sh`):
- `slack-api-model/src/main/java/com/slack/api/meta/SlackApiModelLibraryVersion.java`
- `slack-api-client/src/main/java/com/slack/api/meta/SlackApiClientLibraryVersion.java`
Expand Down
41 changes: 0 additions & 41 deletions scripts/release.sh
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🫡 praise: Farewell to this scripts but I'm hoping upstreamed runs can have more stable packagings-

This file was deleted.