From 70d9914c60d3b6633e5a9676d3b3d8f26107d739 Mon Sep 17 00:00:00 2001 From: Gaurav Ahuja Date: Tue, 3 Jun 2025 04:48:29 -0400 Subject: [PATCH] Workflow to publish all jvm-libs with default version 0.0. (#1063) * Workflow to publish all jvm-libs with default version 0.0. * Review comments --- .github/workflows/maven-release-all.yml | 80 +++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 .github/workflows/maven-release-all.yml diff --git a/.github/workflows/maven-release-all.yml b/.github/workflows/maven-release-all.yml new file mode 100644 index 00000000..e1b90a11 --- /dev/null +++ b/.github/workflows/maven-release-all.yml @@ -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. 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