Skip to content

Commit 1363ade

Browse files
Validate release version input matches build.gradle before releasing
1 parent cabea87 commit 1363ade

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

‎.github/workflows/release.yml‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
workflow_dispatch:
55
inputs:
66
version:
7-
description: 'Release version'
7+
description: 'Release version (must match the version in build.gradle)'
88
required: true
99
dry-run:
1010
description: 'Dry run'
@@ -23,6 +23,18 @@ jobs:
2323
with:
2424
fetch-depth: 0
2525

26+
- name: Verify release version
27+
env:
28+
INPUT_VERSION: ${{ inputs.version }}
29+
run: |
30+
PROJECT_VERSION=$(grep -E "^version = " build.gradle | sed -E "s/version = '(.*)'/\1/")
31+
echo "build.gradle version: $PROJECT_VERSION"
32+
echo "requested version: $INPUT_VERSION"
33+
if [ "$PROJECT_VERSION" != "$INPUT_VERSION" ]; then
34+
echo "::error::Requested version '$INPUT_VERSION' does not match build.gradle version '$PROJECT_VERSION'. Bump build.gradle (and README/CHANGELOG) and commit before releasing."
35+
exit 1
36+
fi
37+
2638
- name: Setup Java
2739
uses: actions/setup-java@v5
2840
with:

0 commit comments

Comments
 (0)