Skip to content

Commit

Permalink
Unify commercial and OSS workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
philwebb committed Oct 1, 2024
1 parent ab6d557 commit c3b8337
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 21 deletions.
13 changes: 7 additions & 6 deletions .github/workflows/build-and-deploy-snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
build-and-deploy-snapshot:
name: Build and Deploy Snapshot
runs-on: ${{ vars.UBUNTU_MEDIUM || 'ubuntu-latest' }}
if: ${{ github.repository == 'spring-projects/spring-boot' }}
if: ${{ github.repository == 'spring-projects/spring-boot' || github.repository == 'spring-projects/spring-boot-commercial' }}
steps:
- name: Check Out Code
uses: actions/checkout@v4
Expand All @@ -26,11 +26,12 @@ jobs:
- name: Deploy
uses: spring-io/artifactory-deploy-action@26bbe925a75f4f863e1e529e85be2d0093cac116 # v0.0.1
with:
uri: 'https://repo.spring.io'
username: ${{ secrets.ARTIFACTORY_USERNAME }}
password: ${{ secrets.ARTIFACTORY_PASSWORD }}
build-name: 'spring-boot-3.2.x'
repository: '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 }}
build-name: ${{ vars.COMMERCIAL && format('spring-boot-commercial-{0}', github.ref_name) || format('spring-boot-{0}', github.ref_name) }}
repository: ${{ vars.COMMERCIAL && 'spring-commercial-snapshot-local' || 'libs-snapshot-local' }}
project: ${{ vars.COMMERCIAL && 'spring' }}
folder: 'deployment-repository'
signing-key: ${{ secrets.GPG_PRIVATE_KEY }}
signing-passphrase: ${{ secrets.GPG_PASSPHRASE }}
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/build-pull-request.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
name: Build Pull Request
on: pull_request

permissions:
contents: read

jobs:
build:
name: Build Pull Request
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
ci:
name: '${{ matrix.os.name}} | Java ${{ matrix.java.version}}'
runs-on: ${{ matrix.os.id }}
if: ${{ github.repository == 'spring-projects/spring-boot' }}
if: ${{ github.repository == 'spring-projects/spring-boot' || github.repository == 'spring-projects/spring-boot-commercial' }}
strategy:
fail-fast: false
matrix:
Expand Down
41 changes: 41 additions & 0 deletions .github/workflows/distribute.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Distribute
on:
workflow_dispatch:
inputs:
version:
description: 'The version to bundle and distribute'
required: true
type: string
build-number:
description: 'The number of the build to use to create the bundle'
required: true
type: string
create-bundle:
description: 'Whether to create the bundle. If unchecked, only the bundle distribution is executed'
required: true
type: boolean
default: true
jobs:
distribute-spring-enterprise-release-bundle:
if: ${{ vars.COMMERCIAL }}
runs-on: ${{ vars.UBUNTU_SMALL || 'ubuntu-latest' }}
steps:
- name: Create Bundle
if: ${{ inputs.create-bundle }}
shell: bash
run: |
curl -s -u "${{ secrets.COMMERCIAL_ARTIFACTORY_USERNAME }}:${{ secrets.COMMERCIAL_ARTIFACTORY_PASSWORD }}" \
-X POST -H "X-JFrog-Signing-Key-Name: packagesKey" -H "Content-Type: application/json" \
"https://usw1.packages.broadcom.com/lifecycle/api/v2/release_bundle?project=spring" \
-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}]}}'
- name: Sleep
if: ${{ inputs.create-bundle }}
shell: bash
run: sleep 30
- name: Distribute Bundle
shell: bash
run: |
curl -s -u "${{ secrets.COMMERCIAL_ARTIFACTORY_USERNAME }}:${{ secrets.COMMERCIAL_ARTIFACTORY_PASSWORD }}" \
-X POST -H "Content-Type: application/json" \
"https://usw1.packages.broadcom.com/lifecycle/api/v2/distribution/distribute/TNZ-spring-boot-commercial/${{ inputs.version }}?project=spring" \
-d '{"auto_create_missing_repositories": "false", "distribution_rules": [{"site_name": "JP-SaaS"}], "modifications": {"mappings": [{"input": "spring-enterprise-maven-prod-local/(.*)", "output": "spring-enterprise/$1"}]}}'
24 changes: 16 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
build-and-stage-release:
name: Build and Stage Release
runs-on: ${{ vars.UBUNTU_MEDIUIM || 'ubuntu-latest' }}
if: ${{ github.repository == 'spring-projects/spring-boot' }}
if: ${{ github.repository == 'spring-projects/spring-boot' || github.repository == 'spring-projects/spring-boot-commercial' }}
steps:
- name: Check Out Code
uses: actions/checkout@v4
Expand All @@ -26,11 +26,12 @@ jobs:
- name: Stage Release
uses: spring-io/artifactory-deploy-action@26bbe925a75f4f863e1e529e85be2d0093cac116 # v0.0.1
with:
uri: 'https://repo.spring.io'
username: ${{ secrets.ARTIFACTORY_USERNAME }}
password: ${{ secrets.ARTIFACTORY_PASSWORD }}
build-name: ${{ format('spring-boot-{0}', steps.build-and-publish.outputs.version)}}
repository: 'libs-staging-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 }}
build-name: ${{ vars.COMMERCIAL && format('spring-boot-commercial-{0}', github.ref_name) || format('spring-boot-{0}', github.ref_name) }}
repository: ${{ vars.COMMERCIAL && 'spring-enterprise-maven-stage-local' || 'libs-staging-local' }}
project: ${{ vars.COMMERCIAL && 'spring' }}
folder: 'deployment-repository'
signing-key: ${{ secrets.GPG_PRIVATE_KEY }}
signing-passphrase: ${{ secrets.GPG_PASSPHRASE }}
Expand All @@ -52,6 +53,7 @@ jobs:
token: ${{ secrets.GH_ACTIONS_REPO_TOKEN }}
sync-to-maven-central:
name: Sync to Maven Central
if: ${{ !COMMERCIAL }}
needs:
- build-and-stage-release
- verify
Expand All @@ -77,11 +79,16 @@ jobs:
- name: Set up JFrog CLI
uses: jfrog/setup-jfrog-cli@9fe0f98bd45b19e6e931d457f4e98f8f84461fb5 # v4.4.1
env:
JF_ENV_SPRING: ${{ secrets.JF_ARTIFACTORY_SPRING }}
- name: Promote build
JF_ENV_SPRING: ${{ vars.COMMERCIAL && secrets.COMMERCIAL_JF_ARTIFACTORY_SPRING || secrets.JF_ARTIFACTORY_SPRING }}
- name: Promote open source build
if: ${{ !vars.COMMERCIAL }}
run: jfrog rt build-promote ${{ format('spring-boot-{0}', needs.build-and-stage-release.outputs.version)}} ${{ github.run_number }} libs-release-local
- name: Promote commercial build
if: ${{ vars.COMMERCIAL }}
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
publish-gradle-plugin:
name: Publish Gradle Plugin
if: ${{ !COMMERCIAL }}
needs:
- build-and-stage-release
- sync-to-maven-central
Expand All @@ -98,6 +105,7 @@ jobs:
plugin-version: ${{ needs.build-and-stage-release.outputs.version }}
publish-to-sdkman:
name: Publish to SDKMAN!
if: ${{ !COMMERCIAL }}
needs:
- build-and-stage-release
- sync-to-maven-central
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,20 @@ jobs:
uses: actions/checkout@v4
with:
repository: spring-projects/spring-boot-release-verification
ref: 'v0.0.3'
ref: 'v0.0.6'
token: ${{ secrets.token }}
- name: Check Out Send Notification Action
uses: actions/checkout@v4
with:
path: spring-boot
path: ${{ vars.COMMERCIAL && 'spring-boot' || 'spring-boot-commercial' }}
sparse-checkout: .github/actions/send-notification
- name: Set Up Java
uses: actions/setup-java@v4
with:
distribution: 'liberica'
java-version: 17
- name: Set Up Homebrew
if: ${{ !vars.COMMERCIAL }}
uses: Homebrew/actions/setup-homebrew@7657c9512f50e1c35b640971116425935bab3eea
- name: Set Up Gradle
uses: gradle/actions/setup-gradle@d156388eb19639ec20ade50009f3d199ce1e2808 # v4.1.0
Expand All @@ -57,7 +58,7 @@ jobs:
- name: Run Release Verification Tests
env:
RVT_VERSION: ${{ inputs.version }}
RVT_RELEASE_TYPE: oss
RVT_RELEASE_TYPE: ${{ vars.COMMERCIAL && 'commercial' || 'oss' }}
RVT_STAGING: ${{ inputs.staging }}
RVT_OSS_REPOSITORY_USERNAME: ${{ secrets.opensource-repository-username }}
RVT_OSS_REPOSITORY_PASSWORD: ${{ secrets.opensource-repository-password }}
Expand All @@ -71,7 +72,7 @@ jobs:
name: build-reports
path: '**/build/reports/'
- name: Send Notification
uses: ./spring-boot/.github/actions/send-notification
uses: ${{ vars.COMMERCIAL && './spring-boot-commercial/.github/actions/send-notification' || './spring-boot/.github/actions/send-notification' }}
if: always()
with:
webhook-url: ${{ secrets.google-chat-webhook-url }}
Expand Down

0 comments on commit c3b8337

Please sign in to comment.