Skip to content

Commit 7d5e851

Browse files
Move managed version detection into action
1 parent 17b92dd commit 7d5e851

3 files changed

Lines changed: 48 additions & 6 deletions

File tree

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: managed-version
2+
description: Obtain a managed version
3+
4+
inputs:
5+
version:
6+
description: 'Version to look up for managed one'
7+
required: true
8+
default: 'latest'
9+
managed-versions:
10+
description: 'manged version json'
11+
required: true
12+
key:
13+
description: 'the key to lookup'
14+
required: true
15+
default: '.database.mongodb'
16+
17+
outputs:
18+
managed-version:
19+
description: "The managed version"
20+
value: ${{ steps.determine-managed-version.outputs.managed-version }}
21+
22+
runs:
23+
using: composite
24+
steps:
25+
- name: Obtain Managed Version
26+
id: determine-managed-version
27+
shell: bash
28+
run: |
29+
MANAGED_VERSION=$(echo ${{inputs.managed-versions}} | jq -r '${{inputs.key}}["${{inputs.version}}"]')
30+
if [[ -z "$MANAGED_VERSION" ]] || [[ "$MANAGED_VERSION" == "null" ]]; then
31+
MANAGED_VERSION=${{inputs.version}}
32+
fi
33+
echo "managed-version=$MANAGED_VERSION" >> $GITHUB_OUTPUT
34+

.github/workflows/ci.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,17 @@ jobs:
2323
with:
2424
java-version: ${{ matrix.java-version }}
2525
develocity-access-key: '${{ secrets.DEVELOCITY_ACCESS_KEY }}'
26+
- name: Mongo Version
27+
id: determine-mongo-version
28+
uses: ./.github/actions/managed-version
29+
with:
30+
managed-versions: ${CONFIG_JSON}
31+
key: '.database.mongodb'
32+
version: '${{ matrix.mongo-version }}'
2633
- name: Initialize MongoDB
2734
uses: ./.github/actions/mongodb/
2835
with:
29-
mongo-version: ${{ matrix.mongo-version }}
36+
mongo-version: ${{ steps.determine-mongo-version.outputs.managed-version }}
3037
replica-set: 'rs0'
3138
- name: Build
3239
uses: spring-projects/spring-data-release/actions/maven-build@main

.github/workflows/snapshots.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,15 @@ jobs:
2020
develocity-access-key: '${{ secrets.DEVELOCITY_ACCESS_KEY }}'
2121
- name: Mongo Version
2222
id: determine-mongo-version
23-
run: |
24-
MONGO_VERSION=$(echo ${CONFIG_JSON} | jq -r '.database.mongodb["latest"]')
25-
echo "$MONGO_VERSION"
26-
echo "MONGO_VERSION=$MONGO_VERSION" >> $GITHUB_OUTPUT
23+
uses: ./.github/actions/managed-version
24+
with:
25+
managed-versions: ${CONFIG_JSON}
26+
key: '.database.mongodb'
27+
version: 'latest'
2728
- name: Initialize MongoDB
2829
uses: ./.github/actions/mongodb/
2930
with:
30-
mongo-version: ${{ steps.determine-mongo-version.outputs.MONGO_VERSION }}
31+
mongo-version: ${{ steps.determine-mongo-version.outputs.managed-version }}
3132
replica-set: 'rs0'
3233
- name: Deploy to Artifactory
3334
uses: spring-projects/spring-data-release/actions/maven-artifactory-deploy@main

0 commit comments

Comments
 (0)