Skip to content

Release to Maven Central #32

Release to Maven Central

Release to Maven Central #32

Workflow file for this run

# ********************************************************************************
# Copyright (c) 2024 Contributors to the Eclipse Foundation
#
# See the NOTICE file(s) distributed with this work for additional
# information regarding copyright ownership.
#
# This program and the accompanying materials are made available under the
# terms of the Apache License Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0
#
# SPDX-License-Identifier: Apache-2.0
# *******************************************************************************/
name: Release to Maven Central
on:
workflow_dispatch:
jobs:
release:
if: github.event.ref == 'refs/heads/main'
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- run: |
git config --global user.name 'eclipse-uprotocol-bot'
git config --global user.email '[email protected]'
- uses: actions/checkout@v4
with:
submodules: 'recursive'
token: ${{ secrets.BOT_GITHUB_TOKEN }}
- name: Set up Apache Maven Central
uses: actions/setup-java@v4
with: # configure settings.xml
distribution: 'temurin'
java-version: '17'
server-id: central
server-username: MAVEN_CENTRAL_USER
server-password: MAVEN_CENTRAL_PASSWORD
gpg-private-key: ${{ secrets.ORG_GPG_PRIVATE_KEY }}
gpg-passphrase: GPG_PASSPHRASE
- name: Stage to Nexus and Release to Maven central
run: |
mvn -B release:clean release:prepare release:perform
env:
MAVEN_CENTRAL_USER: ${{ secrets.CENTRAL_SONATYPE_TOKEN_USERNAME }}
MAVEN_CENTRAL_PASSWORD: ${{ secrets.CENTRAL_SONATYPE_TOKEN_PASSWORD }}
GPG_PASSPHRASE: ${{ secrets.ORG_GPG_PASSPHRASE }}
GH_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }}
- if: cancelled() || failure()
run: |
mvn -B release:rollback
env:
GH_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }}