Manual Release Java library #21
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: Manual Release Java library | |
on: | |
workflow_dispatch: | |
inputs: | |
release-tag: | |
description: 'Tag for the release' | |
required: true | |
jobs: | |
build_and_publish: | |
name: Build jar library | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout ref from inputs | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.inputs.release-tag }} | |
- name: Check if specified ref is a tag | |
run: | | |
REF=${{ github.event.inputs.release-tag }} | |
if git show-ref --verify --quiet "refs/tags/$REF"; then | |
echo "Ref $REF is a tag." | |
else | |
echo "Ref $REF is not a tag." | |
exit 1 | |
fi | |
VERSION=${REF:1} | |
echo "VERSION=$VERSION" >> $GITHUB_ENV | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 11 | |
distribution: temurin | |
- name: Build with Gradle | |
run: gradle build -x test | |
env: | |
VERSION: ${{ env.VERSION }} | |
- name: Publish package | |
run: gradle -x test clean build sign publish publishToSonatype closeAndReleaseSonatypeStagingRepository | |
env: | |
VERSION: ${{ env.VERSION }} | |
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.GPG_PRIVATE_KEY }} | |
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.PASSPHRASE }} | |
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.OSSRH_USERNAME }} | |
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.OSSRH_TOKEN }} |