Skip to content

Commit c81e6e4

Browse files
committed
docs: update readme with changelog example
1 parent b365e84 commit c81e6e4

2 files changed

Lines changed: 48 additions & 6 deletions

File tree

.github/workflows/Deploy.yaml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
1-
name: Publish latest
1+
name: Create Release
22

33
on:
44
push:
5-
branches:
6-
- main
75
tags:
8-
- "*"
6+
- "v*.*.*"
97

108
jobs:
119
create_release:
1210
name: Publish release
1311
runs-on: ubuntu-latest
14-
if: ${{ github.ref_type == 'tag' }}
1512
steps:
1613
- uses: actions/checkout@v4
1714
with:
@@ -28,5 +25,4 @@ jobs:
2825
uses: softprops/action-gh-release@v2
2926
with:
3027
body: ${{ steps.release.outputs.stdout }}
31-
name: ${{ github.ref_name }}
3228
tag_name: ${{ github.ref_name }}

README.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,45 @@ Note that you probably want to set the `git-user` and `git-user-email` options t
102102
If you are not familiar with how cocogitto perform release, you might want to read the [auto bump](https://github.com/cocogitto/cocogitto#auto-bump)
103103
and [hook](https://github.com/cocogitto/cocogitto#auto-bump) sections on cocogitto's documentation.
104104

105+
## Generating a Changelog
106+
107+
You can also use this action to generate a changelog for your releases.
108+
109+
Here's an example of how to set up a GitHub Actions workflow to generate a changelog when a new tag is pushed:
110+
111+
```yaml
112+
name: Create Release
113+
114+
on:
115+
push:
116+
tags:
117+
- "v*.*.*"
118+
119+
jobs:
120+
create_release:
121+
name: Publish release
122+
runs-on: ubuntu-latest
123+
steps:
124+
- uses: actions/checkout@v4
125+
with:
126+
fetch-depth: 0
127+
128+
- name: SemVer release
129+
id: release
130+
uses: cocogitto/cocogitto-action@main
131+
with:
132+
command: changelog
133+
args: --at ${{ github.ref_name }}
134+
135+
- name: Upload github release
136+
uses: softprops/action-gh-release@v2
137+
with:
138+
body: ${{ steps.release.outputs.stdout }}
139+
tag_name: ${{ github.ref_name }}
140+
```
141+
142+
In this example, the workflow is triggered on a push event when a new tag matching the pattern `v*.*.*` is created. The `cocogitto-action` is used to generate a changelog for the release, and the `softprops/action-gh-release` action is used to create a GitHub release with the generated changelog as the release body.
143+
105144
## Post step run
106145

107146
Once the step is finished cocogitto's binary will be available in your path.
@@ -114,3 +153,10 @@ Here are all the inputs available through `with`:
114153
|-------------|--------------------------------------------------------------------------------------------------|----------------|
115154
| `command` | The cocogitto command to run (e.g., check, release) | (required) |
116155
| `args` | Additional arguments for the cocogitto command | `""` |
156+
157+
The following outputs are available through the GitHub `steps.<step_id>.outputs` context:
158+
159+
| Output | Description | Default |
160+
|-------------|--------------------------------------------------------------------------------------------------|----------------|
161+
| `version` | The new version number after a successful release | `""` |
162+
| `stdout` | The standard output from the cocogitto command | `""` |

0 commit comments

Comments
 (0)