diff --git a/.github/workflows/graalvm.yml b/.github/workflows/graalvm.yml index b7278470f..23d722775 100644 --- a/.github/workflows/graalvm.yml +++ b/.github/workflows/graalvm.yml @@ -58,7 +58,7 @@ jobs: PREDICTIVE_TEST_SELECTION: "${{ github.event_name == 'pull_request' && 'true' || 'false' }}" - name: Publish Test Report if: always() - uses: mikepenz/action-junit-report@v3.2.0 + uses: mikepenz/action-junit-report@v3.5.2 with: check_name: GraalVM CE CI / Test Report (Java ${{ matrix.java }}) report_paths: '**/build/test-results/test/TEST-*.xml' diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 1e37c151e..be9c116a1 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -38,7 +38,7 @@ jobs: - name: Set up JDK uses: actions/setup-java@v3 with: - distribution: 'adopt' + distribution: 'temurin' java-version: ${{ matrix.java }} - name: Optional setup step env: @@ -60,14 +60,14 @@ jobs: PREDICTIVE_TEST_SELECTION: "${{ github.event_name == 'pull_request' && 'true' || 'false' }}" - name: Publish Test Report if: always() - uses: mikepenz/action-junit-report@v3.2.0 + uses: mikepenz/action-junit-report@v3.5.2 with: check_name: Java CI / Test Report (${{ matrix.java }}) report_paths: '**/build/test-results/test/TEST-*.xml' check_retries: 'true' - name: "📜 Upload binary compatibility check results" if: always() - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: binary-compatibility-reports path: "**/build/reports/binary-compatibility-*.html" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8d9336034..7e0f04974 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,6 +9,8 @@ on: types: [published] jobs: release: + outputs: + artifacts-sha256: ${{ steps.hash.outputs.artifacts-sha256 }} # Computed hashes for build artifacts. runs-on: ubuntu-latest steps: - name: Checkout repository @@ -31,6 +33,7 @@ jobs: with: token: ${{ secrets.GITHUB_TOKEN }} - name: Publish to Sonatype OSSRH + id: publish env: SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} @@ -42,7 +45,38 @@ jobs: GRADLE_ENTERPRISE_CACHE_PASSWORD: ${{ secrets.GRADLE_ENTERPRISE_CACHE_PASSWORD }} run: | echo $GPG_FILE | base64 -d > secring.gpg - ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository + # Publish both locally and to Sonatype. + # The artifacts stored locally will be used to generate the SLSA provenance. + ./gradlew publishAllPublicationsToBuildRepository publishToSonatype closeAndReleaseSonatypeStagingRepository + # Read the current version from gradle.properties. + VERSION=$(./gradlew properties | grep 'version:' | awk '{print $2}') + # Read the project group from gradle.properties. + GROUP_PATH=$(./gradlew properties| grep "projectGroup" | awk '{print $2}' | sed 's/\./\//g') + echo "version=$VERSION" >> "$GITHUB_OUTPUT" + echo "group=$GROUP_PATH" >> "$GITHUB_OUTPUT" + - name: Generate subject + id: hash + run: | + # Find the relevant published artifacts in the local repository. + ARTIFACTS=$(find build/repo/${{ steps.publish.outputs.group }}/*/${{ steps.publish.outputs.version }}/* \ + -regextype sed -regex '\(.*\.jar\|.*\.pom\|.*\.module\|.*\.toml\)') + # Compute the hashes for the artifacts. + # Set the hash as job output for debugging. + echo "artifacts-sha256=$(sha256sum $ARTIFACTS | base64 -w0)" >> "$GITHUB_OUTPUT" + # Store the hash in a file, which is uploaded as a workflow artifact. + echo $(sha256sum $ARTIFACTS | base64 -w0) > artifacts-sha256 + - name: Upload build artifacts + uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0 + with: + name: gradle-build-outputs + path: build/repo/${{ steps.publish.outputs.group }}/*/${{ steps.publish.outputs.version }}/* + retention-days: 5 + - name: Upload artifacts-sha256 + uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0 + with: + name: artifacts-sha256 + path: artifacts-sha256 + retention-days: 5 - name: Generate docs env: GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }} @@ -86,3 +120,57 @@ jobs: MICRONAUT_BUILD_EMAIL: ${{ secrets.MICRONAUT_BUILD_EMAIL }} with: token: ${{ secrets.GITHUB_TOKEN }} + + provenance-subject: + needs: [release] + runs-on: ubuntu-latest + outputs: + artifacts-sha256: ${{ steps.set-hash.outputs.artifacts-sha256 }} + steps: + - name: Download artifacts-sha256 + uses: actions/download-artifact@9782bd6a9848b53b110e712e20e42d89988822b7 # v3.0.1 + with: + name: artifacts-sha256 + # The SLSA provenance generator expects the hash digest of artifacts to be passed as a job + # output. So we need to download the artifacts-sha256 and set it as job output. The hash of + # the artifacts should be set as output directly in the release job. But due to a known bug + # in GitHub Actions we have to use a workaround. + # See https://github.com/community/community/discussions/37942. + - name: Set artifacts-sha256 as output + id: set-hash + shell: bash + run: echo "artifacts-sha256=$(cat artifacts-sha256)" >> "$GITHUB_OUTPUT" + + provenance: + needs: [release, provenance-subject] + permissions: + actions: read # To read the workflow path. + id-token: write # To sign the provenance. + contents: write # To add assets to a release. + uses: slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@v1.2.1 + with: + base64-subjects: "${{ needs.provenance-subject.outputs.artifacts-sha256 }}" + upload-assets: true # Upload to a new release. + compile-generator: true # Build the generator from source. + + github_release: + needs: [release] + runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/') + steps: + - name: Checkout repository + uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2 + - name: Download artifacts + uses: actions/download-artifact@9782bd6a9848b53b110e712e20e42d89988822b7 # v3.0.1 + with: + name: gradle-build-outputs + path: build/repo + - name: Upload assets + # Upload the artifacts and SLSA L3 provenance as assets to the existing + # release. Note that the provenance will attest to each artifact file and + # not the aggregated ZIP file. + run: | + find build/repo -regextype sed -regex '\(.*\.jar\|.*\.pom\|.*\.module\|.*\.toml\)' | xargs zip artifacts.zip + gh release upload ${{ github.ref_name }} artifacts.zip + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle index 031bdf051..a2051c731 100644 --- a/buildSrc/build.gradle +++ b/buildSrc/build.gradle @@ -8,5 +8,5 @@ repositories { } dependencies { - implementation 'io.micronaut.gradle:micronaut-gradle-plugin:3.5.1' + implementation 'io.micronaut.gradle:micronaut-gradle-plugin:3.6.4' } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index d2a926945..b49185c0a 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -3,15 +3,15 @@ micronaut = "4.0.0-SNAPSHOT" micronaut-docs = "2.0.0" # Required to keep catalog compatibility with 3.4.x. Can be removed for 4.0.0 -managed-kafka-compat = "2.8.1" -managed-kafka = '2.8.1' +managed-kafka-compat = "2.8.2" +managed-kafka = '2.8.2' groovy = "4.0.6" opentracing-kafka-client = '0.1.15' opentracing-mock = '0.33.0' -zipkin-brave-kafka-clients = '5.13.10' +zipkin-brave-kafka-clients = '5.14.1' [libraries] # Duplicated to keep catalog compatibility with 3.4.x. Can be removed for 4.0.0 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 8049c684f..ae04661ee 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists