Workflow to publish all jvm-libs with default version 0.0.<timestamp> (#1063)

* Workflow to publish all jvm-libs with default version 0.0.<timestamp>

* Review comments
This commit is contained in:
Gaurav Ahuja
2025-06-03 04:48:29 -04:00
committed by GitHub
parent 56c48093a3
commit 70d9914c60

80
.github/workflows/maven-release-all.yml vendored Normal file
View File

@@ -0,0 +1,80 @@
name: Maven Release all JVM-Libs
on:
workflow_dispatch:
inputs:
version:
required: false
type: string
description: 'Release version: e.g "1.0.0". Defaults to 0.0.<YYYYmmDDHHMMSS> if not provided'
jobs:
release:
runs-on: gha-runner-scale-set-ubuntu-22.04-amd64-med
steps:
- name: Set version
id: name
run: |
TIMESTAMP=`date -u +'%Y%m%d%H%M%S'`
INPUT_VERSION=${{ github.event.inputs.version }}
if [ -z "$INPUT_VERSION" ]; then
VERSION="0.0.$TIMESTAMP"
else
VERSION=$INPUT_VERSION
fi
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Print version
run: |
echo "VERSION: $VERSION"
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@8379f6a1328ee0e06e2bb424dadb7b159856a326 # 4.4.0
- name: Clean
# ./gradlew clean is necessary because the build is cached
# and cause issues with JReleaser
run: ./gradlew clean
- name: Build
run: ./gradlew -p jvm-libs build
env:
GITHUB_TOKEN: ${{ secrets._GITHUB_TOKEN_RELEASE_ACCESS }}
- name: Deploy to Local File System
run: ./gradlew -p jvm-libs publish -Pversion=$VERSION
env:
GITHUB_TOKEN: ${{ secrets._GITHUB_TOKEN_RELEASE_ACCESS }}
- name: Build and Release to Maven Central
run: ./gradlew --stacktrace -p jvm-libs jreleaserRelease -Pversion=$VERSION
env:
GITHUB_TOKEN: ${{ secrets._GITHUB_TOKEN_RELEASE_ACCESS }}
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
JRELEASER_GITHUB_USERNAME: ${{ github.actor }}
JRELEASER_GITHUB_EMAIL: ${{ github.actor }}@users.noreply.github.com
JRELEASER_GPG_PASSPHRASE: ${{ secrets.JRELEASER_GPG_PASSPHRASE }}
JRELEASER_GPG_SECRET_KEY: ${{ secrets.JRELEASER_GPG_SECRET_KEY }}
JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.JRELEASER_GPG_PUBLIC_KEY }}
JRELEASER_MAVENCENTRAL_USERNAME: ${{ secrets.JRELEASER_MAVENCENTRAL_USERNAME }}
JRELEASER_MAVENCENTRAL_PASSWORD: ${{ secrets.JRELEASER_MAVENCENTRAL_PASSWORD }}
# Persist logs
- name: JReleaser release output
if: always()
uses: actions/upload-artifact@v4
with:
name: jreleaser-release
path: |
build/jreleaser/trace.log
build/jreleaser/output.properties