diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..0f5deb1 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,17 @@ +FROM orhunp/git-cliff:latest + +LABEL maintainer="orhun " +LABEL repository="https://github.com/orhun/git-cliff-action" +LABEL homepage="https://github.com/orhun/git-cliff" + +LABEL com.github.actions.name="Changelog Generator" +LABEL com.github.actions.description="Generate changelog based on your Git history" +LABEL com.github.actions.icon="triangle" +LABEL com.github.actions.color="orange" + +COPY README.md / +COPY LICENSE / + +COPY entrypoint.sh /entrypoint.sh + +ENTRYPOINT ["/entrypoint.sh"] diff --git a/README.md b/README.md new file mode 100644 index 0000000..041bc93 --- /dev/null +++ b/README.md @@ -0,0 +1,34 @@ +# git-cliff changelog generator action + +This action generates a changelog based on your Git history using [git-cliff](https://github.com/orhun/git-cliff), on the fly! + +## Usage + +### Inputs + +* `args`: Arguments to pass to git-cliff. Default `"-v"` + +### Outputs + +* `changelog`: The generated changelog. + +### Examples + +``` +- name: Changelog Generator + uses: orhun/git-cliff-action@v1 + with: + args: --verbose +``` + +## Credits + +This action is based on [lycheeverse/lychee-action](https://github.com/lycheeverse/lychee-action) and uses [git-cliff](https://github.com/orhun/git-cliff). + +## License + +GNU General Public License ([v3.0](https://www.gnu.org/licenses/gpl.txt)) + +## Copyright + +Copyright © 2021, [Orhun Parmaksız](mailto:orhunparmaksiz@gmail.com) diff --git a/action.yml b/action.yml new file mode 100644 index 0000000..9c6b110 --- /dev/null +++ b/action.yml @@ -0,0 +1,18 @@ +name: "git-cliff: Changelog Generator" +description: "Generate changelog based on your Git history" +inputs: + args: + description: "git-cliff arguments" + required: false + default: "-v" +outputs: + changelog: + description: 'generated changelog' +runs: + using: "docker" + image: "Dockerfile" + args: + - ${{ inputs.args }} +branding: + icon: "triangle" + color: "orange" diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100755 index 0000000..dda191a --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,21 @@ +#!/bin/bash -l +set -uxo pipefail + +CHANGELOG_OUT=${CHANGELOG_OUT:="git-cliff/CHANGELOG.md"} + +# Create the output directory +mkdir -p "$(dirname $CHANGELOG_OUT)" + +# Execute git-cliff +git-cliff "$@" > "$CHANGELOG_OUT" +exit_code=$? +changelog=$(cat "$CHANGELOG_OUT") + +# Output to console +echo "$changelog" + +# Set output +echo "::set-output name=changelog::$changelog" + +# Pass exit code to the next step +echo ::set-output name=exit_code::$exit_code