Skip to content

Commit e852c88

Browse files
authored
Merge pull request #70 from domaframework/ci/reference-build-version
Get the build version from the latest release draft
2 parents 5ff699e + 31cf4db commit e852c88

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

.github/workflows/build.yml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,26 @@ jobs:
7171
- name: Build Gradle
7272
run: ./gradlew build -x test
7373

74+
- name: Get latest draft release title
75+
run: |
76+
TITLE=$(gh api repos/${{ github.repository }}/releases \
77+
--jq '.[] | select(.draft==true) | .name' | head -n 1)
78+
if [[ -z "$TITLE" ]]; then
79+
echo "No draft release found."
80+
exit 1
81+
fi
82+
VERSION=$(echo "$TITLE" | grep -oE '[0-9]+\.[0-9]+\.[0-9]+')
83+
if [[ -z "$VERSION" ]]; then
84+
echo "No version found in version."
85+
exit 1
86+
fi
87+
echo "Extracted version: $VERSION"
88+
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV
89+
env:
90+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
91+
7492
- name: Build plugin
75-
run: ./gradlew buildPlugin -PpluginVersion=0.3.2-${{ github.run_number }}
93+
run: ./gradlew buildPlugin -PpluginVersion=$RELEASE_VERSION-${{ github.run_number }}
7694

7795
- name: Prepare Plugin Artifact
7896
id: artifact

0 commit comments

Comments
 (0)