Skip to content

v1.1.0

v1.1.0 #5

Workflow file for this run

name: Build and Publish
on:
release:
types: [published]
workflow_dispatch:
inputs:
versionTag:
type: string
description: Version tag to use, e.g. "v1.0.12", "1.1.0-rc.1" (no quotes)
required: true
jobs:
publish:
name: Build & Publish Jar
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Get version
run: |
# Default to using the tag from the release event for the version string, stripping the prefix
VERSION=$( echo ${{ github.event.release.tag_name }} | sed -e 's/^v//' )
# If there is no associated release event, use the input version string, still stripping the prefix
if [[ "$VERSION" == "" ]] ; then
VERSION=$( echo ${{ github.event.inputs.versionTag }} | sed -e 's/^v//' )
fi
# Store version for later use
echo "VERSION=$VERSION" | tee $GITHUB_ENV
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: 17
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
distribution: zulu
- name: Set up Gradle cache
uses: gradle/actions/setup-gradle@v4
with:
cache-read-only: ${{ github.ref_name != github.event.repository.default_branch }}
cache-cleanup: on-success
gradle-home-cache-includes: |
caches
notifications
jdks
wrapper
- name: Build with Gradle
run: ./gradlew clean build --refresh-dependencies -Pversion=$VERSION
- name: Install gpg secret key
run: |
export GPG_TTY=$(tty)
echo -n "${{ secrets.OSSRH_GPG_SECRET_KEY }}" | base64 --decode | gpg --batch --import
gpg --list-secret-keys --keyid-format LONG
echo -n "${{ secrets.OSSRH_GPG_SECRET_KEY }}" | base64 --decode > $GITHUB_WORKSPACE/release.gpg
- name: Publish to Gradle Plugin Repository
run: >-
./gradlew publishPlugins
-Pversion="$VERSION"
-Pgradle.publish.key="${{ secrets.OSS_GRADLE_PUBLISH_KEY }}"
-Pgradle.publish.secret="${{ secrets.OSS_GRADLE_PUBLISH_SECRET }}"
-Psigning.keyId="${{ secrets.OSSRH_GPG_SECRET_KEY_ID }}"
-Psigning.password="${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }}"
-Psigning.secretKeyRingFile="$GITHUB_WORKSPACE/release.gpg"