diff --git a/.github/actions/await-http-resource/action.yml b/.github/actions/await-http-resource/action.yml deleted file mode 100644 index ba177fb757b..00000000000 --- a/.github/actions/await-http-resource/action.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: Await HTTP Resource -description: 'Waits for an HTTP resource to be available (a HEAD request succeeds)' -inputs: - url: - description: 'URL of the resource to await' - required: true -runs: - using: composite - steps: - - name: Await HTTP resource - shell: bash - run: | - url=${{ inputs.url }} - echo "Waiting for $url" - until curl --fail --head --silent ${{ inputs.url }} > /dev/null - do - echo "." - sleep 60 - done - echo "$url is available" diff --git a/.github/actions/build/action.yml b/.github/actions/build/action.yml index 1e486fe672c..413e9b2f657 100644 --- a/.github/actions/build/action.yml +++ b/.github/actions/build/action.yml @@ -1,6 +1,18 @@ name: 'Build' description: 'Builds the project, optionally publishing it to a local deployment repository' inputs: + commercial-release-repository-url: + description: 'URL of the release repository' + required: false + commercial-repository-password: + description: 'Password for authentication with the commercial repository' + required: false + commercial-repository-username: + description: 'Username for authentication with the commercial repository' + required: false + commercial-snapshot-repository-url: + description: 'URL of the snapshot repository' + required: false develocity-access-key: description: 'Access key for authentication with ge.spring.io' required: false @@ -46,11 +58,21 @@ runs: id: build if: ${{ inputs.publish == 'false' }} shell: bash + env: + COMMERCIAL_RELEASE_REPO_URL: ${{ inputs.commercial-release-repository-url }} + COMMERCIAL_REPO_PASSWORD: ${{ inputs.commercial-repository-password }} + COMMERCIAL_REPO_USERNAME: ${{ inputs.commercial-repository-username }} + COMMERCIAL_SNAPSHOT_REPO_URL: ${{ inputs.commercial-snapshot-repository-url }} run: ./gradlew check antora - name: Publish id: publish if: ${{ inputs.publish == 'true' }} shell: bash + env: + COMMERCIAL_RELEASE_REPO_URL: ${{ inputs.commercial-release-repository-url }} + COMMERCIAL_REPO_PASSWORD: ${{ inputs.commercial-repository-password }} + COMMERCIAL_REPO_USERNAME: ${{ inputs.commercial-repository-username }} + COMMERCIAL_SNAPSHOT_REPO_URL: ${{ inputs.commercial-snapshot-repository-url }} run: ./gradlew -PdeploymentRepository=$(pwd)/deployment-repository build publishAllPublicationsToDeploymentRepository - name: Read Version From gradle.properties id: read-version diff --git a/.github/actions/create-github-release/action.yml b/.github/actions/create-github-release/action.yml index b82e149cb50..275ff632f58 100644 --- a/.github/actions/create-github-release/action.yml +++ b/.github/actions/create-github-release/action.yml @@ -1,6 +1,13 @@ name: Create GitHub Release description: 'Create the release on GitHub with a changelog' inputs: + commercial: + description: 'Whether to generate the changelog for the commercial release' + required: true + latest: + description: 'Whether the release is the latest release' + required: false + default: 'false' milestone: description: 'Name of the GitHub milestone for which a release will be created' required: true @@ -15,13 +22,13 @@ runs: using: composite steps: - name: Generate Changelog - uses: spring-io/github-changelog-generator@86958813a62af8fb223b3fd3b5152035504bcb83 #v0.0.12 + uses: spring-io/github-changelog-generator@f7d7a87a3e7c627ecb8c26cf086c38ac5a939721 #v0.0.14 with: - config-file: .github/actions/create-github-release/changelog-generator.yml + config-file: ${{ inputs.commercial && '.github/actions/create-github-release/changelog-generator-commercial.yml' || '.github/actions/create-github-release/changelog-generator-oss.yml' }} milestone: ${{ inputs.milestone }} token: ${{ inputs.token }} - name: Create GitHub Release shell: bash env: GITHUB_TOKEN: ${{ inputs.token }} - run: gh release create ${{ format('v{0}', inputs.milestone) }} --notes-file changelog.md ${{ inputs.pre-release == 'true' && '--prerelease' || '' }} + run: gh release create ${{ format('v{0}', inputs.milestone) }} --notes-file changelog.md ${{ inputs.pre-release == 'true' && '--prerelease' || format('--latest={0}', inputs.latest) }} diff --git a/.github/actions/create-github-release/changelog-generator-commercial.yml b/.github/actions/create-github-release/changelog-generator-commercial.yml new file mode 100644 index 00000000000..69f78ed5c86 --- /dev/null +++ b/.github/actions/create-github-release/changelog-generator-commercial.yml @@ -0,0 +1,33 @@ +changelog: + repository: spring-projects/spring-framework-commercial + sections: + - title: ":warning: Attention Required" + labels: + - "for: upgrade-attention" + summary: + mode: "member-comment" + config: + prefix: "Attention Required:" + - title: ":star: New Features" + labels: + - "type: enhancement" + - title: ":lady_beetle: Bug Fixes" + labels: + - "type: bug" + - "type: regression" + - title: ":notebook_with_decorative_cover: Documentation" + labels: + - "type: documentation" + - title: ":hammer: Dependency Upgrades" + sort: "title" + labels: + - "type: dependency-upgrade" + contributors: + exclude: + names: + - "bclozel" + - "jhoeller" + - "rstoyanchev" + - "sbrannen" + - "sdeleuze" + - "snicoll" diff --git a/.github/actions/create-github-release/changelog-generator.yml b/.github/actions/create-github-release/changelog-generator-oss.yml similarity index 95% rename from .github/actions/create-github-release/changelog-generator.yml rename to .github/actions/create-github-release/changelog-generator-oss.yml index 967e5febd9b..31f7d2e1cd8 100644 --- a/.github/actions/create-github-release/changelog-generator.yml +++ b/.github/actions/create-github-release/changelog-generator-oss.yml @@ -27,9 +27,7 @@ changelog: names: - "bclozel" - "jhoeller" - - "poutsma" - "rstoyanchev" - "sbrannen" - "sdeleuze" - - "simonbasle" - "snicoll" diff --git a/.github/actions/prepare-gradle-build/action.yml b/.github/actions/prepare-gradle-build/action.yml index 43834e9f6f2..955f96d0685 100644 --- a/.github/actions/prepare-gradle-build/action.yml +++ b/.github/actions/prepare-gradle-build/action.yml @@ -29,27 +29,25 @@ runs: distribution: ${{ inputs.java-early-access == 'true' && 'temurin' || (inputs.java-distribution || 'liberica') }} java-version: | ${{ inputs.java-early-access == 'true' && format('{0}-ea', inputs.java-version) || inputs.java-version }} - ${{ inputs.java-toolchain == 'true' && '17' || '' }} - 25 + ${{ inputs.java-toolchain == 'true' && '25' || '' }} - name: Set Up Gradle - uses: gradle/actions/setup-gradle@4d9f0ba0025fe599b4ebab900eb7f3a1d93ef4c2 # v5.0.0 + uses: gradle/actions/setup-gradle@3f131e8634966bd73d06cc69884922b02e6faf92 # 6.2.0 with: + cache-provider: basic cache-read-only: false develocity-access-key: ${{ inputs.develocity-access-key }} develocity-token-expiry: 4 - name: Configure Gradle Properties shell: bash run: | - mkdir -p $HOME/.gradle - echo 'systemProp.user.name=spring-builds+github' >> $HOME/.gradle/gradle.properties - echo 'systemProp.org.gradle.internal.launcher.welcomeMessageEnabled=false' >> $HOME/.gradle/gradle.properties - echo 'org.gradle.daemon=false' >> $HOME/.gradle/gradle.properties - echo 'org.gradle.daemon=4' >> $HOME/.gradle/gradle.properties + echo 'systemProp.user.name=spring-builds+github' >> $GRADLE_USER_HOME/gradle.properties + echo 'systemProp.org.gradle.internal.launcher.welcomeMessageEnabled=false' >> $GRADLE_USER_HOME/gradle.properties + echo 'org.gradle.daemon=false' >> $GRADLE_USER_HOME/gradle.properties - name: Configure Toolchain Properties if: ${{ inputs.java-toolchain == 'true' }} shell: bash run: | - echo toolchainVersion=${{ inputs.java-version }} >> $HOME/.gradle/gradle.properties - echo systemProp.org.gradle.java.installations.auto-detect=false >> $HOME/.gradle/gradle.properties - echo systemProp.org.gradle.java.installations.auto-download=false >> $HOME/.gradle/gradle.properties - echo systemProp.org.gradle.java.installations.paths=${{ format('$JAVA_HOME_{0}_X64', inputs.java-version) }} >> $HOME/.gradle/gradle.properties + echo toolchainVersion=${{ inputs.java-version }} >> $GRADLE_USER_HOME/gradle.properties + echo systemProp.org.gradle.java.installations.auto-detect=false >> $GRADLE_USER_HOME/gradle.properties + echo systemProp.org.gradle.java.installations.auto-download=false >> $GRADLE_USER_HOME/gradle.properties + echo systemProp.org.gradle.java.installations.paths=${{ format('$JAVA_HOME_{0}_X64', inputs.java-version) }} >> $GRADLE_USER_HOME/gradle.properties \ No newline at end of file diff --git a/.github/actions/sync-to-maven-central/action.yml b/.github/actions/sync-to-maven-central/action.yml deleted file mode 100644 index 1edbe8cc16a..00000000000 --- a/.github/actions/sync-to-maven-central/action.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: Sync to Maven Central -description: 'Syncs a release to Maven Central and waits for it to be available for use' -inputs: - central-token-password: - description: 'Password for authentication with central.sonatype.com' - required: true - central-token-username: - description: 'Username for authentication with central.sonatype.com' - required: true - jfrog-cli-config-token: - description: 'Config token for the JFrog CLI' - required: true - spring-framework-version: - description: 'Version of Spring Framework that is being synced to Central' - required: true -runs: - using: composite - steps: - - name: Set Up JFrog CLI - uses: jfrog/setup-jfrog-cli@5b06f730cc5a6f55d78b30753f8583454b08c0aa # v4.8.1 - env: - JF_ENV_SPRING: ${{ inputs.jfrog-cli-config-token }} - - name: Download Release Artifacts - shell: bash - run: jf rt download --spec ${{ format('{0}/artifacts.spec', github.action_path) }} --spec-vars 'buildName=${{ format('spring-framework-{0}', inputs.spring-framework-version) }};buildNumber=${{ github.run_number }}' - - name: Sync - uses: spring-io/central-publish-action@0c03960e9b16fdfe70e2443e1d5393cbc3a35622 # v0.3.0 - with: - token: ${{ inputs.central-token-password }} - token-name: ${{ inputs.central-token-username }} - - name: Await - uses: ./.github/actions/await-http-resource - with: - url: ${{ format('https://repo.maven.apache.org/maven2/org/springframework/spring-context/{0}/spring-context-{0}.jar', inputs.spring-framework-version) }} diff --git a/.github/actions/sync-to-maven-central/artifacts.spec b/.github/actions/sync-to-maven-central/artifacts.spec deleted file mode 100644 index faf351f89c0..00000000000 --- a/.github/actions/sync-to-maven-central/artifacts.spec +++ /dev/null @@ -1,25 +0,0 @@ -{ - "files": [ - { - "aql": { - "items.find": { - "$and": [ - { - "@build.name": "${buildName}", - "@build.number": "${buildNumber}", - "path": { - "$nmatch": "org/springframework/framework-api/*" - } - }, - { - "path": { - "$nmatch": "org/springframework/framework-docs/*" - } - } - ] - } - }, - "target": "nexus/" - } - ] -} diff --git a/.github/workflows/backport-bot.yml b/.github/workflows/backport-bot.yml index 0a3baf11e47..8def7183d7f 100644 --- a/.github/workflows/backport-bot.yml +++ b/.github/workflows/backport-bot.yml @@ -7,27 +7,15 @@ on: push: branches: - '*.x' -permissions: - contents: read jobs: - build: + backport-issue: permissions: contents: read issues: write pull-requests: write runs-on: ubuntu-latest steps: - - name: Check out code - uses: actions/checkout@v6 - - name: Set up Java - uses: actions/setup-java@v5 + - name: Create Backport Issue + uses: spring-io/backport-bot@v0.0.2 with: - distribution: 'liberica' - java-version: 17 - - name: Download BackportBot - run: wget https://github.com/spring-io/backport-bot/releases/download/latest/backport-bot-0.0.1-SNAPSHOT.jar - - name: Backport - env: - GITHUB_EVENT: ${{ toJSON(github.event) }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: java -jar backport-bot-0.0.1-SNAPSHOT.jar --github.accessToken="$GITHUB_TOKEN" --github.event_name "$GITHUB_EVENT_NAME" --github.event "$GITHUB_EVENT" + token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/build-and-deploy-snapshot.yml b/.github/workflows/build-and-deploy-snapshot.yml index eb469084a43..167c97dff8b 100644 --- a/.github/workflows/build-and-deploy-snapshot.yml +++ b/.github/workflows/build-and-deploy-snapshot.yml @@ -8,16 +8,20 @@ concurrency: jobs: build-and-deploy-snapshot: name: Build and Deploy Snapshot - if: ${{ github.repository == 'spring-projects/spring-framework' }} - runs-on: ubuntu-latest + if: ${{ github.repository == 'spring-projects/spring-framework' || github.repository == 'spring-projects/spring-framework-commercial' }} + runs-on: ${{ vars.UBUNTU_MEDIUM || 'ubuntu-latest' }} timeout-minutes: 60 steps: - name: Check Out Code - uses: actions/checkout@v6 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: Build and Publish id: build-and-publish uses: ./.github/actions/build with: + commercial-release-repository-url: ${{ vars.COMMERCIAL_RELEASE_REPO_URL }} + commercial-repository-password: ${{ secrets.COMMERCIAL_ARTIFACTORY_PASSWORD }} + commercial-repository-username: ${{ secrets.COMMERCIAL_ARTIFACTORY_USERNAME }} + commercial-snapshot-repository-url: ${{ vars.COMMERCIAL_SNAPSHOT_REPO_URL }} develocity-access-key: ${{ secrets.DEVELOCITY_ACCESS_KEY }} publish: true - name: Deploy @@ -27,32 +31,46 @@ jobs: /**/framework-api-*.zip::zip.name=spring-framework,zip.deployed=false /**/framework-api-*-docs.zip::zip.type=docs /**/framework-api-*-schema.zip::zip.type=schema - build-name: 'spring-framework-7.0.x' + build-name: ${{ vars.COMMERCIAL && format('spring-framework-commercial-{0}', '7.0.x') || format('spring-framework-{0}', '7.0.x') }} folder: 'deployment-repository' - password: ${{ secrets.ARTIFACTORY_PASSWORD }} - repository: 'libs-snapshot-local' + project: ${{ vars.COMMERCIAL && 'spring' }} + repository: ${{ vars.COMMERCIAL && 'spring-enterprise-maven-dev-local' || 'libs-snapshot-local' }} + uri: ${{ vars.COMMERCIAL_DEPLOY_REPO_URL || 'https://repo.spring.io' }} + username: ${{ vars.COMMERCIAL && secrets.COMMERCIAL_ARTIFACTORY_USERNAME || secrets.ARTIFACTORY_USERNAME }} + password: ${{ vars.COMMERCIAL && secrets.COMMERCIAL_ARTIFACTORY_PASSWORD || secrets.ARTIFACTORY_PASSWORD }} signing-key: ${{ secrets.GPG_PRIVATE_KEY }} signing-passphrase: ${{ secrets.GPG_PASSPHRASE }} - uri: 'https://repo.spring.io' - username: ${{ secrets.ARTIFACTORY_USERNAME }} - name: Send Notification if: always() uses: ./.github/actions/send-notification with: build-scan-url: ${{ steps.build-and-publish.outputs.build-scan-url }} - run-name: ${{ format('{0} | Linux | Java 17', github.ref_name) }} + run-name: ${{ format('{0} | Linux | Java 25', github.ref_name) }} status: ${{ job.status }} webhook-url: ${{ secrets.GOOGLE_CHAT_WEBHOOK_URL }} outputs: version: ${{ steps.build-and-publish.outputs.version }} + trigger-docs-build: + name: Trigger Docs Build + needs: build-and-deploy-snapshot + permissions: + actions: write + runs-on: ${{ vars.UBUNTU_SMALL || 'ubuntu-latest' }} + steps: + - name: Run Deploy Docs Workflow + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: gh workflow run deploy-docs.yml --repo ${{ github.repository }} -r docs-build -f build-sha=${{ github.sha }} -f build-refname=${{ github.ref_name }} -f build-version=${{ needs.build-and-deploy-snapshot.outputs.version }} verify: name: Verify needs: build-and-deploy-snapshot uses: ./.github/workflows/verify.yml secrets: + commercial-repository-password: ${{ secrets.COMMERCIAL_ARTIFACTORY_PASSWORD }} + commercial-repository-username: ${{ secrets.COMMERCIAL_ARTIFACTORY_USERNAME }} google-chat-webhook-url: ${{ secrets.GOOGLE_CHAT_WEBHOOK_URL }} - repository-password: ${{ secrets.ARTIFACTORY_PASSWORD }} - repository-username: ${{ secrets.ARTIFACTORY_USERNAME }} + opensource-repository-password: ${{ secrets.ARTIFACTORY_PASSWORD }} + opensource-repository-username: ${{ secrets.ARTIFACTORY_USERNAME }} token: ${{ secrets.GH_ACTIONS_REPO_TOKEN }} with: version: ${{ needs.build-and-deploy-snapshot.outputs.version }} diff --git a/.github/workflows/build-pull-request.yml b/.github/workflows/build-pull-request.yml index 8c04704b278..8b6b30a01b8 100644 --- a/.github/workflows/build-pull-request.yml +++ b/.github/workflows/build-pull-request.yml @@ -7,10 +7,9 @@ jobs: name: Build Pull Request if: ${{ github.repository == 'spring-projects/spring-framework' }} runs-on: ubuntu-latest - timeout-minutes: 60 steps: - name: Check Out Code - uses: actions/checkout@v6 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: Build id: build uses: ./.github/actions/build @@ -19,7 +18,7 @@ jobs: uses: ./.github/actions/print-jvm-thread-dumps - name: Upload Build Reports if: failure() - uses: actions/upload-artifact@v6 + uses: actions/upload-artifact@v7 with: name: build-reports - path: '**/build/reports/' + path: '**/build/reports/' \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3297b2a9190..f4dc6b91b5b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,31 +2,33 @@ name: CI on: schedule: - cron: '30 9 * * *' -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} +permissions: + contents: read jobs: ci: name: '${{ matrix.os.name}} | Java ${{ matrix.java.version}}' - if: ${{ github.repository == 'spring-projects/spring-framework' }} + if: ${{ github.repository == 'spring-projects/spring-framework' || github.repository == 'spring-projects/spring-framework-commercial' }} runs-on: ${{ matrix.os.id }} timeout-minutes: 60 strategy: matrix: os: - - id: ubuntu-latest + - id: ${{ vars.UBUNTU_MEDIUM || 'ubuntu-latest' }} name: Linux java: - version: 17 - toolchain: false + toolchain: true - version: 21 toolchain: true - version: 25 + toolchain: false + - version: 26 toolchain: true exclude: - os: name: Linux java: - version: 17 + version: 25 steps: - name: Prepare Windows runner if: ${{ runner.os == 'Windows' }} @@ -35,11 +37,15 @@ jobs: git config --global core.longPaths true Stop-Service -name Docker - name: Check Out Code - uses: actions/checkout@v6 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: Build id: build uses: ./.github/actions/build with: + commercial-release-repository-url: ${{ vars.COMMERCIAL_RELEASE_REPO_URL }} + commercial-repository-password: ${{ secrets.COMMERCIAL_ARTIFACTORY_PASSWORD }} + commercial-repository-username: ${{ secrets.COMMERCIAL_ARTIFACTORY_USERNAME }} + commercial-snapshot-repository-url: ${{ vars.COMMERCIAL_SNAPSHOT_REPO_URL }} develocity-access-key: ${{ secrets.DEVELOCITY_ACCESS_KEY }} java-early-access: ${{ matrix.java.early-access || 'false' }} java-distribution: ${{ matrix.java.distribution }} diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml deleted file mode 100644 index 452b627751b..00000000000 --- a/.github/workflows/deploy-docs.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: Deploy Docs -on: - push: - branches: - - 'main' - - '*.x' - - '!gh-pages' - tags: - - 'v*' - repository_dispatch: - types: request-build-reference # legacy - workflow_dispatch: -permissions: - actions: write -jobs: - build: - name: Dispatch docs deployment - if: github.repository_owner == 'spring-projects' - runs-on: ubuntu-latest - steps: - - name: Check out code - uses: actions/checkout@v6 - with: - fetch-depth: 1 - ref: docs-build - - name: Dispatch (partial build) - if: github.ref_type == 'branch' - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: gh workflow run deploy-docs.yml -r $(git rev-parse --abbrev-ref HEAD) -f build-refname=${{ github.ref_name }} - - name: Dispatch (full build) - if: github.ref_type == 'tag' - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: gh workflow run deploy-docs.yml -r $(git rev-parse --abbrev-ref HEAD) diff --git a/.github/workflows/publish-milestone.yml b/.github/workflows/publish-milestone.yml new file mode 100644 index 00000000000..e280b3789c6 --- /dev/null +++ b/.github/workflows/publish-milestone.yml @@ -0,0 +1,39 @@ +name: Release Milestone +on: + push: + tags: + - v7.0.0-M[1-9] + - v7.0.0-RC[1-9] +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} +jobs: + trigger-docs-build: + name: Trigger Docs Build + permissions: + actions: write + runs-on: ubuntu-latest + outputs: + version: ${{ steps.version.outputs.version }} + steps: + - name: Determine Version + id: version + run: echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT" + - name: Run Deploy Docs Workflow + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: gh workflow run deploy-docs.yml --repo ${{ github.repository }} -r docs-build -f build-refname=${{ github.ref_name }} -f build-version=${{ steps.version.outputs.version }} + create-github-release: + name: Create GitHub Release + needs: + - trigger-docs-build + runs-on: ubuntu-latest + steps: + - name: Check Out Code + uses: actions/checkout@v6 + - name: Create GitHub Release + uses: ./.github/actions/create-github-release + with: + commercial: ${{ vars.COMMERCIAL }} + milestone: ${{ needs.trigger-docs-build.outputs.version }} + pre-release: true + token: ${{ secrets.GH_ACTIONS_REPO_TOKEN }} diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml new file mode 100644 index 00000000000..4db75cba4eb --- /dev/null +++ b/.github/workflows/publish-release.yml @@ -0,0 +1,38 @@ +name: Release +on: + push: + tags: + - v7.0.[0-9]+ +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} +jobs: + trigger-docs-build: + name: Trigger Docs Build + permissions: + actions: write + runs-on: ubuntu-latest + outputs: + version: ${{ steps.version.outputs.version }} + steps: + - name: Determine Version + id: version + run: echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT" + - name: Run Deploy Docs Workflow + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: gh workflow run deploy-docs.yml --repo ${{ github.repository }} -r docs-build -f build-refname=${{ github.ref_name }} -f build-version=${{ steps.version.outputs.version }} + create-github-release: + name: Create GitHub Release + needs: + - trigger-docs-build + runs-on: ubuntu-latest + steps: + - name: Check Out Code + uses: actions/checkout@v6 + - name: Create GitHub Release + uses: ./.github/actions/create-github-release + with: + commercial: ${{ vars.COMMERCIAL }} + latest: true + milestone: ${{ needs.trigger-docs-build.outputs.version }} + token: ${{ secrets.GH_ACTIONS_REPO_TOKEN }} diff --git a/.github/workflows/release-milestone.yml b/.github/workflows/release-milestone.yml deleted file mode 100644 index bc6ab1a9a55..00000000000 --- a/.github/workflows/release-milestone.yml +++ /dev/null @@ -1,95 +0,0 @@ -name: Release Milestone -on: - push: - tags: - - v7.0.0-M[1-9] - - v7.0.0-RC[1-9] -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} -jobs: - build-and-stage-release: - name: Build and Stage Release - if: ${{ github.repository == 'spring-projects/spring-framework' }} - runs-on: ubuntu-latest - steps: - - name: Check Out Code - uses: actions/checkout@v6 - - name: Build and Publish - id: build-and-publish - uses: ./.github/actions/build - with: - develocity-access-key: ${{ secrets.DEVELOCITY_ACCESS_KEY }} - publish: true - - name: Stage Release - uses: spring-io/artifactory-deploy-action@926d7f7cc810569395346bf3a4d91b380b3e355b # v0.0.4 - with: - artifact-properties: | - /**/framework-api-*.zip::zip.name=spring-framework,zip.deployed=false - /**/framework-api-*-docs.zip::zip.type=docs - /**/framework-api-*-schema.zip::zip.type=schema - build-name: ${{ format('spring-framework-{0}', steps.build-and-publish.outputs.version)}} - folder: 'deployment-repository' - password: ${{ secrets.ARTIFACTORY_PASSWORD }} - repository: 'libs-staging-local' - signing-key: ${{ secrets.GPG_PRIVATE_KEY }} - signing-passphrase: ${{ secrets.GPG_PASSPHRASE }} - uri: 'https://repo.spring.io' - username: ${{ secrets.ARTIFACTORY_USERNAME }} - outputs: - version: ${{ steps.build-and-publish.outputs.version }} - verify: - name: Verify - needs: build-and-stage-release - uses: ./.github/workflows/verify.yml - secrets: - google-chat-webhook-url: ${{ secrets.GOOGLE_CHAT_WEBHOOK_URL }} - repository-password: ${{ secrets.ARTIFACTORY_PASSWORD }} - repository-username: ${{ secrets.ARTIFACTORY_USERNAME }} - token: ${{ secrets.GH_ACTIONS_REPO_TOKEN }} - with: - staging: true - version: ${{ needs.build-and-stage-release.outputs.version }} - sync-to-maven-central: - name: Sync to Maven Central - needs: - - build-and-stage-release - - verify - runs-on: ubuntu-latest - steps: - - name: Check Out Code - uses: actions/checkout@v6 - - name: Sync to Maven Central - uses: ./.github/actions/sync-to-maven-central - with: - central-token-password: ${{ secrets.CENTRAL_TOKEN_PASSWORD }} - central-token-username: ${{ secrets.CENTRAL_TOKEN_USERNAME }} - jfrog-cli-config-token: ${{ secrets.JF_ARTIFACTORY_SPRING }} - spring-framework-version: ${{ needs.build-and-stage-release.outputs.version }} - promote-release: - name: Promote Release - needs: - - build-and-stage-release - - sync-to-maven-central - runs-on: ubuntu-latest - steps: - - name: Set up JFrog CLI - uses: jfrog/setup-jfrog-cli@5b06f730cc5a6f55d78b30753f8583454b08c0aa # v4.8.1 - env: - JF_ENV_SPRING: ${{ secrets.JF_ARTIFACTORY_SPRING }} - - name: Promote build - run: jfrog rt build-promote ${{ format('spring-framework-{0}', needs.build-and-stage-release.outputs.version)}} ${{ github.run_number }} libs-milestone-local - create-github-release: - name: Create GitHub Release - needs: - - build-and-stage-release - - promote-release - runs-on: ubuntu-latest - steps: - - name: Check Out Code - uses: actions/checkout@v6 - - name: Create GitHub Release - uses: ./.github/actions/create-github-release - with: - milestone: ${{ needs.build-and-stage-release.outputs.version }} - pre-release: true - token: ${{ secrets.GH_ACTIONS_REPO_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index e1ee0bf5e7d..00000000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,93 +0,0 @@ -name: Release -on: - push: - tags: - - v7.0.[0-9]+ -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} -jobs: - build-and-stage-release: - name: Build and Stage Release - if: ${{ github.repository == 'spring-projects/spring-framework' }} - runs-on: ubuntu-latest - steps: - - name: Check Out Code - uses: actions/checkout@v6 - - name: Build and Publish - id: build-and-publish - uses: ./.github/actions/build - with: - develocity-access-key: ${{ secrets.DEVELOCITY_ACCESS_KEY }} - publish: true - - name: Stage Release - uses: spring-io/artifactory-deploy-action@926d7f7cc810569395346bf3a4d91b380b3e355b # v0.0.4 - with: - artifact-properties: | - /**/framework-api-*.zip::zip.name=spring-framework,zip.deployed=false - /**/framework-api-*-docs.zip::zip.type=docs - /**/framework-api-*-schema.zip::zip.type=schema - build-name: ${{ format('spring-framework-{0}', steps.build-and-publish.outputs.version)}} - folder: 'deployment-repository' - password: ${{ secrets.ARTIFACTORY_PASSWORD }} - repository: 'libs-staging-local' - signing-key: ${{ secrets.GPG_PRIVATE_KEY }} - signing-passphrase: ${{ secrets.GPG_PASSPHRASE }} - uri: 'https://repo.spring.io' - username: ${{ secrets.ARTIFACTORY_USERNAME }} - outputs: - version: ${{ steps.build-and-publish.outputs.version }} - verify: - name: Verify - needs: build-and-stage-release - uses: ./.github/workflows/verify.yml - secrets: - google-chat-webhook-url: ${{ secrets.GOOGLE_CHAT_WEBHOOK_URL }} - repository-password: ${{ secrets.ARTIFACTORY_PASSWORD }} - repository-username: ${{ secrets.ARTIFACTORY_USERNAME }} - token: ${{ secrets.GH_ACTIONS_REPO_TOKEN }} - with: - staging: true - version: ${{ needs.build-and-stage-release.outputs.version }} - sync-to-maven-central: - name: Sync to Maven Central - needs: - - build-and-stage-release - - verify - runs-on: ubuntu-latest - steps: - - name: Check Out Code - uses: actions/checkout@v6 - - name: Sync to Maven Central - uses: ./.github/actions/sync-to-maven-central - with: - central-token-password: ${{ secrets.CENTRAL_TOKEN_PASSWORD }} - central-token-username: ${{ secrets.CENTRAL_TOKEN_USERNAME }} - jfrog-cli-config-token: ${{ secrets.JF_ARTIFACTORY_SPRING }} - spring-framework-version: ${{ needs.build-and-stage-release.outputs.version }} - promote-release: - name: Promote Release - needs: - - build-and-stage-release - - sync-to-maven-central - runs-on: ubuntu-latest - steps: - - name: Set up JFrog CLI - uses: jfrog/setup-jfrog-cli@5b06f730cc5a6f55d78b30753f8583454b08c0aa # v4.8.1 - env: - JF_ENV_SPRING: ${{ secrets.JF_ARTIFACTORY_SPRING }} - - name: Promote build - run: jfrog rt build-promote ${{ format('spring-framework-{0}', needs.build-and-stage-release.outputs.version)}} ${{ github.run_number }} libs-release-local - create-github-release: - name: Create GitHub Release - needs: - - build-and-stage-release - - promote-release - runs-on: ubuntu-latest - steps: - - name: Check Out Code - uses: actions/checkout@v6 - - name: Create GitHub Release - uses: ./.github/actions/create-github-release - with: - milestone: ${{ needs.build-and-stage-release.outputs.version }} - token: ${{ secrets.GH_ACTIONS_REPO_TOKEN }} diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml index 093d198b923..9823650e332 100644 --- a/.github/workflows/verify.yml +++ b/.github/workflows/verify.yml @@ -12,31 +12,39 @@ on: required: true type: string secrets: + commercial-repository-password: + description: 'Password for authentication with the commercial repository' + required: false + commercial-repository-username: + description: 'Username for authentication with the commercial repository' + required: false google-chat-webhook-url: description: 'Google Chat Webhook URL' required: true - repository-password: - description: 'Password for authentication with the repository' + opensource-repository-password: + description: 'Password for authentication with the open-source repository' required: false - repository-username: - description: 'Username for authentication with the repository' + opensource-repository-username: + description: 'Username for authentication with the open-source repository' required: false token: description: 'Token to use for authentication with GitHub' required: true +permissions: + contents: read jobs: verify: name: Verify - runs-on: ubuntu-latest + runs-on: ${{ vars.UBUNTU_SMALL || 'ubuntu-latest' }} steps: - name: Check Out Release Verification Tests - uses: actions/checkout@v6 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: ref: 'v0.0.2' repository: spring-projects/spring-framework-release-verification token: ${{ secrets.token }} - name: Check Out Send Notification Action - uses: actions/checkout@v6 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: path: send-notification sparse-checkout: .github/actions/send-notification @@ -46,8 +54,9 @@ jobs: distribution: 'liberica' java-version: 17 - name: Set Up Gradle - uses: gradle/actions/setup-gradle@4d9f0ba0025fe599b4ebab900eb7f3a1d93ef4c2 # v5.0.0 + uses: gradle/actions/setup-gradle@3f131e8634966bd73d06cc69884922b02e6faf92 # v6.2.0 with: + cache-provider: basic cache-read-only: false - name: Configure Gradle Properties shell: bash @@ -56,15 +65,17 @@ jobs: echo 'org.gradle.daemon=false' >> $HOME/.gradle/gradle.properties - name: Run Release Verification Tests env: - RVT_OSS_REPOSITORY_PASSWORD: ${{ secrets.repository-password }} - RVT_OSS_REPOSITORY_USERNAME: ${{ secrets.repository-username }} - RVT_RELEASE_TYPE: oss + RVT_COMMERCIAL_REPOSITORY_PASSWORD: ${{ secrets.commercial-repository-password }} + RVT_COMMERCIAL_REPOSITORY_USERNAME: ${{ secrets.commercial-repository-username }} + RVT_OSS_REPOSITORY_PASSWORD: ${{ secrets.opensource-repository-password }} + RVT_OSS_REPOSITORY_USERNAME: ${{ secrets.opensource-repository-username }} + RVT_RELEASE_TYPE: ${{ vars.COMMERCIAL && 'commercial' || 'oss' }} RVT_STAGING: ${{ inputs.staging }} RVT_VERSION: ${{ inputs.version }} run: ./gradlew spring-framework-release-verification-tests:test - name: Upload Build Reports on Failure if: failure() - uses: actions/upload-artifact@v6 + uses: actions/upload-artifact@v7 with: name: build-reports path: '**/build/reports/' diff --git a/build.gradle b/build.gradle index 1dcdd2409af..263b9dbd545 100644 --- a/build.gradle +++ b/build.gradle @@ -18,16 +18,8 @@ description = "Spring Framework" configure(allprojects) { project -> apply plugin: "org.springframework.build.localdev" + apply plugin: "org.springframework.build.repositories" group = "org.springframework" - repositories { - mavenCentral() - if (version.contains('-')) { - maven { url = "https://repo.spring.io/milestone" } - } - if (version.endsWith('-SNAPSHOT')) { - maven { url = "https://repo.spring.io/snapshot" } - } - } configurations.all { resolutionStrategy { cacheChangingModulesFor 0, "seconds" diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle index 58cbf888cd4..013ec3566cf 100644 --- a/buildSrc/build.gradle +++ b/buildSrc/build.gradle @@ -50,6 +50,10 @@ gradlePlugin { id = "org.springframework.build.multiReleaseJar" implementationClass = "org.springframework.build.multirelease.MultiReleaseJarPlugin" } + repositoriesPlugin { + id = "org.springframework.build.repositories" + implementationClass = "org.springframework.build.RepositoriesPlugin" + } optionalDependenciesPlugin { id = "org.springframework.build.optional-dependencies" implementationClass = "org.springframework.build.optional.OptionalDependenciesPlugin" diff --git a/buildSrc/src/main/java/org/springframework/build/RepositoriesPlugin.java b/buildSrc/src/main/java/org/springframework/build/RepositoriesPlugin.java new file mode 100644 index 00000000000..f42c76dfe26 --- /dev/null +++ b/buildSrc/src/main/java/org/springframework/build/RepositoriesPlugin.java @@ -0,0 +1,87 @@ +/* + * Copyright 2002-present 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. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.build; + +import org.gradle.api.Plugin; +import org.gradle.api.Project; + +/** + * Plugin that configures the OSS, commercial and release train repositories in the build. + * + * @author Brian Clozel + */ +public class RepositoriesPlugin implements Plugin { + + @Override + public void apply(Project project) { + configureOssRepositories(project); + configureCommercialRepositories(project); + configureReleaseTrainRepository(project); + } + + private void configureOssRepositories(Project project) { + project.getRepositories().mavenCentral(); + if (project.getVersion().toString().contains("-")) { + project.getRepositories().maven(repository -> { + repository.setName("spring-oss-milestone"); + repository.setUrl("https://repo.spring.io/milestone/"); + }); + } + if (project.getVersion().toString().endsWith("-SNAPSHOT")) { + project.getRepositories().maven(repository -> { + repository.setName("spring-oss-snapshot"); + repository.setUrl("https://repo.spring.io/snapshot/"); + }); + } + } + + private void configureCommercialRepositories(Project project) { + if (System.getenv().containsKey("COMMERCIAL_RELEASE_REPO_URL")) { + project.getRepositories().maven((repository) -> { + repository.setName("spring-commercial-release"); + repository.setUrl(System.getenv("COMMERCIAL_RELEASE_REPO_URL")); + repository.credentials((creds) -> { + creds.setUsername(System.getenv("COMMERCIAL_REPO_USERNAME")); + creds.setPassword(System.getenv("COMMERCIAL_REPO_PASSWORD")); + }); + }); + } + if (System.getenv().containsKey("COMMERCIAL_SNAPSHOT_REPO_URL") && project.getVersion().toString().endsWith("-SNAPSHOT")) { + project.getRepositories().maven((repository) -> { + repository.setName("spring-commercial-snapshot"); + repository.setUrl(System.getenv("COMMERCIAL_SNAPSHOT_REPO_URL")); + repository.credentials((creds) -> { + creds.setUsername(System.getenv("COMMERCIAL_REPO_USERNAME")); + creds.setPassword(System.getenv("COMMERCIAL_REPO_PASSWORD")); + }); + }); + } + } + + private void configureReleaseTrainRepository(Project project) { + if (System.getenv().containsKey("RELEASE_TRAIN_MAVEN_REPOSITORY_URL")) { + project.getRepositories().maven(repository -> { + repository.setName("spring-release-train"); + repository.setUrl(System.getenv("RELEASE_TRAIN_MAVEN_REPOSITORY_URL")); + repository.credentials((creds) -> { + creds.setUsername(System.getenv("RELEASE_TRAIN_MAVEN_REPOSITORY_USERNAME")); + creds.setPassword(System.getenv("RELEASE_TRAIN_MAVEN_REPOSITORY_PASSWORD")); + }); + }); + } + } +}