Merge pull request #24 from TriPSs/master

Release clean_changelog
releases/v3
Tycho Bokdam 2020-05-08 10:21:45 +02:00 committed by GitHub
commit e4eeeedc9c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 48 additions and 4 deletions

View File

@ -27,4 +27,9 @@ jobs:
with: with:
tag_name: ${{ steps.changelog.outputs.tag }} tag_name: ${{ steps.changelog.outputs.tag }}
release_name: ${{ steps.changelog.outputs.tag }} release_name: ${{ steps.changelog.outputs.tag }}
body: ${{ steps.changelog.outputs.changelog }} body: ${{ steps.changelog.outputs.clean_changelog }}
- name: Update main tag
uses: Actions-R-Us/actions-tagger@latest
env:
GITHUB_TOKEN: ${{ secrets.github_token }}

View File

@ -8,16 +8,23 @@ This action will bump version, tag commit and generate a changelog with conventi
- **Optional** `git-message`: Commit message that is used when committing the changelog. - **Optional** `git-message`: Commit message that is used when committing the changelog.
- **Optional** `preset`: Preset that is used from conventional commits. Default `angular`. - **Optional** `preset`: Preset that is used from conventional commits. Default `angular`.
- **Optional** `tag-prefix`: Prefix for the git tags. Default `v`. - **Optional** `tag-prefix`: Prefix for the git tags. Default `v`.
- **Optional** `output-file`: File to output the changelog to. Default `CHANGELOG.md`. - **Optional** `output-file`: File to output the changelog to. Default `CHANGELOG.md`, when providing `false` no file will be generated / updated.
- **Optional** `release-count`: Number of releases to preserve in changelog. Default `5`, use `0` to regenerate all. - **Optional** `release-count`: Number of releases to preserve in changelog. Default `5`, use `0` to regenerate all.
- **Optional** `package-json`: The path to the package.json to use. Default `./package.json`. - **Optional** `package-json`: The path to the package.json to use. Default `./package.json`.
## Outputs
- `changelog`: The generated changelog for the new version.
- `clean_changelog`: The generated changelog for the new version without the version name in it (Better for Github releases)
- `version`: The new version.
- `tag`: The name of the generated tag.
## Example usages ## Example usages
Uses all the defaults Uses all the defaults
```yaml ```yaml
- name: Conventional Changelog Action - name: Conventional Changelog Action
uses: TriPSs/conventional-changelog-action@v2.1.0 uses: TriPSs/conventional-changelog-action@v2
with: with:
github-token: ${{ secrets.github_token }} github-token: ${{ secrets.github_token }}
``` ```
@ -25,7 +32,7 @@ Uses all the defaults
Overwrite everything Overwrite everything
```yaml ```yaml
- name: Conventional Changelog Action - name: Conventional Changelog Action
uses: TriPSs/conventional-changelog-action@v2.1.0 uses: TriPSs/conventional-changelog-action@v2
with: with:
github-token: ${{ secrets.github_token }} github-token: ${{ secrets.github_token }}
git-message: 'chore(release): {version}' git-message: 'chore(release): {version}'
@ -35,3 +42,31 @@ Overwrite everything
release-count: '5' release-count: '5'
package-json: './package.json' package-json: './package.json'
``` ```
No file changelog
```yaml
- name: Conventional Changelog Action
uses: TriPSs/conventional-changelog-action@v2
with:
github-token: ${{ secrets.github_token }}
output-file: 'false'
```
Github releases
```yaml
- name: Conventional Changelog Action
id: changelog
uses: TriPSs/conventional-changelog-action@v2
with:
github-token: ${{ secrets.github_token }}
output-file: 'false'
- name: Create Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.github_token }}
with:
tag_name: ${{ steps.changelog.outputs.tag }}
release_name: ${{ steps.changelog.outputs.tag }}
body: ${{ steps.changelog.outputs.clean_changelog }}
```

View File

@ -47,6 +47,8 @@ inputs:
outputs: outputs:
changelog: changelog:
description: 'The generated changelog for the new version' description: 'The generated changelog for the new version'
clean_changelog:
description: 'The generated changelog for the new version without the version name in it'
version: version:
description: 'The new version' description: 'The new version'
tag: tag:

View File

@ -62,6 +62,8 @@ async function run() {
// Set outputs so other actions (for example actions/create-release) can use it // Set outputs so other actions (for example actions/create-release) can use it
core.setOutput('changelog', stringChangelog) core.setOutput('changelog', stringChangelog)
// Removes the version number from the changelog
core.setOutput('clean_changelog', stringChangelog.split('\n').slice(3).join('\n'))
core.setOutput('version', jsonPackage.version) core.setOutput('version', jsonPackage.version)
core.setOutput('tag', `${tagPrefix}${jsonPackage.version}`) core.setOutput('tag', `${tagPrefix}${jsonPackage.version}`)
} }