Skip to content

Commit 22cc3e0

Browse files
authored
Feat/prevent auto major minor release (#53)
* Prevent automatic major/minor release Signed-off-by: Thijs Baaijen <[email protected]> * disable code for debug Signed-off-by: Thijs Baaijen <[email protected]> * update echo Signed-off-by: Thijs Baaijen <[email protected]> * bump to 1.3 for test Signed-off-by: Thijs Baaijen <[email protected]> * revert version bump Signed-off-by: Thijs Baaijen <[email protected]> * enable all code Signed-off-by: Thijs Baaijen <[email protected]> --------- Signed-off-by: Thijs Baaijen <[email protected]>
1 parent 84032fc commit 22cc3e0

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

.github/workflows/build-test-and-sonar.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,28 @@ jobs:
152152
name: power-grid-model-ds
153153
path: wheelhouse/
154154

155+
- name: Checkout source code
156+
if: (github.event_name == 'push')
157+
uses: actions/checkout@v4 # needed by 'Prevent automatic major/minor release'
158+
159+
- name: Prevent automatic major/minor release
160+
if: (github.event_name == 'push')
161+
run: |
162+
echo "Fetching the latest release..."
163+
tag=$(gh release view --json tagName --jq '.tagName')
164+
tag=${tag#v} # Remove the leading 'v'
165+
major_minor=$(echo "$tag" | cut -d. -f1,2)
166+
version_file=$(cat VERSION)
167+
168+
if [ "$major_minor" = "$version_file" ]; then
169+
echo "Patch release detected. Proceeding with automatic release."
170+
else
171+
echo "Cannot automatically release a new major/minor version. Please trigger manually if desired."
172+
exit 1
173+
fi
174+
env:
175+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
176+
155177
- name: Upload wheels
156178
if: (github.event_name == 'push') || ((github.event_name == 'workflow_dispatch') && (github.event.inputs.create_release == 'true'))
157179
run: |

0 commit comments

Comments
 (0)