Skip to content

v2.4.0-rc1

v2.4.0-rc1 #51

Workflow file for this run

name: Publish
on:
release:
types: [created]
jobs:
java_build:
name: Build and Publish Jar
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Get Version
run: |
# Strip git prefix from version.
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# Strip "v" prefix from tag name.
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
# Store version for later use.
echo "VERSION=$VERSION"
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 17
server-id: github
- name: Build with Gradle
run: ./gradlew clean build -x test -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
if: github.event_name == 'release'
- name: Publish to Maven Central
run: |
./gradlew publishToSonatype $(if [ "${{github.event.release.prerelease}}" = "true" ]; then echo 'closeSonatypeStagingRepository'; else echo 'closeAndReleaseSonatypeStagingRepository'; fi) \
-Pversion=$VERSION \
-Psigning.keyId=B7D30ABE -Psigning.password="${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }}" -Psigning.secretKeyRingFile=$GITHUB_WORKSPACE/release.gpg \
--info
env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
if: github.event_name == 'release'