Skip to content
This repository has been archived by the owner on Jul 4, 2024. It is now read-only.

v1.0.4

v1.0.4 #174

Workflow file for this run

name: Publish
on:
release:
types: [created]
push:
branches:
- main
jobs:
java_build:
name: Build and Publish Jar
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- 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" >> $GITHUB_ENV
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'zulu'
server-id: github
- 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
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) \
-PlibraryVersion=$VERSION \
-Psigning.keyId="${{ secrets.OSSRH_GPG_SECRET_KEY_ID }}" -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'
- name: Generate Coverage Report
run: ./gradlew jacocoAggregateReport
- name: Upload coverage to Codecov
uses: codecov/[email protected]
with:
file: ./build/reports/jacoco/jacocoAggregateReport/jacocoAggregateReport.xml