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
67 changes: 67 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Publish workflow for kotlin-sdk.
#
# Triggers on any semver tag (e.g. v1.1.0). The job:
# 1. Builds, signs, and stages artifacts to OSSRH.
# 2. Closes and releases the staging repository to Maven Central.
#
# Required repository secrets (Settings → Secrets → Actions):
# OSSRH_USERNAME — Sonatype account username (s01.oss.sonatype.org)
# OSSRH_PASSWORD — Sonatype account password / token
# SIGNING_KEY_ID — Last 8 hex digits of the GPG fingerprint
# SIGNING_KEY — ASCII-armored GPG private key (full block)
# SIGNING_PASSWORD — Passphrase for the GPG key
#
# Action pinning policy:
# - First-party actions (actions/*) are pinned to a major tag.
# - Third-party actions are pinned to a full commit SHA with a version
# comment alongside.
name: publish

on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'

concurrency:
group: publish-${{ github.ref }}
cancel-in-progress: false

permissions:
contents: read

jobs:
publish:
name: Publish to Maven Central
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '21'
cache: gradle

- name: Validate Gradle wrapper
# gradle/actions/wrapper-validation v4.4.4
uses: gradle/actions/wrapper-validation@ac638b010cf58a27ee6c972d7336334ccaf61c96

- name: Build and test
run: ./gradlew --no-daemon assemble test

- name: Publish to OSSRH and release to Central
env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
run: >
./gradlew --no-daemon
publishToSonatype
closeAndReleaseSonatypeStagingRepository
Loading
Loading