Skip to content
Draft
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
44 changes: 0 additions & 44 deletions .github/workflows/initiate_release.yml

This file was deleted.

80 changes: 80 additions & 0 deletions .github/workflows/manual-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Manual Release

on:
workflow_dispatch:
inputs:
version:
description: "Release version (example: 7.2.0)"
required: true
type: string

permissions:
contents: write

jobs:
manual-release:
name: 🚀 Manual Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: main

- name: Setup JDK 17
uses: actions/setup-java@v5.1.0
with:
distribution: "corretto"
java-version: "17"

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4

- name: Update version file
env:
VERSION: ${{ github.event.inputs.version }}
run: |
sed -i "s/^version=.*/version=${VERSION}/" gradle.properties

- name: Commit version update
env:
VERSION: ${{ github.event.inputs.version }}
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add gradle.properties
if git diff --cached --quiet; then
echo "No version changes to commit."
else
git commit -m "chore(release): v${VERSION} (manual)"
git push origin HEAD:main
fi

- name: Publish to MavenCentral
env:
STREAM_API_KEY: ${{ vars.STREAM_API_KEY }}
STREAM_API_SECRET: ${{ secrets.STREAM_API_SECRET }}
GPG_KEY_CONTENTS: ${{ secrets.GPG_KEY_CONTENTS }}
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
SIGNING_SECRET_KEY_RING_FILE: ${{ secrets.SIGNING_SECRET_KEY_RING_FILE }}
SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }}
run: |
./gradlew -Pversion=${{ github.event.inputs.version }} publishToSonatype --no-daemon --max-workers 1 closeAndReleaseSonatypeStagingRepository

- name: Create and push tag
env:
VERSION: ${{ github.event.inputs.version }}
run: |
git tag "v${VERSION}"
git push origin "v${VERSION}"

- name: Create release on GitHub
uses: ncipollo/release-action@v1
with:
tag: v${{ github.event.inputs.version }}
token: ${{ secrets.GITHUB_TOKEN }}
body: |
Manual release v${{ github.event.inputs.version }}.
52 changes: 0 additions & 52 deletions .github/workflows/prerelease.yml

This file was deleted.

86 changes: 74 additions & 12 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,36 +6,91 @@ on:
branches:
- main

concurrency:
group: release-${{ github.event.pull_request.base.ref }}
cancel-in-progress: true

permissions:
contents: write

jobs:
Release:
release:
name: 🚀 Release
if: github.event.pull_request.merged && startsWith(github.head_ref, 'release-')
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.base.ref }}

- uses: actions/github-script@v6
with:
script: |
// Getting the release version from the PR source branch
// Source branch looks like this: release-1.0.0
const version = context.payload.pull_request.head.ref.replace(/^release-/, '')
core.exportVariable('VERSION', version)
- name: Skip when PR is already released
id: already_released
run: |
if git log --oneline --grep="(pr #${{ github.event.pull_request.number }})" -n 1 | grep -q "chore(release):"; then
echo "value=true" >> "$GITHUB_OUTPUT"
else
echo "value=false" >> "$GITHUB_OUTPUT"
fi

- name: Determine and apply version bump
id: release_meta
if: steps.already_released.outputs.value != 'true'
env:
PR_TITLE: ${{ github.event.pull_request.title }}
PR_BODY: ${{ github.event.pull_request.body }}
run: |
PR_BODY_FILE=$(mktemp)
printf '%s' "$PR_BODY" > "$PR_BODY_FILE"
bash scripts/release/bump_version.sh \
--title "$PR_TITLE" \
--body-file "$PR_BODY_FILE" \
--output "$GITHUB_OUTPUT"

- name: Stop when PR does not require release
if: steps.already_released.outputs.value == 'true' || steps.release_meta.outputs.should_release != 'true'
run: |
if [ "${{ steps.already_released.outputs.value }}" = "true" ]; then
echo "PR #${{ github.event.pull_request.number }} is already released; skipping."
exit 0
fi
echo "No release type found in PR title; skipping."
exit 0

- name: Setup JDK 17
if: steps.already_released.outputs.value != 'true' && steps.release_meta.outputs.should_release == 'true'
uses: actions/setup-java@v5.1.0
with:
distribution: 'corretto'
java-version: '17'

- name: Setup Gradle
if: steps.already_released.outputs.value != 'true' && steps.release_meta.outputs.should_release == 'true'
uses: gradle/actions/setup-gradle@v4

- name: Commit version files
if: steps.already_released.outputs.value != 'true' && steps.release_meta.outputs.should_release == 'true'
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add gradle.properties
if git diff --cached --quiet; then
echo "No version changes to commit."
exit 0
fi
git commit -m "chore(release): v${{ steps.release_meta.outputs.version }} (pr #${{ github.event.pull_request.number }})"
git push origin "HEAD:${{ github.event.pull_request.base.ref }}"

- name: Create release tag
if: steps.already_released.outputs.value != 'true' && steps.release_meta.outputs.should_release == 'true'
run: |
git tag "${{ steps.release_meta.outputs.tag }}"
git push origin "${{ steps.release_meta.outputs.tag }}"

- name: Publish to MavenCentral
if: steps.already_released.outputs.value != 'true' && steps.release_meta.outputs.should_release == 'true'
run: |
./gradlew publishToSonatype --no-daemon --max-workers 1 closeAndReleaseSonatypeStagingRepository
./gradlew -Pversion=${{ steps.release_meta.outputs.version }} publishToSonatype --no-daemon --max-workers 1 closeAndReleaseSonatypeStagingRepository
env:
STREAM_API_KEY: ${{ vars.STREAM_API_KEY }}
STREAM_API_SECRET: ${{ secrets.STREAM_API_SECRET }}
Expand All @@ -48,7 +103,14 @@ jobs:
SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }}

- name: Create release on GitHub
if: steps.already_released.outputs.value != 'true' && steps.release_meta.outputs.should_release == 'true'
uses: ncipollo/release-action@v1
with:
tag: ${{ env.VERSION }}
tag: ${{ steps.release_meta.outputs.tag }}
token: ${{ secrets.GITHUB_TOKEN }}
body: |
Release v${{ steps.release_meta.outputs.version }}

- Bump type: `${{ steps.release_meta.outputs.bump }}`
- Previous: `${{ steps.release_meta.outputs.previous_version }}`
- Next: `${{ steps.release_meta.outputs.version }}`
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,18 @@ To regenerate the Java source from OpenAPI, just run the `./generate.sh` script
## Contributing

Contributions are welcome! Please read the [contributing guidelines](CONTRIBUTING.md) to get started.

## Release Process

Releases use two paths:

- Default: automatic release when a PR is merged to `main`.
- Fallback: manual release using `.github/workflows/manual-release.yml` (admin use only).

Automatic semver bump rules are based on merged PR title/body:

- `feat:` -> minor
- `fix:` (or `bug:`) -> patch
- `feat!:` or `BREAKING CHANGE` in PR body -> major

PRs with other prefixes do not trigger a release.
Loading
Loading