Skip to content

Commit f50f7c8

Browse files
committed
feat: add support for --changelog-to-stdout
1 parent 1ee6cbb commit f50f7c8

File tree

4 files changed

+29
-9
lines changed

4 files changed

+29
-9
lines changed

.github/workflows/bumpversion.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,11 @@ jobs:
1818
uses: commitizen-tools/commitizen-action@master
1919
with:
2020
github_token: ${{ secrets.GITHUB_TOKEN }}
21+
changelog_increment_filename: body.md
22+
- name: Release
23+
uses: softprops/action-gh-release@v1
24+
with:
25+
body_path: "body.md"
26+
tag_name: ${{ env.REVISION }}
27+
env:
28+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

README.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,15 @@ jobs:
6161
6262
## Variables
6363
64-
| Name | Description | Default |
65-
| -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------- |
66-
| `github_token` | Token for the repo. Can be passed in using `${{ secrets.GITHUB_TOKEN }}` **required** | - |
67-
| `dry_run` | Run without creating commit, output to stdout | false |
68-
| `repository` | Repository name to push. Default or empty value represents current github repository | current one |
69-
| `branch` | Destination branch to push changes | `master` |
70-
| `prerelease` | Set as prerelease {alpha,beta,rc} choose type of prerelease | - |
71-
| `extra_requirements` | Custom requirements, if your project uses a custom rule or plugins, you can specify them separated by a space. E.g: `'commitizen-emoji conventional-JIRA'` | - |
64+
| Name | Description | Default |
65+
| ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------- |
66+
| `github_token` | Token for the repo. Can be passed in using `${{ secrets.GITHUB_TOKEN }}` **required** | - |
67+
| `dry_run` | Run without creating commit, output to stdout | false |
68+
| `repository` | Repository name to push. Default or empty value represents current github repository | current one |
69+
| `branch` | Destination branch to push changes | `master` |
70+
| `prerelease` | Set as prerelease {alpha,beta,rc} choose type of prerelease | - |
71+
| `extra_requirements` | Custom requirements, if your project uses a custom rule or plugins, you can specify them separated by a space. E.g: `'commitizen-emoji conventional-JIRA'` | - |
72+
| `changelog_increment_filename` | Filename to store the incremented generated changelog. This is different to changelog as it only contains the changes for the just generated version. Example: `body.md` | - |
7273

7374
<!-- | `changelog` | Create changelog when bumping the version | true | -->
7475

action.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,6 @@ inputs:
3232
description: 'Extra commitizen dependencies like your custom plugins or rules'
3333
required: false
3434
default: ''
35+
changelog_increment_filename:
36+
description: 'Filename to store the incremented generated changelog. This is different to changelog as it only contains the changes for the just generated version'
37+
required: false

entrypoint.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,16 @@ git config --local user.name "GitHub Action"
3030

3131

3232
echo "Running cz: $INPUT_DRY_RUN $INPUT_CHANGELOG $INPUT_PRERELEASE"
33-
cz bump --yes $INPUT_DRY_RUN $INPUT_CHANGELOG $INPUT_PRERELEASE
3433

34+
if [ $INPUT_CHANGELOG_INCREMENT_FILENAME ];
35+
then
36+
cz bump --yes --changelog-to-stdout $INPUT_DRY_RUN $INPUT_CHANGELOG $INPUT_PRERELEASE > $INPUT_CHANGELOG_INCREMENT_FILENAME;
37+
else
38+
cz bump --yes $INPUT_DRY_RUN $INPUT_CHANGELOG $INPUT_PRERELEASE;
39+
fi
40+
41+
export REV=`cz version --project`
42+
echo "REVISION=$REV" >> $GITHUB_ENV
3543

3644
echo "Pushing to branch..."
3745
remote_repo="https://${GITHUB_ACTOR}:${INPUT_GITHUB_TOKEN}@github.com/${REPOSITORY}.git"

0 commit comments

Comments
 (0)