Skip to content

Release automation

Release automation #5

Workflow file for this run

name: Deploy to Maven Central
#on:
# push:
# tags:
# - v*
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
deploy:
if: ${{ github.repository == 'prometheus/client_java' }}
runs-on: ubuntu-latest
steps:
- name: Debug gpg key - remove after debugging
run: |
echo "$GPG_SIGNING_KEY" | gpg --batch --import-options import-show --import
- name: Checkout Plugin Repository
uses: actions/checkout@v4
- name: Set Up JDK
uses: actions/setup-java@v4
with:
java-version: 17
distribution: temurin
cache: 'maven'
- name: Build with Maven
run: mvn -B package -P release -Dmaven.test.skip=true
- name: Set up Apache Maven Central
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_CENTRAL_TOKEN
gpg-private-key: ${{ secrets.GPG_SIGNING_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- name: Publish to Apache Maven Central
run: mvn deploy -P release
env:
MAVEN_USERNAME: ${{ secrets.SONATYPE_MAVEN_REPOSITORY_USERNAME }}
MAVEN_CENTRAL_TOKEN: ${{ secrets.SONATYPE_MAVEN_REPOSITORY_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_SIGNING_PASSPHRASE }}