Skip to content

Commit 85ea577

Browse files
committed
adding in release type input that changes which part of the version to bump
1 parent 9233fec commit 85ea577

1 file changed

Lines changed: 26 additions & 3 deletions

File tree

.github/workflows/cicd-3-deploy.yaml

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,15 @@ on:
1818
- test
1919
- preprod
2020
- prod
21+
release_type:
22+
description: "Version bump type (patch, minor, major)"
23+
required: false
24+
default: "patch"
25+
type: choice
26+
options:
27+
- patch
28+
- minor
29+
- major
2130

2231
jobs:
2332
metadata:
@@ -124,7 +133,21 @@ jobs:
124133
else
125134
# Extract the version numbers
126135
IFS='.' read -r major minor patch <<< "${latest_tag#v}"
127-
patch=$((patch + 1))
136+
case "${{ github.event.inputs.release_type }}" in
137+
major)
138+
major=$((major + 1))
139+
minor=0
140+
patch=0
141+
;;
142+
minor)
143+
minor=$((minor + 1))
144+
patch=0
145+
;;
146+
patch|*)
147+
patch=$((patch + 1))
148+
;;
149+
esac
150+
128151
next_tag="v${major}.${minor}.${patch}"
129152
fi
130153
@@ -136,8 +159,8 @@ jobs:
136159
env:
137160
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
138161
with:
139-
tag_name: ${{ steps.next_tag.outputs.next_tag }}
140-
release_name: Release ${{ steps.next_tag.outputs.next_tag }}
162+
tag_name: ${{ steps.next_tag.outputs.tag }}
163+
release_name: Release ${{ steps.next_tag.outputs.tag }}
141164
body: |
142165
Auto-release created during deployment.
143166
draft: false

0 commit comments

Comments
 (0)