53 lines
1.4 KiB
YAML
53 lines
1.4 KiB
YAML
name: Release
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
tags:
|
|
- '*'
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
publish:
|
|
name: Build and publish to Sonatype Central
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Ensure current ref is a tag
|
|
run: |
|
|
case "$GITHUB_REF" in
|
|
refs/tags/*) ;;
|
|
*) echo "This workflow only supports tag refs"; exit 1 ;;
|
|
esac
|
|
|
|
- name: Check out code
|
|
uses: actions/checkout@v4
|
|
with:
|
|
ref: ${{ github.ref }}
|
|
fetch-depth: 0
|
|
|
|
- name: Verify checked out ref matches the tag
|
|
run: |
|
|
git rev-parse --verify "$GITHUB_REF"
|
|
test "$(git rev-parse HEAD)" = "$(git rev-list -n 1 "$GITHUB_REF")"
|
|
|
|
- name: Set up Java and Maven Central credentials
|
|
uses: actions/setup-java@v4
|
|
with:
|
|
distribution: temurin
|
|
java-version: '8'
|
|
cache: maven
|
|
server-id: central
|
|
server-username: CENTRAL_USERNAME
|
|
server-password: CENTRAL_PASSWORD
|
|
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
|
|
gpg-passphrase: GPG_PASSPHRASE
|
|
|
|
- name: Build and publish release artifacts
|
|
run: mvn -B -Prelease clean deploy
|
|
env:
|
|
CENTRAL_USERNAME: ${{ secrets.CENTRAL_USERNAME }}
|
|
CENTRAL_PASSWORD: ${{ secrets.CENTRAL_PASSWORD }}
|
|
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
|