Skip to content

Commit c3b8337

Browse files
committed
Unify commercial and OSS workflows
See gh-42333
1 parent ab6d557 commit c3b8337

File tree

6 files changed

+70
-21
lines changed

6 files changed

+70
-21
lines changed

.github/workflows/build-and-deploy-snapshot.yml

+7-6
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
build-and-deploy-snapshot:
1010
name: Build and Deploy Snapshot
1111
runs-on: ${{ vars.UBUNTU_MEDIUM || 'ubuntu-latest' }}
12-
if: ${{ github.repository == 'spring-projects/spring-boot' }}
12+
if: ${{ github.repository == 'spring-projects/spring-boot' || github.repository == 'spring-projects/spring-boot-commercial' }}
1313
steps:
1414
- name: Check Out Code
1515
uses: actions/checkout@v4
@@ -26,11 +26,12 @@ jobs:
2626
- name: Deploy
2727
uses: spring-io/artifactory-deploy-action@26bbe925a75f4f863e1e529e85be2d0093cac116 # v0.0.1
2828
with:
29-
uri: 'https://repo.spring.io'
30-
username: ${{ secrets.ARTIFACTORY_USERNAME }}
31-
password: ${{ secrets.ARTIFACTORY_PASSWORD }}
32-
build-name: 'spring-boot-3.2.x'
33-
repository: 'libs-snapshot-local'
29+
uri: ${{ vars.COMMERCIAL_DEPLOY_REPO_URL || 'https://repo.spring.io' }}
30+
username: ${{ vars.COMMERCIAL && secrets.COMMERCIAL_ARTIFACTORY_USERNAME || secrets.ARTIFACTORY_USERNAME }}
31+
password: ${{ vars.COMMERCIAL && secrets.COMMERCIAL_ARTIFACTORY_PASSWORD || secrets.ARTIFACTORY_PASSWORD }}
32+
build-name: ${{ vars.COMMERCIAL && format('spring-boot-commercial-{0}', github.ref_name) || format('spring-boot-{0}', github.ref_name) }}
33+
repository: ${{ vars.COMMERCIAL && 'spring-commercial-snapshot-local' || 'libs-snapshot-local' }}
34+
project: ${{ vars.COMMERCIAL && 'spring' }}
3435
folder: 'deployment-repository'
3536
signing-key: ${{ secrets.GPG_PRIVATE_KEY }}
3637
signing-passphrase: ${{ secrets.GPG_PASSPHRASE }}

.github/workflows/build-pull-request.yml

-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
name: Build Pull Request
22
on: pull_request
3-
43
permissions:
54
contents: read
6-
75
jobs:
86
build:
97
name: Build Pull Request

.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
ci:
1010
name: '${{ matrix.os.name}} | Java ${{ matrix.java.version}}'
1111
runs-on: ${{ matrix.os.id }}
12-
if: ${{ github.repository == 'spring-projects/spring-boot' }}
12+
if: ${{ github.repository == 'spring-projects/spring-boot' || github.repository == 'spring-projects/spring-boot-commercial' }}
1313
strategy:
1414
fail-fast: false
1515
matrix:

.github/workflows/distribute.yml

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Distribute
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
version:
6+
description: 'The version to bundle and distribute'
7+
required: true
8+
type: string
9+
build-number:
10+
description: 'The number of the build to use to create the bundle'
11+
required: true
12+
type: string
13+
create-bundle:
14+
description: 'Whether to create the bundle. If unchecked, only the bundle distribution is executed'
15+
required: true
16+
type: boolean
17+
default: true
18+
jobs:
19+
distribute-spring-enterprise-release-bundle:
20+
if: ${{ vars.COMMERCIAL }}
21+
runs-on: ${{ vars.UBUNTU_SMALL || 'ubuntu-latest' }}
22+
steps:
23+
- name: Create Bundle
24+
if: ${{ inputs.create-bundle }}
25+
shell: bash
26+
run: |
27+
curl -s -u "${{ secrets.COMMERCIAL_ARTIFACTORY_USERNAME }}:${{ secrets.COMMERCIAL_ARTIFACTORY_PASSWORD }}" \
28+
-X POST -H "X-JFrog-Signing-Key-Name: packagesKey" -H "Content-Type: application/json" \
29+
"https://usw1.packages.broadcom.com/lifecycle/api/v2/release_bundle?project=spring" \
30+
-d '{"release_bundle_name": "TNZ-spring-boot-commercial", "release_bundle_version": "${{ inputs.version }}", "skip_docker_manifest_resolution": true, "source_type": "builds", "source": {"builds": [ {"build_repository": "spring-build-info", "build_name": "spring-boot-commercial-${{ inputs.version }}", "build_number": "${{ inputs.build-number }}", "include_dependencies": false}]}}'
31+
- name: Sleep
32+
if: ${{ inputs.create-bundle }}
33+
shell: bash
34+
run: sleep 30
35+
- name: Distribute Bundle
36+
shell: bash
37+
run: |
38+
curl -s -u "${{ secrets.COMMERCIAL_ARTIFACTORY_USERNAME }}:${{ secrets.COMMERCIAL_ARTIFACTORY_PASSWORD }}" \
39+
-X POST -H "Content-Type: application/json" \
40+
"https://usw1.packages.broadcom.com/lifecycle/api/v2/distribution/distribute/TNZ-spring-boot-commercial/${{ inputs.version }}?project=spring" \
41+
-d '{"auto_create_missing_repositories": "false", "distribution_rules": [{"site_name": "JP-SaaS"}], "modifications": {"mappings": [{"input": "spring-enterprise-maven-prod-local/(.*)", "output": "spring-enterprise/$1"}]}}'

.github/workflows/release.yml

+16-8
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
build-and-stage-release:
1010
name: Build and Stage Release
1111
runs-on: ${{ vars.UBUNTU_MEDIUIM || 'ubuntu-latest' }}
12-
if: ${{ github.repository == 'spring-projects/spring-boot' }}
12+
if: ${{ github.repository == 'spring-projects/spring-boot' || github.repository == 'spring-projects/spring-boot-commercial' }}
1313
steps:
1414
- name: Check Out Code
1515
uses: actions/checkout@v4
@@ -26,11 +26,12 @@ jobs:
2626
- name: Stage Release
2727
uses: spring-io/artifactory-deploy-action@26bbe925a75f4f863e1e529e85be2d0093cac116 # v0.0.1
2828
with:
29-
uri: 'https://repo.spring.io'
30-
username: ${{ secrets.ARTIFACTORY_USERNAME }}
31-
password: ${{ secrets.ARTIFACTORY_PASSWORD }}
32-
build-name: ${{ format('spring-boot-{0}', steps.build-and-publish.outputs.version)}}
33-
repository: 'libs-staging-local'
29+
uri: ${{ vars.COMMERCIAL_DEPLOY_REPO_URL || 'https://repo.spring.io' }}
30+
username: ${{ vars.COMMERCIAL && secrets.COMMERCIAL_ARTIFACTORY_USERNAME || secrets.ARTIFACTORY_USERNAME }}
31+
password: ${{ vars.COMMERCIAL && secrets.COMMERCIAL_ARTIFACTORY_PASSWORD || secrets.ARTIFACTORY_PASSWORD }}
32+
build-name: ${{ vars.COMMERCIAL && format('spring-boot-commercial-{0}', github.ref_name) || format('spring-boot-{0}', github.ref_name) }}
33+
repository: ${{ vars.COMMERCIAL && 'spring-enterprise-maven-stage-local' || 'libs-staging-local' }}
34+
project: ${{ vars.COMMERCIAL && 'spring' }}
3435
folder: 'deployment-repository'
3536
signing-key: ${{ secrets.GPG_PRIVATE_KEY }}
3637
signing-passphrase: ${{ secrets.GPG_PASSPHRASE }}
@@ -52,6 +53,7 @@ jobs:
5253
token: ${{ secrets.GH_ACTIONS_REPO_TOKEN }}
5354
sync-to-maven-central:
5455
name: Sync to Maven Central
56+
if: ${{ !COMMERCIAL }}
5557
needs:
5658
- build-and-stage-release
5759
- verify
@@ -77,11 +79,16 @@ jobs:
7779
- name: Set up JFrog CLI
7880
uses: jfrog/setup-jfrog-cli@9fe0f98bd45b19e6e931d457f4e98f8f84461fb5 # v4.4.1
7981
env:
80-
JF_ENV_SPRING: ${{ secrets.JF_ARTIFACTORY_SPRING }}
81-
- name: Promote build
82+
JF_ENV_SPRING: ${{ vars.COMMERCIAL && secrets.COMMERCIAL_JF_ARTIFACTORY_SPRING || secrets.JF_ARTIFACTORY_SPRING }}
83+
- name: Promote open source build
84+
if: ${{ !vars.COMMERCIAL }}
8285
run: jfrog rt build-promote ${{ format('spring-boot-{0}', needs.build-and-stage-release.outputs.version)}} ${{ github.run_number }} libs-release-local
86+
- name: Promote commercial build
87+
if: ${{ vars.COMMERCIAL }}
88+
run: jfrog rt build-promote ${{ format('spring-boot-commercial-{0}', needs.build-and-stage-release.outputs.version)}} ${{ github.run_number }} spring-enterprise-maven-prod-local --project spring
8389
publish-gradle-plugin:
8490
name: Publish Gradle Plugin
91+
if: ${{ !COMMERCIAL }}
8592
needs:
8693
- build-and-stage-release
8794
- sync-to-maven-central
@@ -98,6 +105,7 @@ jobs:
98105
plugin-version: ${{ needs.build-and-stage-release.outputs.version }}
99106
publish-to-sdkman:
100107
name: Publish to SDKMAN!
108+
if: ${{ !COMMERCIAL }}
101109
needs:
102110
- build-and-stage-release
103111
- sync-to-maven-central

.github/workflows/verify.yml

+5-4
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,20 @@ jobs:
3131
uses: actions/checkout@v4
3232
with:
3333
repository: spring-projects/spring-boot-release-verification
34-
ref: 'v0.0.3'
34+
ref: 'v0.0.6'
3535
token: ${{ secrets.token }}
3636
- name: Check Out Send Notification Action
3737
uses: actions/checkout@v4
3838
with:
39-
path: spring-boot
39+
path: ${{ vars.COMMERCIAL && 'spring-boot' || 'spring-boot-commercial' }}
4040
sparse-checkout: .github/actions/send-notification
4141
- name: Set Up Java
4242
uses: actions/setup-java@v4
4343
with:
4444
distribution: 'liberica'
4545
java-version: 17
4646
- name: Set Up Homebrew
47+
if: ${{ !vars.COMMERCIAL }}
4748
uses: Homebrew/actions/setup-homebrew@7657c9512f50e1c35b640971116425935bab3eea
4849
- name: Set Up Gradle
4950
uses: gradle/actions/setup-gradle@d156388eb19639ec20ade50009f3d199ce1e2808 # v4.1.0
@@ -57,7 +58,7 @@ jobs:
5758
- name: Run Release Verification Tests
5859
env:
5960
RVT_VERSION: ${{ inputs.version }}
60-
RVT_RELEASE_TYPE: oss
61+
RVT_RELEASE_TYPE: ${{ vars.COMMERCIAL && 'commercial' || 'oss' }}
6162
RVT_STAGING: ${{ inputs.staging }}
6263
RVT_OSS_REPOSITORY_USERNAME: ${{ secrets.opensource-repository-username }}
6364
RVT_OSS_REPOSITORY_PASSWORD: ${{ secrets.opensource-repository-password }}
@@ -71,7 +72,7 @@ jobs:
7172
name: build-reports
7273
path: '**/build/reports/'
7374
- name: Send Notification
74-
uses: ./spring-boot/.github/actions/send-notification
75+
uses: ${{ vars.COMMERCIAL && './spring-boot-commercial/.github/actions/send-notification' || './spring-boot/.github/actions/send-notification' }}
7576
if: always()
7677
with:
7778
webhook-url: ${{ secrets.google-chat-webhook-url }}

0 commit comments

Comments
 (0)