Skip to content

Commit 75e6f5e

Browse files
committed
Merge branch 'main' into intialize-commercial-branch
2 parents 9cea302 + 95e4444 commit 75e6f5e

51 files changed

Lines changed: 66179 additions & 103 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/actions/determine-matrix/action.yml‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,18 @@ runs:
4545
ref: ${{ inputs.config-ref }}
4646
path: github-actions-config
4747

48+
- name: Check if commercial repository
49+
id: is-commercial
50+
uses: spring-cloud/spring-cloud-github-actions/.github/actions/is-commercial-repo@main
51+
with:
52+
repository: ${{ inputs.repository }}
53+
4854
- name: Determine branches and JDK versions
4955
id: determine-matrix
5056
shell: bash
57+
env:
58+
IS_COMMERCIAL: ${{ steps.is-commercial.outputs.commercial }}
59+
BASE_REPO_NAME: ${{ steps.is-commercial.outputs.base-repo-name }}
5160
run: |
5261
echo "=== Workflow Debug Information ==="
5362
echo "Event name: ${{ inputs.event-name }}"
@@ -56,17 +65,8 @@ runs:
5665
echo "Branch input: ${{ inputs.branches }}"
5766
echo ""
5867
59-
# Extract repository name (without org)
60-
FULL_REPO="${{ inputs.repository }}"
61-
REPO_NAME="${FULL_REPO#*/}"
62-
echo "Repository name: $REPO_NAME"
63-
64-
# Check if this is a commercial repository
65-
IS_COMMERCIAL=false
66-
BASE_REPO_NAME="$REPO_NAME"
67-
if [[ "$REPO_NAME" == *"-commercial" ]]; then
68-
IS_COMMERCIAL=true
69-
BASE_REPO_NAME="${REPO_NAME%-commercial}"
68+
echo "Repository name: $BASE_REPO_NAME"
69+
if [[ "$IS_COMMERCIAL" == "true" ]]; then
7070
echo "Commercial repository detected, base name: $BASE_REPO_NAME"
7171
fi
7272
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
# Extract BOM Versions Action
2+
3+
Fetches the Spring Cloud release train BOM (`pom.xml`) directly from GitHub
4+
and exports all version properties (entries ending in `.version`) as both
5+
action outputs and environment variables for use in subsequent workflow steps.
6+
7+
Supports both the public OSS BOM (`spring-cloud-release`) and the private
8+
commercial BOM (`spring-cloud-release-commercial`).
9+
10+
## Usage
11+
12+
### OSS (public repo — no token required)
13+
14+
```yaml
15+
- name: Extract versions from Spring Cloud BOM
16+
id: extract-versions
17+
uses: spring-cloud/spring-cloud-github-actions/.github/actions/extract-bom-versions@main
18+
with:
19+
ref: '2023.0.x'
20+
21+
# Access as a JSON output via fromJSON()
22+
- name: Print Spring Boot version
23+
run: |
24+
echo "Spring Boot: ${{ fromJSON(steps.extract-versions.outputs.versions)['spring-boot'] }}"
25+
26+
# Or use the exported environment variables directly in shell steps
27+
- name: Update POM versions
28+
run: |
29+
mvn versions:set -DnewVersion=$RELEASE_TRAIN_VERSION
30+
mvn versions:set-property -Dproperty=spring-boot.version -DnewValue=$SPRING_BOOT_VERSION
31+
```
32+
33+
### Commercial (private repo — token required)
34+
35+
```yaml
36+
- name: Extract versions from commercial Spring Cloud BOM
37+
id: extract-versions
38+
uses: spring-cloud/spring-cloud-github-actions/.github/actions/extract-bom-versions@main
39+
with:
40+
ref: '2023.0.x'
41+
commercial: 'true'
42+
token: ${{ secrets.COMMERCIAL_GITHUB_TOKEN }}
43+
```
44+
45+
## Inputs
46+
47+
| Input | Required | Default | Description |
48+
|-------|----------|---------|-------------|
49+
| `ref` | No | `main` | Branch, tag, or SHA to fetch the BOM from (e.g. `2023.0.x`, `2024.0.x`). |
50+
| `commercial` | No | `false` | When `true`, fetches from `spring-cloud-release-commercial`. A `token` with access to that private repo must be supplied. |
51+
| `token` | No* | `github.token` | GitHub token for fetching the BOM. *Required when `commercial` is `true`. |
52+
53+
## Outputs
54+
55+
| Output | Description |
56+
|--------|-------------|
57+
| `versions` | JSON object of all extracted versions keyed by project name, e.g. `{"spring-boot":"3.2.3","spring-cloud-config":"4.1.1"}` |
58+
59+
## Environment Variables
60+
61+
In addition to the `versions` JSON output, each extracted version is also
62+
exported as an environment variable for convenience in shell steps.
63+
64+
Naming convention: `{PROJECT_NAME}_VERSION` (upper snake case)
65+
66+
| BOM property | Environment variable |
67+
|--------------|----------------------|
68+
| `<version>` (release train) | `RELEASE_TRAIN_VERSION` |
69+
| `<spring-boot.version>` | `SPRING_BOOT_VERSION` |
70+
| `<spring-cloud-config.version>` | `SPRING_CLOUD_CONFIG_VERSION` |
71+
| `<spring-cloud-gateway.version>` | `SPRING_CLOUD_GATEWAY_VERSION` |
72+
| `<spring-cloud-kubernetes.version>` | `SPRING_CLOUD_KUBERNETES_VERSION` |
73+
| *(and so on for every `.version` property in the BOM)* | |
74+
75+
## Development
76+
77+
### Prerequisites
78+
79+
- Node.js 20+
80+
- npm
81+
82+
### Setup
83+
84+
```bash
85+
cd .github/actions/extract-bom-versions
86+
npm install
87+
```
88+
89+
### Running Unit Tests
90+
91+
Unit tests use Jest and run entirely locally — no GitHub Actions context needed:
92+
93+
```bash
94+
npm test
95+
96+
# With coverage report
97+
npm run test:coverage
98+
```
99+
100+
### Building the Dist Bundle
101+
102+
The `dist/index.js` bundle **must be rebuilt and committed** whenever
103+
`src/index.js` is changed. The `dist-up-to-date` CI job will fail on PRs
104+
if you forget.
105+
106+
```bash
107+
npm run build
108+
git add dist/index.js
109+
git commit -m "chore: rebuild dist"
110+
```
111+
112+
### Integration Testing
113+
114+
Push your branch to GitHub and the `Test - Extract BOM Versions` workflow will
115+
run automatically, executing the full integration test against the real
116+
Spring Cloud BOM.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project>
3+
<groupId>org.springframework.cloud</groupId>
4+
<artifactId>spring-cloud-dependencies</artifactId>
5+
<version>2023.0.0</version>
6+
<packaging>pom</packaging>
7+
8+
<properties>
9+
<spring-boot.version>3.2.0</spring-boot.version>
10+
</properties>
11+
</project>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project>
3+
<groupId>org.springframework.cloud</groupId>
4+
<artifactId>spring-cloud-dependencies</artifactId>
5+
<version>2023.0.0</version>
6+
<packaging>pom</packaging>
7+
</project>
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<groupId>org.springframework.cloud</groupId>
8+
<artifactId>spring-cloud-dependencies</artifactId>
9+
<version>2023.0.1</version>
10+
<packaging>pom</packaging>
11+
12+
<properties>
13+
<spring-boot.version>3.2.3</spring-boot.version>
14+
<spring-cloud-build.version>4.1.2</spring-cloud-build.version>
15+
<spring-cloud-config.version>4.1.1</spring-cloud-config.version>
16+
<spring-cloud-bus.version>4.1.1</spring-cloud-bus.version>
17+
<spring-cloud-commons.version>4.1.1</spring-cloud-commons.version>
18+
<spring-cloud-circuitbreaker.version>3.1.1</spring-cloud-circuitbreaker.version>
19+
<spring-cloud-gateway.version>4.1.2</spring-cloud-gateway.version>
20+
<spring-cloud-kubernetes.version>3.1.1</spring-cloud-kubernetes.version>
21+
<spring-cloud-openfeign.version>4.1.1</spring-cloud-openfeign.version>
22+
<spring-cloud-sleuth.version>3.1.9</spring-cloud-sleuth.version>
23+
<spring-cloud-stream.version>4.1.1</spring-cloud-stream.version>
24+
<spring-cloud-vault.version>4.1.1</spring-cloud-vault.version>
25+
<spring-cloud-zookeeper.version>4.1.0</spring-cloud-zookeeper.version>
26+
<!-- These properties should be ignored (do not end in .version) -->
27+
<java.compiler.release>17</java.compiler.release>
28+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
29+
</properties>
30+
31+
</project>

0 commit comments

Comments
 (0)