Skip to content

Manual Release

Manual Release #11

Workflow file for this run

name: Manual Release
on:
workflow_dispatch:
inputs:
new_version:
description: 'New version (e.g., 1.2.0)'
required: true
release_name:
description: 'Release name'
required: true
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0
- name: Check if tag already exists
run: |
if git rev-parse "v${{ github.event.inputs.new_version }}" >/dev/null 2>&1; then
echo "Error: Tag v${{ github.event.inputs.new_version }} already exists. Releases are immutable."
exit 1
fi
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
server-id: central
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- name: Configure Git
run: |
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor }}@users.noreply.github.com"
- name: Update Version Files
run: |
./mvnw versions:set -DnewVersion=${{ github.event.inputs.new_version }} -DgenerateBackupPoms=false --batch-mode
./mvnw versions:commit --batch-mode
sed -i '/fluent-builder-annotations<\/artifactId>/,/<version>/ s/<version>[^<]*<\/version>/<version>${{ github.event.inputs.new_version }}<\/version>/' README.md
sed -i '/fluent-builder-processor<\/artifactId>/,/<version>/ s/<version>[^<]*<\/version>/<version>${{ github.event.inputs.new_version }}<\/version>/' README.md
git add pom.xml */pom.xml README.md
git diff --staged --quiet || git commit -m "Bump version to ${{ github.event.inputs.new_version }}"
git push origin main
- name: Build and Deploy to Maven Central
run: ./mvnw clean deploy -Prelease --batch-mode
env:
MAVEN_USERNAME: ${{ secrets.CENTRAL_TOKEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.CENTRAL_TOKEN_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ github.event.inputs.new_version }}
name: ${{ github.event.inputs.release_name }}
files: |
fluent-builder-annotations/target/*.jar
fluent-builder-processor/target/*.jar
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}