File tree Expand file tree Collapse file tree 2 files changed +31
-8
lines changed
Expand file tree Collapse file tree 2 files changed +31
-8
lines changed Original file line number Diff line number Diff line change @@ -3,14 +3,12 @@ name: "CI/CD pull request"
33# The total recommended execution time for the "CI/CD Pull Request" workflow is around 20 minutes.
44
55on :
6- push :
7- branches :
8- - " **"
96 pull_request :
10- types : [opened, reopened]
7+ types : [opened, synchronize, reopened]
118
129jobs :
1310 metadata :
11+ if : github.event.pull_request.draft == false
1412 name : " Set CI/CD metadata"
1513 runs-on : ubuntu-latest
1614 timeout-minutes : 1
6967 make list-variables
7068 commit-stage : # Recommended maximum execution time is 2 minutes
7169 name : " Commit stage"
70+ if : github.event.pull_request.draft == false
7271 needs : [metadata]
7372 uses : ./.github/workflows/stage-1-commit.yaml
7473 with :
8281 secrets : inherit
8382 test-stage : # Recommended maximum execution time is 5 minutes
8483 name : " Test stage"
84+ if : github.event.pull_request.draft == false
8585 needs : [metadata, commit-stage]
8686 uses : ./.github/workflows/stage-2-test.yaml
8787 with :
Original file line number Diff line number Diff line change 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
2231jobs :
2332 metadata :
7079 timeout-minutes : 10
7180 permissions :
7281 id-token : write
73- contents : read
82+ contents : write
7483 steps :
7584 - name : " Setup Terraform"
7685 uses : hashicorp/setup-terraform@v3
@@ -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
You can’t perform that action at this time.
0 commit comments