From becb5f06be809baaf984ea08adcafcec007ce763 Mon Sep 17 00:00:00 2001 From: Andres Almiray Date: Fri, 31 May 2024 09:47:23 +0200 Subject: [PATCH] build: Update GH workflows --- .github/workflows/build.yml | 21 +++---------- .github/workflows/early-access.yml | 28 +++++------------ .github/workflows/release.yml | 48 ++++++++++-------------------- jreleaser.yml | 2 +- 4 files changed, 28 insertions(+), 71 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9387f3e..2803e50 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,7 +1,7 @@ # # SPDX-License-Identifier: Apache-2.0 # -# Copyright 2006-2022 the original author or authors. +# Copyright 2006-2024 the original author or authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -32,27 +32,14 @@ jobs: if: startsWith(github.event.head_commit.message, 'Releasing version') != true steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Setup Java - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: java-version: ${{ env.JAVA_VERSION }} distribution: ${{ env.JAVA_DISTRO }} - - - uses: actions/cache@v3 - with: - path: ~/.gradle/caches - key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}-${{ hashFiles('**/gradle.properties') }} - restore-keys: | - ${{ runner.os }}-gradle- - - - uses: actions/cache@v3 - with: - path: ~/.gradle/wrapper - key: ${{ runner.os }}-gradlew-${{ hashFiles('**/gradlew') }} - restore-keys: | - ${{ runner.os }}-gradlew- + cache: gradle - name: Build run: ./gradlew build -S diff --git a/.github/workflows/early-access.yml b/.github/workflows/early-access.yml index 25b88d5..3c39966 100644 --- a/.github/workflows/early-access.yml +++ b/.github/workflows/early-access.yml @@ -1,7 +1,7 @@ # # SPDX-License-Identifier: Apache-2.0 # -# Copyright 2006-2022 the original author or authors. +# Copyright 2006-2024 the original author or authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -33,33 +33,21 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 - - uses: n1hility/cancel-previous-runs@v2 + - name: Cancel previous run + uses: styfle/cancel-workflow-action@0.12.1 with: - token: ${{ secrets.GITHUB_TOKEN }} + access_token: ${{ secrets.GITHUB_TOKEN }} - name: Setup Java - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: java-version: ${{ env.JAVA_VERSION }} distribution: ${{ env.JAVA_DISTRO }} - - - uses: actions/cache@v3 - with: - path: ~/.gradle/caches - key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}-${{ hashFiles('**/gradle.properties') }} - restore-keys: | - ${{ runner.os }}-gradle- - - - uses: actions/cache@v3 - with: - path: ~/.gradle/wrapper - key: ${{ runner.os }}-gradlew-${{ hashFiles('**/gradlew') }} - restore-keys: | - ${{ runner.os }}-gradlew- + cache: gradle - name: Build run: ./gradlew -Prelease=true build -S @@ -78,7 +66,7 @@ jobs: - name: JReleaser output if: always() - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: artifact path: | diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c28f85d..92855b1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,7 +1,7 @@ # # SPDX-License-Identifier: Apache-2.0 # -# Copyright 2006-2022 the original author or authors. +# Copyright 2006-2024 the original author or authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -37,11 +37,12 @@ jobs: VERSION: ${{ steps.vars.outputs.VERSION }} steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - - uses: n1hility/cancel-previous-runs@v2 + - name: Cancel previous run + uses: styfle/cancel-workflow-action@0.12.1 with: - token: ${{ secrets.GITHUB_TOKEN }} + access_token: ${{ secrets.GITHUB_TOKEN }} - name: Version id: vars @@ -54,29 +55,16 @@ jobs: needs: [precheck] runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Set up Java - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: java-version: ${{ env.JAVA_VERSION }} distribution: ${{ env.JAVA_DISTRO }} - - - uses: actions/cache@v3 - with: - path: ~/.gradle/caches - key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}-${{ hashFiles('**/gradle.properties') }} - restore-keys: | - ${{ runner.os }}-gradle- - - - uses: actions/cache@v3 - with: - path: ~/.gradle/wrapper - key: ${{ runner.os }}-gradlew-${{ hashFiles('**/gradlew') }} - restore-keys: | - ${{ runner.os }}-gradlew- + cache: gradle - name: Set release version run: | @@ -89,20 +77,9 @@ jobs: git commit -a -m "Releasing version $VERSION" git push origin master - - name: Build - run: | - ./gradlew -Prelease=true build -S - - name: Deploy - env: - GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }} - GPG_SECRET_KEY: ${{ secrets.GPG_SECRET_KEY }} - GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} run: | - ./gradlew -Prelease=true -Pfull-release=true \ - -PsonatypeUsername=${{ secrets.SONATYPE_USERNAME }} \ - -PsonatypePassword=${{ secrets.SONATYPE_PASSWORD }} \ - build publishToSonatype closeAndReleaseSonatypeStagingRepository -S + ./gradlew -Pprofile=sbom -PreproducibleBuild=true publish -S - name: Release uses: jreleaser/release-action@v2 @@ -111,6 +88,11 @@ jobs: env: JRELEASER_PROJECT_VERSION: ${{ github.event.inputs.version }} JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + JRELEASER_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} + JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.GPG_PUBLIC_KEY }} + JRELEASER_GPG_SECRET_KEY: ${{ secrets.GPG_SECRET_KEY }} + JRELEASER_NEXUS2_MAVEN_CENTRAL_USERNAME: ${{ secrets.SONATYPE_USERNAME }} + JRELEASER_NEXUS2_MAVEN_CENTRAL_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} JRELEASER_TWITTER_CONSUMER_KEY: ${{ secrets.TWITTER_CONSUMER_KEY }} JRELEASER_TWITTER_CONSUMER_SECRET: ${{ secrets.TWITTER_CONSUMER_SECRET }} JRELEASER_TWITTER_ACCESS_TOKEN: ${{ secrets.TWITTER_ACCESS_TOKEN }} @@ -118,7 +100,7 @@ jobs: - name: JReleaser output if: always() - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: artifact path: | diff --git a/jreleaser.yml b/jreleaser.yml index 3ce7a0f..97b08b1 100644 --- a/jreleaser.yml +++ b/jreleaser.yml @@ -76,4 +76,4 @@ deploy: announce: twitter: - active: release + active: RELEASE