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
21 changes: 21 additions & 0 deletions .agents/skills/release_jasync_sql/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
name: release-jasync-sql
description: Executes a jasync-sql release across git branches, Sonatype Maven Central CD, GitHub Releases, README snippets, and next-version preparation following RELEASING.md. Use when asked to release, cut, or publish a new version of jasync-sql.
---

# Release `jasync-sql`

Follow the canonical release runbook in [RELEASING.md](../../../RELEASING.md) step by step.

## Agent Execution Rules & Approval Gates

1. **Read [RELEASING.md](../../../RELEASING.md) first** to confirm exact branch names, file locations, and command flags.
2. **Execute local preparation autonomously (Steps 1–3)**:
- Fetch `origin --prune --tags`, fast-forward local `master` to `origin/master`, verify recent `CI` workflow runs on `master` passed, confirm `version = "X.Y.Z"` in `build.gradle.kts`, and rebase local `github-release` onto `master`.
- Preview release notes via `gh api --method POST repos/jasync-sql/jasync-sql/releases/generate-notes` (`target_commitish=master` or `github-release`) and prepare a concise curated draft (preserving feature/fix/doc PRs and `New Contributors`).
3. **Pause for explicit user approval before irreversible remote actions** (unless the user already approved them in the prompt):
- **Gate 1 — Push `github-release` (`Step 4`)**: Confirm before running `git push origin github-release`, since this triggers `.github/workflows/cd.yml` to publish all 6 `jasync-*` artifacts (`X.Y.Z`) to Sonatype Maven Central.
- **Gate 2 — Publish GitHub Release (`Step 5`)**: Show the curated release notes for confirmation/edits before running `gh release create "X.Y.Z" --repo jasync-sql/jasync-sql --target github-release --title "X.Y.Z" --latest ...` (always pass `--target github-release` so tag `X.Y.Z` points to the `X.Y.Z` release commit rather than the `N+1` bump commit).
4. **Verify CD & finish `master` preparation (`Steps 4 & 6`)**:
- Monitor the `CD` workflow run on `github-release` (`gh run list --repo jasync-sql/jasync-sql --branch github-release --workflow cd.yml --limit 1`; note Fine-Grained PATs do not support `gh run watch`, so poll `gh run view <run_id> --json status,conclusion` via `schedule` if using a Fine-Grained PAT) to confirm Maven Central publishing succeeded.
- Switch back to `master`, update `README.md` Maven/Gradle version snippets (`jasync-mysql` and `jasync-postgresql`) to `X.Y.Z`, bump `build.gradle.kts` to `X.Y.(Z+1)`, and open/merge a PR to `master` (confirming before pushing if not already approved).
48 changes: 48 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: CD

on:
push:
branches:
- github-release

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Configure JDK 8
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '8'
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b
- name: Publish
env:
SONATYPE_USERNAME_2: ${{ secrets.SONATYPE_USERNAME_2 }}
SONATYPE_PASSWORD_2: ${{ secrets.SONATYPE_PASSWORD_2 }}
LEGACY_SONATYPE_USERNAME: ${{ secrets.ORG_GRADLE_PROJECT_SONATYPEUSERNAME }}
LEGACY_SONATYPE_PASSWORD: ${{ secrets.ORG_GRADLE_PROJECT_SONATYPEPASSWORD }}
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_PRIVATE_PASSWORD: ${{ secrets.GPG_PRIVATE_PASSWORD }}
SIGNING_KEY_RING_FILE: ${{ secrets.SIGNING_KEY_RING_FILE }}
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
run: |
export ORG_GRADLE_PROJECT_sonatypeUsername="${SONATYPE_USERNAME_2:-$LEGACY_SONATYPE_USERNAME}"
export ORG_GRADLE_PROJECT_sonatypePassword="${SONATYPE_PASSWORD_2:-$LEGACY_SONATYPE_PASSWORD}"
if [ -z "$ORG_GRADLE_PROJECT_sonatypeUsername" ] || [ -z "$ORG_GRADLE_PROJECT_sonatypePassword" ]; then
echo "::error::Missing Sonatype credentials (configure SONATYPE_USERNAME_2/SONATYPE_PASSWORD_2 or ORG_GRADLE_PROJECT_SONATYPEUSERNAME/ORG_GRADLE_PROJECT_SONATYPEPASSWORD)"
exit 1
fi
if [ -n "$GPG_PRIVATE_KEY" ]; then
./gradlew clean build publishToSonatype closeAndReleaseSonatypeStagingRepository --no-daemon --no-parallel -x test --stacktrace
elif [ -n "$SIGNING_KEY_RING_FILE" ]; then
mkdir -p ~/.gradle
printf '%s\n' "$SIGNING_KEY_RING_FILE" | base64 -di > ~/.gradle/secring.gpg
./gradlew clean build publishToSonatype closeAndReleaseSonatypeStagingRepository --no-daemon --no-parallel -x test --stacktrace -Psigning.keyId="$SIGNING_KEY_ID" -Psigning.password="$SIGNING_PASSWORD" -Psigning.secretKeyRingFile="$HOME/.gradle/secring.gpg"
else
echo "::error::Missing GPG signing credentials (configure GPG_PRIVATE_KEY/GPG_PRIVATE_PASSWORD or SIGNING_KEY_RING_FILE/SIGNING_KEY_ID/SIGNING_PASSWORD)"
exit 1
fi
33 changes: 3 additions & 30 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,42 +6,15 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up JDK 8
uses: actions/setup-java@v2
uses: actions/setup-java@v4
with:
java-version: '8'
distribution: 'adopt'
distribution: 'temurin'
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b
- run: ./gradlew clean build --stacktrace
- run: ./resources/detect-leak.sh mysql-async/target/mysql-async-tests.log
- run: ./resources/detect-leak.sh postgresql-async/target/postgresql-async-tests.log
- run: ./gradlew codeCoverageReport --info --stacktrace
# - ./gradlew build -Pnetty_version=4.0.56.Final
# - ./gradlew clean build -x test
# - ./gradlew :mysq-async:test --tests com.github.jasync.sql.db.mysql.QueryTimeoutSpec --info

release:
runs-on: ubuntu-latest
if: success() && github.ref == 'refs/heads/github-release'
needs: build
env:
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.ORG_GRADLE_PROJECT_SONATYPEPASSWORD }}
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.ORG_GRADLE_PROJECT_SONATYPEUSERNAME }}
steps:
- uses: actions/checkout@v2
- name: Set up JDK 8
uses: actions/setup-java@v2
with:
java-version: '8'
distribution: 'adopt'
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b
#After decoding the secret key, place the file in ~/.gradle/secring.gpg
- name: Decode
run: |
mkdir ~/.gradle
echo "${{secrets.SIGNING_KEY_RING_FILE}}" > ~/.gradle/secring.gpg.b64
base64 -d ~/.gradle/secring.gpg.b64 > ~/.gradle/secring.gpg
- run: ./gradlew clean build publishToSonatype closeAndReleaseSonatypeStagingRepository -no-daemon --no-parallel -x test --stacktrace -Psigning.keyId=${{secrets.SIGNING_KEY_ID}} -Psigning.password=${{secrets.SIGNING_PASSWORD}} -Psigning.secretKeyRingFile=$(echo ~/.gradle/secring.gpg)
112 changes: 112 additions & 0 deletions RELEASING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
# Releasing `jasync-sql`

This document describes the step-by-step playbook for cutting a new `jasync-sql` release from `master`.

## Prerequisites

- Push access to `https://github.com/jasync-sql/jasync-sql`.
- Authenticated GitHub CLI (`gh auth status`) with `repo` / `contents:write` and `actions:read` permissions.
- Repository secrets configured on GitHub Actions used by [`.github/workflows/cd.yml`](.github/workflows/cd.yml):
- Sonatype Central Portal User Token: `SONATYPE_USERNAME_2` and `SONATYPE_PASSWORD_2` (or `ORG_GRADLE_PROJECT_SONATYPEUSERNAME` / `ORG_GRADLE_PROJECT_SONATYPEPASSWORD`).
- GPG signing credentials: `GPG_PRIVATE_KEY` (ASCII-armored private key) and `GPG_PRIVATE_PASSWORD` (or legacy `SIGNING_KEY_RING_FILE`, `SIGNING_KEY_ID`, `SIGNING_PASSWORD`).

---

## Standard Release Flow (`2.x` from `master`)

Assume `X.Y.Z` is the version being released (e.g., `2.2.5`), `PREV_TAG` is the previous release tag (e.g., `2.2.4`), and `NEXT_VERSION` is the next patch version (e.g., `2.2.6`).

### 1. Update `master` from Remote

Fetch all remote branches and tags, switch to `master`, fast-forward to `origin/master`, and ensure the working tree is clean:

```bash
git fetch origin --prune --tags
git checkout master
git merge --ff-only origin/master
git status --short
```

Verify recent CI checks on `master` passed:

```bash
gh run list --repo jasync-sql/jasync-sql --branch master --workflow ci.yml --limit 3
```

### 2. Verify `version` in `build.gradle.kts`

Inspect `version = "..."` in [`build.gradle.kts`](build.gradle.kts):

- If `version` is already `"X.Y.Z"`, proceed to Step 3.
- If `version` does not match `"X.Y.Z"`, update `build.gradle.kts` via a PR to `master` (`chore: bump version to X.Y.Z`) **before** rebasing `github-release` so the release commit itself carries `version = "X.Y.Z"`.

### 3. Rebase `github-release` onto `master`

Check out `github-release` tracking `origin/github-release` and rebase onto `master`:

```bash
git checkout -B github-release --track origin/github-release
git rebase master
```

*(In normal mainline releases `origin/github-release` is an ancestor of `master`, so this is a clean fast-forward.)*

### 4. Push `github-release` to Remote (Triggers Maven Central CD)

> **Approval / Irreversible Action**: Pushing `github-release` immediately triggers [`.github/workflows/cd.yml`](.github/workflows/cd.yml) (`./gradlew clean build publishToSonatype closeAndReleaseSonatypeStagingRepository --no-daemon --no-parallel -x test`), publishing all 6 artifacts (`jasync-common`, `jasync-pool`, `jasync-mysql`, `jasync-postgresql`, `jasync-postgis-jts`, `jasync-r2dbc-mysql`) to Sonatype Maven Central.

```bash
git push origin github-release
```

Monitor the `CD` workflow run until completion:

```bash
gh run list --repo jasync-sql/jasync-sql --branch github-release --workflow cd.yml --limit 1
```

### 5. Generate Changelog & Publish GitHub Release

1. Preview GitHub's auto-generated release notes from `PREV_TAG` to `github-release`:

```bash
gh api --method POST repos/jasync-sql/jasync-sql/releases/generate-notes \
-f tag_name="X.Y.Z" \
-f target_commitish="github-release" \
-f previous_tag_name="PREV_TAG"
```

2. Review and curate the notes (preserve feature/fix/doc PRs and `New Contributors`, condensing routine build/test bumps if needed).
3. Publish the release as `Latest` **targeting `github-release`** (always target `github-release` rather than `master` so tag `X.Y.Z` points to the exact release commit where `version = "X.Y.Z"`, not the post-release `NEXT_VERSION` bump commit):

```bash
gh release create "X.Y.Z" \
--repo jasync-sql/jasync-sql \
--target github-release \
--title "X.Y.Z" \
--latest \
--notes-file <notes_file>
```

Verify it appears at `https://github.com/jasync-sql/jasync-sql/releases`.

### 6. Post-Release Preparation on `master`

Switch back to `master`, update documentation snippets to the newly released `X.Y.Z`, and bump [`build.gradle.kts`](build.gradle.kts) to `NEXT_VERSION` (`X.Y.(Z+1)`):

1. Switch to `master`:

```bash
git checkout master
```

2. Update [`README.md`](README.md) Maven (`<version>X.Y.Z</version>`) and Gradle (`com.github.jasync-sql:jasync-mysql:X.Y.Z`, `com.github.jasync-sql:jasync-postgresql:X.Y.Z`) examples to `X.Y.Z`.
3. Update [`build.gradle.kts`](build.gradle.kts) `version = "NEXT_VERSION"`.
4. Commit and merge to `origin/master` (via PR or direct push as preferred):

```bash
git checkout -b chore/bump-version-NEXT_VERSION
git add build.gradle.kts README.md
git commit -m "chore: bump version to NEXT_VERSION and update README to X.Y.Z"
git push -u origin chore/bump-version-NEXT_VERSION
```
23 changes: 20 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

import org.gradle.api.publish.maven.tasks.AbstractPublishToMaven
import org.gradle.plugins.signing.Sign

plugins {
kotlin("jvm")
Expand All @@ -18,6 +19,12 @@ nexusPublishing {
sonatype {
nexusUrl.set(uri("https://ossrh-staging-api.central.sonatype.com/service/local/"))
snapshotRepositoryUrl.set(uri("https://central.sonatype.com/repository/maven-snapshots/"))
val sonatypeUser = System.getenv("SONATYPE_USERNAME_2")?.takeIf { it.isNotBlank() }
?: project.findProperty("sonatypeUsername")?.toString()?.takeIf { it.isNotBlank() }
val sonatypePass = System.getenv("SONATYPE_PASSWORD_2")?.takeIf { it.isNotEmpty() }
?: project.findProperty("sonatypePassword")?.toString()?.takeIf { it.isNotEmpty() }
sonatypeUser?.let { username.set(it) }
sonatypePass?.let { password.set(it) }
}
}
}
Expand Down Expand Up @@ -149,8 +156,18 @@ subprojects {
}

signing {
// use the properties passed as command line args
// -Psigning.keyId=${{secrets.SIGNING_KEY_ID}} -Psigning.password=${{secrets.SIGNING_PASSWORD}} -Psigning.secretKeyRingFile=$(echo ~/.gradle/secring.gpg)
val gpgPrivateKey = System.getProperty("GPG_PRIVATE_KEY")?.takeIf { it.isNotBlank() }
?: System.getenv("GPG_PRIVATE_KEY")?.takeIf { it.isNotBlank() }
val gpgPrivatePassword = System.getProperty("GPG_PRIVATE_PASSWORD")?.takeIf { it.isNotEmpty() }
?: System.getenv("GPG_PRIVATE_PASSWORD")?.takeIf { it.isNotEmpty() }
?: ""
if (gpgPrivateKey != null) {
useInMemoryPgpKeys(gpgPrivateKey, gpgPrivatePassword)
}
sign(publishing.publications["mavenJava"])
}

tasks.withType<AbstractPublishToMaven>().configureEach {
mustRunAfter(tasks.withType<Sign>())
}
}
Loading