diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index afd93dd..ddc06dd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -61,10 +61,20 @@ jobs: build-scan-terms-of-service-agree: yes cache-read-only: ${{ github.event_name != 'push' }} + # ================================ + # EXPORT GRADLE PROPERTIES + # ================================ + - name: Export Gradle properties + id: properties + uses: guillermocalvo/gradle-properties@v3 + with: + output_file: ${{ github.output }} + export: version,previousVersion + # ================================ # BUILD # ================================ - - name: Build + - name: Build version ${{ steps.properties.outputs.version }} uses: gradle/actions/setup-gradle@v3 with: arguments: build -x check --info @@ -80,7 +90,7 @@ jobs: # ================================ # COMPATIBILITY REPORT # ================================ - - name: Compatibility report + - name: Compatibility with version ${{ steps.properties.outputs.previousVersion }} if: ${{ matrix.jdk == 21 }} run: cat ./api-compatibility/build/report.txt >> $GITHUB_STEP_SUMMARY @@ -109,3 +119,17 @@ jobs: uses: gradle/actions/setup-gradle@v3 with: arguments: sonarqube --info + + # ================================ + # PUBLISH SNAPSHOT + # ================================ + - name: Publish snapshot version ${{ steps.properties.outputs.version }} + if: ${{ matrix.jdk == 21 && github.event_name == 'push' && github.ref_name == github.event.repository.default_branch && endsWith(steps.properties.outputs.version, '-SNAPSHOT') }} + env: + ORG_GRADLE_PROJECT_githubUsername: ${{ secrets.PUBLISH_USERNAME }} + ORG_GRADLE_PROJECT_githubPassword: ${{ secrets.PUBLISH_PASSWORD }} + ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }} + ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }} + uses: gradle/actions/setup-gradle@v3 + with: + arguments: publish -Psnapshot --info diff --git a/.github/workflows/snapshot.yml b/.github/workflows/snapshot.yml deleted file mode 100644 index a3fd363..0000000 --- a/.github/workflows/snapshot.yml +++ /dev/null @@ -1,53 +0,0 @@ - -# Publish a Snapshot Release -name: Snapshot - -on: - push: - branches: - - 'main' - -jobs: - build: - - name: Publish snapshot - runs-on: ubuntu-latest - - steps: - - # ================================ - # SHALLOW CLONE - # ================================ - - name: Shallow clone - uses: actions/checkout@v4 - - # ================================ - # SET UP JDK - # ================================ - - name: Set up JDK - uses: actions/setup-java@v4 - with: - distribution: 'zulu' - java-package: jdk - java-version: 21 - - # ================================ - # GET CURRENT VERSION - # ================================ - - name: Get current version - id: properties - run: echo "version=`./gradlew -q printProperty -Pkey=version`" >> $GITHUB_OUTPUT - - # ================================ - # PUBLISH - # ================================ - - name: Publish snapshot - if: endsWith(steps.properties.outputs.version, '-SNAPSHOT') - env: - ORG_GRADLE_PROJECT_githubUsername: ${{ secrets.PUBLISH_USERNAME }} - ORG_GRADLE_PROJECT_githubPassword: ${{ secrets.PUBLISH_PASSWORD }} - ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }} - ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }} - uses: gradle/actions/setup-gradle@v3 - with: - arguments: publish -Psnapshot --info --scan diff --git a/build.gradle b/build.gradle index e0654f9..030dd85 100644 --- a/build.gradle +++ b/build.gradle @@ -19,13 +19,3 @@ if (project.hasProperty('sonatypeUsername') && project.hasProperty('sonatypePass } } } - -/** - * Print project property by key - * - Usage: `./gradlew -q printProperty -Pkey=description` - */ -task printProperty { - doLast { - printf project[project.key] - } -}