mirror of
https://github.com/orhun/git-cliff-action.git
synced 2026-03-24 08:25:45 +08:00
docs(readme): update examples
This commit is contained in:
41
README.md
41
README.md
@@ -24,12 +24,17 @@ This action generates a changelog based on your Git history using [git-cliff](ht
|
|||||||
The following example fetches the whole Git history (`fetch-depth: 0`), generates a changelog in `./CHANGELOG.md`, and prints it out.
|
The following example fetches the whole Git history (`fetch-depth: 0`), generates a changelog in `./CHANGELOG.md`, and prints it out.
|
||||||
|
|
||||||
```yml
|
```yml
|
||||||
- name: Checkout
|
jobs:
|
||||||
|
changelog:
|
||||||
|
name: Generate changelog
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Generate a changelog
|
- name: Generate a changelog
|
||||||
uses: orhun/git-cliff-action@v1
|
uses: orhun/git-cliff-action@v1
|
||||||
id: git-cliff
|
id: git-cliff
|
||||||
with:
|
with:
|
||||||
@@ -38,7 +43,7 @@ The following example fetches the whole Git history (`fetch-depth: 0`), generate
|
|||||||
env:
|
env:
|
||||||
OUTPUT: CHANGELOG.md
|
OUTPUT: CHANGELOG.md
|
||||||
|
|
||||||
- name: Print the changelog
|
- name: Print the changelog
|
||||||
run: cat "${{ steps.git-cliff.outputs.changelog }}"
|
run: cat "${{ steps.git-cliff.outputs.changelog }}"
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -49,12 +54,19 @@ The following example generates a changelog for the latest pushed tag and sets i
|
|||||||
It uses [svenstaro/upload-release-action](https://github.com/svenstaro/upload-release-action) for uploading the release assets.
|
It uses [svenstaro/upload-release-action](https://github.com/svenstaro/upload-release-action) for uploading the release assets.
|
||||||
|
|
||||||
```yml
|
```yml
|
||||||
- name: Checkout
|
jobs:
|
||||||
|
changelog:
|
||||||
|
name: Generate changelog
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
release_body: ${{ steps.release.outputs.RELEASE_BODY }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Generate a changelog
|
- name: Generate a changelog
|
||||||
uses: orhun/git-cliff-action@v1
|
uses: orhun/git-cliff-action@v1
|
||||||
id: git-cliff
|
id: git-cliff
|
||||||
with:
|
with:
|
||||||
@@ -63,7 +75,7 @@ It uses [svenstaro/upload-release-action](https://github.com/svenstaro/upload-re
|
|||||||
env:
|
env:
|
||||||
OUTPUT: CHANGES.md
|
OUTPUT: CHANGES.md
|
||||||
|
|
||||||
- name: Set the release body
|
- name: Set the release body
|
||||||
id: release
|
id: release
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
@@ -73,13 +85,28 @@ It uses [svenstaro/upload-release-action](https://github.com/svenstaro/upload-re
|
|||||||
r="${r//$'\r'/'%0D'}" # Multiline escape sequences for '\r'
|
r="${r//$'\r'/'%0D'}" # Multiline escape sequences for '\r'
|
||||||
echo "::set-output name=RELEASE_BODY::$r"
|
echo "::set-output name=RELEASE_BODY::$r"
|
||||||
|
|
||||||
- name: Upload the binary releases
|
# use release body in the same job
|
||||||
|
- name: Upload the binary releases
|
||||||
uses: svenstaro/upload-release-action@v2
|
uses: svenstaro/upload-release-action@v2
|
||||||
with:
|
with:
|
||||||
file: binary_release.zip
|
file: binary_release.zip
|
||||||
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
tag: ${{ github.ref }}
|
tag: ${{ github.ref }}
|
||||||
body: ${{ steps.release.outputs.RELEASE_BODY }}
|
body: ${{ steps.release.outputs.RELEASE_BODY }}
|
||||||
|
|
||||||
|
# use release body in another job
|
||||||
|
upload:
|
||||||
|
name: Upload the release
|
||||||
|
needs: changelog
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Upload the binary releases
|
||||||
|
uses: svenstaro/upload-release-action@v2
|
||||||
|
with:
|
||||||
|
file: binary_release.zip
|
||||||
|
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
tag: ${{ github.ref }}
|
||||||
|
body: ${{ needs.changelog.outputs.release_body }}
|
||||||
```
|
```
|
||||||
|
|
||||||
## Credits
|
## Credits
|
||||||
|
|||||||
Reference in New Issue
Block a user