mirror of
https://github.com/orhun/git-cliff-action.git
synced 2026-03-22 07:25:43 +08:00
feat(action): add output for the latest version (#12)
* feat: output `version` of the latest release * update readme
This commit is contained in:
4
.github/workflows/main.yml
vendored
4
.github/workflows/main.yml
vendored
@@ -16,8 +16,10 @@ jobs:
|
|||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
config: fixtures/cliff.toml
|
config: fixtures/cliff.toml
|
||||||
args: --verbose --strip 'footer' --exclude-path '.github/**'
|
args: --verbose --strip 'footer' --exclude-path '.github/**' --tag 0.0.0
|
||||||
env:
|
env:
|
||||||
OUTPUT: fixtures/CHANGELOG.md
|
OUTPUT: fixtures/CHANGELOG.md
|
||||||
- name: Print the changelog
|
- name: Print the changelog
|
||||||
run: cat "${{ steps.git-cliff.outputs.changelog }}"
|
run: cat "${{ steps.git-cliff.outputs.changelog }}"
|
||||||
|
- name: Print the version
|
||||||
|
run: echo "${{ steps.git-cliff.outputs.version }}"
|
||||||
|
|||||||
@@ -13,4 +13,6 @@ COPY README.md /
|
|||||||
COPY LICENSE /
|
COPY LICENSE /
|
||||||
COPY entrypoint.sh /entrypoint.sh
|
COPY entrypoint.sh /entrypoint.sh
|
||||||
|
|
||||||
|
RUN apt-get update && apt-get install -y jq && rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
ENTRYPOINT ["/entrypoint.sh"]
|
ENTRYPOINT ["/entrypoint.sh"]
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ This action generates a changelog based on your Git history using [git-cliff](ht
|
|||||||
|
|
||||||
- `changelog`: Output file that contains the generated changelog.
|
- `changelog`: Output file that contains the generated changelog.
|
||||||
- `content`: Content of the changelog.
|
- `content`: Content of the changelog.
|
||||||
|
- `version`: Version of the latest release.
|
||||||
|
|
||||||
### Environment variables
|
### Environment variables
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ outputs:
|
|||||||
description: "output file"
|
description: "output file"
|
||||||
content:
|
content:
|
||||||
description: "content of the changelog"
|
description: "content of the changelog"
|
||||||
|
version:
|
||||||
|
description: "version of the latest release"
|
||||||
runs:
|
runs:
|
||||||
using: "docker"
|
using: "docker"
|
||||||
image: "Dockerfile"
|
image: "Dockerfile"
|
||||||
|
|||||||
@@ -19,6 +19,10 @@ args=$(echo "$@" | xargs)
|
|||||||
GIT_CLIFF_OUTPUT="$OUTPUT" git-cliff $args
|
GIT_CLIFF_OUTPUT="$OUTPUT" git-cliff $args
|
||||||
exit_code=$?
|
exit_code=$?
|
||||||
|
|
||||||
|
# Retrieve context
|
||||||
|
CONTEXT="$(mktemp)"
|
||||||
|
GIT_CLIFF_OUTPUT="$CONTEXT" git-cliff $args --context
|
||||||
|
|
||||||
# Output to console
|
# Output to console
|
||||||
cat "$OUTPUT"
|
cat "$OUTPUT"
|
||||||
|
|
||||||
@@ -33,5 +37,8 @@ echo "EOF" >>$GITHUB_OUTPUT
|
|||||||
# Set output file
|
# Set output file
|
||||||
echo "changelog=$OUTPUT" >>$GITHUB_OUTPUT
|
echo "changelog=$OUTPUT" >>$GITHUB_OUTPUT
|
||||||
|
|
||||||
|
# Set the version output to the version of the latest release
|
||||||
|
echo "version=$(jq -r '.[0].version' $CONTEXT)" >>$GITHUB_OUTPUT
|
||||||
|
|
||||||
# Pass exit code to the next step
|
# Pass exit code to the next step
|
||||||
echo "exit_code=$exit_code" >>$GITHUB_OUTPUT
|
echo "exit_code=$exit_code" >>$GITHUB_OUTPUT
|
||||||
|
|||||||
Reference in New Issue
Block a user