-
Notifications
You must be signed in to change notification settings - Fork 1
47 lines (41 loc) · 1.53 KB
/
spring-find-release-version.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
name: Find Current Version to Release
on:
workflow_call:
outputs:
releaseVersion:
description: Current Milestone to release
value: ${{ jobs.find-release-version.outputs.releaseVersion }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
find-release-version:
runs-on: ubuntu-latest
outputs:
releaseVersion: ${{ steps.release-version.outputs.releaseVersion }}
steps:
- uses: actions/checkout@v4
with:
show-progress: false
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
- name: Find Current Version to Release
id: release-version
run: |
if test -f pom.xml
then
CURRENT_VERSION=$(mvn help:evaluate -Dexpression="project.version" -q -DforceStdout)
else
CURRENT_VERSION=$(cat gradle.properties | sed -n '/^version=/ { s/^version=//;p }')
fi
export CANDIDATE_VERSION=${CURRENT_VERSION/-SNAPSHOT}
RELEASE_VERSION=$(gh api repos/$GITHUB_REPOSITORY/milestones --jq 'map(select(.due_on != null and (.title | startswith(env.CANDIDATE_VERSION)))) | .[0] | .title')
if [ -z $RELEASE_VERSION ]
then
gh run cancel ${{ github.run_id }}
echo "::warning title=Nothing to release::No scheduled milestone for $CURRENT_VERSION version"
else
echo releaseVersion=$RELEASE_VERSION >> $GITHUB_OUTPUT
echo "::notice title=RELEASE VERSION::$RELEASE_VERSION"
fi