Release and Publish to Maven Central #8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release and Publish to Maven Central | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'Release version' | |
required: true | |
type: string | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
cache: 'maven' | |
server-id: central | |
server-username: CENTRAL_TOKEN_USERNAME | |
server-password: CENTRAL_TOKEN_PASSWORD | |
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} | |
gpg-passphrase: GPG_PASSPHRASE | |
- name: Import GPG key | |
run: | | |
echo "${{ secrets.GPG_PRIVATE_KEY }}" | gpg --dearmor > ~/.gnupg/secring.gpg | |
gpg --import ~/.gnupg/secring.gpg | |
- name: Set release version in all POMs | |
run: | | |
# Update version in all POMs | |
cd accessors-smart && ./mvnw versions:set -q -DnewVersion=${{ github.event.inputs.version }} -DgenerateBackupPoms=false | |
cd ../json-smart && ./mvnw versions:set -q -DnewVersion=${{ github.event.inputs.version }} -DgenerateBackupPoms=false | |
cd ../json-smart-action && ./mvnw versions:set -q -DnewVersion=${{ github.event.inputs.version }} -DgenerateBackupPoms=false | |
#- name: Release accessors-smart | |
# run: | | |
# cd accessors-smart | |
# ./mvnw -q clean install | |
# ./mvnw deploy -P release-sign-artifacts | |
# env: | |
# CENTRAL_TOKEN_USERNAME: ${{ secrets.CENTRAL_TOKEN_USERNAME }} | |
# CENTRAL_TOKEN_PASSWORD: ${{ secrets.CENTRAL_TOKEN_PASSWORD }} | |
# MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | |
- name: Release json-smart | |
run: | | |
cd json-smart | |
./mvnw -q clean install | |
./mvnw deploy -P release-sign-artifacts | |
env: | |
CENTRAL_TOKEN_USERNAME: ${{ secrets.CENTRAL_TOKEN_USERNAME }} | |
CENTRAL_TOKEN_PASSWORD: ${{ secrets.CENTRAL_TOKEN_PASSWORD }} | |
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | |
- name: Release json-smart-action | |
run: | | |
cd json-smart-action | |
./mvnw -q clean install | |
./mvnw deploy -P release-sign-artifacts | |
env: | |
CENTRAL_TOKEN_USERNAME: ${{ secrets.CENTRAL_TOKEN_USERNAME }} | |
CENTRAL_TOKEN_PASSWORD: ${{ secrets.CENTRAL_TOKEN_PASSWORD }} | |
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | |
- name: Create git tag | |
run: | | |
git config user.name "github-actions[bot]" | |
git config user.email "github-actions[bot]@users.noreply.github.com" | |
git tag -a "v${{ github.event.inputs.version }}" -m "Release version ${{ github.event.inputs.version }}" | |
git push origin "v${{ github.event.inputs.version }}" |