-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Retrieve Spring Supported Versions reusable workflow
Closes gh-16
- Loading branch information
1 parent
29ae5bd
commit ee47571
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: Retrieve Spring Supported Versions | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
project: | ||
description: 'The name of the Spring Project, lowercase separated by dashes, e.g. spring-security' | ||
required: true | ||
type: string | ||
type: | ||
description: 'The type of the support, accepts commercial or oss' | ||
default: 'oss' | ||
required: false | ||
type: string | ||
outputs: | ||
supported_versions: | ||
description: "The supported versions" | ||
value: ${{ jobs.retrieve-supported-versions.outputs.versions }} | ||
|
||
jobs: | ||
retrieve-supported-versions: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
supported_versions: ${{ steps.get-supported-versions.outputs.supported_versions }} | ||
steps: | ||
- id: get-supported-versions | ||
run: | | ||
if [ "${{ inputs.type }}" = "commercial" ] | ||
then | ||
echo "supported_versions=$(curl https://api.spring.io/projects/${{ inputs.project }}/generations | jq --arg current "$(date +%F)" -c '.["_embedded"]["generations"] | map(select((.commercialSupportEndDate + "T00:00:00") > $current and (.ossSupportEndDate + "T00:00:00") < $current))' | jq '.[].name' -r | grep -E '^[6-9]' | paste -sd ',' -)" >> $GITHUB_OUTPUT | ||
else | ||
echo "supported_versions=$(curl https://api.spring.io/projects/${{ inputs.project }}/generations | jq --arg current "$(date +%F)" -c '.["_embedded"]["generations"] | map(select((.ossSupportEndDate + "T00:00:00") > $current))' | jq '.[].name' -r | paste -sd ',' -)" >> $GITHUB_OUTPUT | ||
fi |