Release SDK to Maven Central #77
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release SDK | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: | | |
The version to release. | |
Add -SNAPSHOT to release a snapshot version. | |
required: true | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the code | |
uses: actions/checkout@v3 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: '11' | |
- name: Grant execute permission for gradlew | |
run: chmod +x gradlew | |
- name: Set release version if provided | |
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.version }} | |
run: echo "releaseVersion=${{ github.event.inputs.version }}" >> $GITHUB_ENV | |
- name: Build and Publish Artifacts | |
env: | |
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} | |
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} | |
OSSRH_USERNAME: ${{ secrets.SONATYPE_USERNAME }} | |
OSSRH_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} | |
run: | | |
if [ -n "${{ github.event.inputs.version }}" ]; then | |
./gradlew clean build publishToSonatype closeAndReleaseSonatypeStagingRepository | |
else | |
./gradlew clean build publish | |
fi |