Skip to content

Commit

Permalink
Add action for towncrier build draft changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
MetRonnie committed May 14, 2024
1 parent eac09da commit ba4be0f
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions towncrier-draft/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Towncrier - draft changelog
description: Draft the changelog for the next release. Write the output to the GH Actions job summary.

runs:
using: composite
steps:
- name: Install Towncrier if needed
shell: bash
run: python3 -m pip install -q towncrier

- name: Get package version if NodeJS project
id: node
shell: bash
run: |
if [[ -f package.json ]]; then
echo "version=$(node -p "require('./package.json').version")" >> "$GITHUB_OUTPUT"
fi
- name: Draft changelog
shell: bash
env:
VER: ${{ steps.node.outputs.version }}
run: |
CMD="towncrier build --draft --date=CCYY-MM-DD"
if [[ -n "$VER" ]]; then
CMD="$CMD --version $VER"
fi
echo -e "# Draft changelog\n" >> "$GITHUB_STEP_SUMMARY"
$CMD | tee -a "$GITHUB_STEP_SUMMARY"

0 comments on commit ba4be0f

Please sign in to comment.