Skip to content

Commit 54beb85

Browse files
committed
feat: use commitizen ver
1 parent bd7e713 commit 54beb85

File tree

1 file changed

+100
-59
lines changed

1 file changed

+100
-59
lines changed

.github/workflows/bump.yaml

Lines changed: 100 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ jobs:
3232
name: 'Bump Version'
3333
runs-on: ubuntu-latest
3434
outputs:
35-
nextStrict: ${{ steps.get_next_version.outputs.nextStrict }}
35+
# nextStrict: ${{ steps.get_next_version.outputs.nextStrict }}
36+
version-current: ${{ steps.version-current.outputs.value-out }}
37+
version-new: ${{ steps.version-new.outputs.value-out }}
3638
steps:
3739

3840

@@ -56,14 +58,14 @@ jobs:
5658
ref: ${{ github.ref_name }}
5759

5860

59-
- name: Get Next Version
60-
id: get_next_version
61-
uses: ietf-tools/semver-action@v1
62-
with:
63-
token: ${{ github.token }}
64-
branch: ${{ github.ref_name }}
65-
noVersionBumpBehavior: warn
66-
noNewCommitBehavior: warn
61+
# - name: Get Next Version
62+
# id: get_next_version
63+
# uses: ietf-tools/semver-action@v1
64+
# with:
65+
# token: ${{ github.token }}
66+
# branch: ${{ github.ref_name }}
67+
# noVersionBumpBehavior: warn
68+
# noNewCommitBehavior: warn
6769

6870
# - name: Get next version
6971
# id: get_next_version
@@ -72,15 +74,15 @@ jobs:
7274
# prefix: 'v' # optional, defaults to ''
7375

7476

75-
- name: Show the next version
76-
if: success() || failure()
77-
run: |
78-
echo ${{ steps.get_next_version.outputs.current }};
79-
echo ${{ steps.get_next_version.outputs.next }};
80-
echo ${{ steps.get_next_version.outputs.nextMajor }};
81-
echo ${{ steps.get_next_version.outputs.nextStrict }};
82-
echo ${{ steps.get_next_version.outputs.nextMajorStrict }};
83-
echo ${{ steps.get_next_version.outputs.bump }};
77+
# - name: Show the next version
78+
# if: success() || failure()
79+
# run: |
80+
# echo ${{ steps.get_next_version.outputs.current }};
81+
# echo ${{ steps.get_next_version.outputs.next }};
82+
# echo ${{ steps.get_next_version.outputs.nextMajor }};
83+
# echo ${{ steps.get_next_version.outputs.nextStrict }};
84+
# echo ${{ steps.get_next_version.outputs.nextMajorStrict }};
85+
# echo ${{ steps.get_next_version.outputs.bump }};
8486

8587

8688
- name: Install Commitizen
@@ -89,6 +91,13 @@ jobs:
8991
pip install \
9092
commitizen==3.28.0
9193
94+
95+
- name: Fetch Current Version
96+
id: version-current
97+
run: |
98+
echo "value-out=$(cz version --project)" >> $GITHUB_OUTPUT
99+
100+
92101
# - name: Configure git
93102
# shell: bash
94103
# run: |
@@ -102,6 +111,36 @@ jobs:
102111
# run: |
103112
# cz changelog --incremental --dry-run --unreleased-version
104113

114+
- name: Increment version with .cz.yaml
115+
shell: bash
116+
run: |
117+
if [ "${{ inputs.CZ_PRE_RELEASE }}" != 'none' ]; then
118+
119+
echo "[debug] Pre-Release detected: ${{ inputs.CZ_PRE_RELEASE }}";
120+
121+
export pre_release="--prerelease ${{ inputs.CZ_PRE_RELEASE }}";
122+
123+
fi;
124+
125+
if [ "${{ inputs.CZ_INCREMENT }}" != 'none' ]; then
126+
127+
echo "[debug] Pre-Release detected: ${{ inputs.CZ_INCREMENT }}";
128+
129+
export increment="--increment ${{ inputs.CZ_INCREMENT }}";
130+
131+
fi;
132+
133+
cz bump \
134+
--files-only \
135+
${pre_release} \
136+
${increment} \
137+
--yes;
138+
139+
140+
- name: Fetch Current Version
141+
id: version-new
142+
run: |
143+
echo "value-out=$(cz version --project)" >> $GITHUB_OUTPUT
105144
106145
107146
- name: ls
@@ -115,14 +154,16 @@ jobs:
115154
# if: ${{ github.ref_name != 'master' }}
116155
shell: bash
117156
run: |
118-
cz changelog --dry-run --incremental --unreleased-version "${{ steps.get_next_version.outputs.nextStrict }}" > changelog-release.md
157+
cz changelog --dry-run --incremental --unreleased-version "${{ steps.version-new.outputs.value-out }}" > changelog-release.md
119158
120159
121160
- name: Update Changelog
122-
if: ${{ github.ref_name != 'master' }}
161+
# if: ${{ github.ref_name != 'master' }}
123162
shell: bash
124163
run: |
125-
cz changelog --unreleased-version "${{ steps.get_next_version.outputs.nextStrict }}"
164+
cz changelog --unreleased-version "${{ steps.version-new.outputs.value-out }}"
165+
166+
126167
127168
128169
@@ -143,30 +184,30 @@ jobs:
143184

144185

145186

146-
- name: Incremennt version with .cz.yaml
147-
shell: bash
148-
run: |
149-
if [ "${{ inputs.CZ_PRE_RELEASE }}" != 'none' ]; then
187+
# - name: Increment version with .cz.yaml
188+
# shell: bash
189+
# run: |
190+
# if [ "${{ inputs.CZ_PRE_RELEASE }}" != 'none' ]; then
150191

151-
echo "[debug] Pre-Release detected: ${{ inputs.CZ_PRE_RELEASE }}";
192+
# echo "[debug] Pre-Release detected: ${{ inputs.CZ_PRE_RELEASE }}";
152193

153-
export pre_release="--prerelease ${{ inputs.CZ_PRE_RELEASE }}";
194+
# export pre_release="--prerelease ${{ inputs.CZ_PRE_RELEASE }}";
154195

155-
fi;
196+
# fi;
156197

157-
if [ "${{ inputs.CZ_INCREMENT }}" != 'none' ]; then
198+
# if [ "${{ inputs.CZ_INCREMENT }}" != 'none' ]; then
158199

159-
echo "[debug] Pre-Release detected: ${{ inputs.CZ_INCREMENT }}";
200+
# echo "[debug] Pre-Release detected: ${{ inputs.CZ_INCREMENT }}";
160201

161-
export increment="--increment ${{ inputs.CZ_INCREMENT }}";
202+
# export increment="--increment ${{ inputs.CZ_INCREMENT }}";
162203

163-
fi;
204+
# fi;
164205

165-
cz bump \
166-
--files-only \
167-
${pre_release} \
168-
${increment} \
169-
--yes;
206+
# cz bump \
207+
# --files-only \
208+
# ${pre_release} \
209+
# ${increment} \
210+
# --yes;
170211

171212

172213
# - name: Get previous tag
@@ -245,28 +286,28 @@ jobs:
245286

246287

247288
- name: Upload Release Changelog
248-
if: ${{ steps.get_next_version.outputs.nextStrict }}
289+
if: ${{ steps.version-new.outputs.value-out }}
249290
uses: actions/upload-artifact@v4
250291
with:
251292
name: changelog-release
252293
path: changelog-release.md
253294

254295

255296
- name: Create Release Changelog
256-
if: ${{ steps.get_next_version.outputs.nextStrict }}
297+
if: ${{ steps.version-new.outputs.value-out }}
257298
shell: bash
258299
run: |
259300
rm changelog-release.md;
260301
git status;
261302
262303
263304
- name: Commit the changelog
264-
if: ${{ steps.get_next_version.outputs.nextStrict && github.ref_name == 'master' }}
305+
if: ${{ steps.version-new.outputs.value-out && github.ref_name == 'master' }}
265306
uses: stefanzweifel/git-auto-commit-action@v5
266307
with:
267308
# Optional. Commit message for the created commit.
268309
# Defaults to "Apply automatic changes"
269-
commit_message: 'build: bump version ${{ steps.get_next_version.outputs.current }} -> ${{ steps.get_next_version.outputs.nextStrict }}'
310+
commit_message: 'build: bump version ${{ steps.get_next_version.outputs.current }} -> ${{ steps.version-new.outputs.value-out }}'
270311

271312
# Optional. Local and remote branch name where commit is going to be pushed
272313
# to. Defaults to the current branch.
@@ -327,12 +368,12 @@ jobs:
327368

328369

329370
- name: Commit the changelog
330-
if: ${{ steps.get_next_version.outputs.nextStrict && github.ref_name != 'master'}}
371+
if: ${{ steps.version-new.outputs.value-out && github.ref_name != 'master'}}
331372
uses: stefanzweifel/git-auto-commit-action@v5
332373
with:
333374
# Optional. Commit message for the created commit.
334375
# Defaults to "Apply automatic changes"
335-
commit_message: 'build: bump version ${{ steps.get_next_version.outputs.current }} -> ${{ steps.get_next_version.outputs.nextStrict }}'
376+
commit_message: 'build: bump version ${{ steps.get_next_version.outputs.current }} -> ${{ steps.version-new.outputs.value-out }}'
336377

337378
# Optional. Local and remote branch name where commit is going to be pushed
338379
# to. Defaults to the current branch.
@@ -361,7 +402,7 @@ jobs:
361402

362403
# Optional. Tag name being created in the local repository and
363404
# pushed to remote repository and defined branch.
364-
# tagging_message: ${{ steps.get_next_version.outputs.nextStrict }}
405+
tagging_message: ${{ steps.version-new.outputs.value-out }}
365406

366407
# Optional. Option used by `git-status` to determine if the repository is
367408
# dirty. See https://git-scm.com/docs/git-status#_options
@@ -393,25 +434,25 @@ jobs:
393434

394435

395436

396-
- name: Update Changelog
397-
if: ${{ github.ref_name != 'master' }}
398-
shell: bash
399-
run: |
400-
git tag ${{ steps.get_next_version.outputs.nextStrict }}
437+
# - name: Update Changelog
438+
# if: ${{ github.ref_name != 'master' }}
439+
# shell: bash
440+
# run: |
441+
# git tag ${{ steps.get_next_version.outputs.nextStrict }}
401442

402-
- name: Update Changelog
403-
if: ${{ github.ref_name != 'master' }}
404-
shell: bash
405-
run: |
406-
git push --tags
443+
# - name: Update Changelog
444+
# if: ${{ github.ref_name != 'master' }}
445+
# shell: bash
446+
# run: |
447+
# git push --tags
407448

408449

409450

410451
release:
411452
needs:
412453
- bump
413454
name: Release
414-
if: ${{ needs.bump.outputs.nextStrict }}
455+
if: ${{ needs.bump.outputs.version-new }}
415456
runs-on: ubuntu-latest
416457
steps:
417458

@@ -428,8 +469,8 @@ jobs:
428469
id: release
429470
uses: softprops/action-gh-release@v2
430471
with:
431-
name: ${{ needs.bump.outputs.nextStrict }}
432-
tag_name: ${{ needs.bump.outputs.nextStrict }}
472+
name: ${{ needs.bump.outputs.version-new }}
473+
tag_name: ${{ needs.bump.outputs.version-new }}
433474
body_path: changelog-release.md
434475
make_latest: true
435476

@@ -438,7 +479,7 @@ jobs:
438479
needs:
439480
- bump
440481
- release
441-
if: ${{ needs.bump.outputs.nextStrict }}
482+
if: ${{ needs.bump.outputs.version-new }}
442483
name: Create Release Label
443484
permissions:
444485
contents: read
@@ -450,7 +491,7 @@ jobs:
450491
mkdir -p .github;
451492
echo "
452493
labels:
453-
v${{ needs.bump.outputs.nextStrict }}:
494+
v${{ needs.bump.outputs.version-new }}:
454495
color: "EEE600"
455496
description: Version Affected.
456497

0 commit comments

Comments
 (0)