Create release note. #35
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Create release note. | |
on: | |
push: | |
tags: | |
- "*" | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Extract tag name | |
shell: bash | |
run: echo "RELEASE_VERSION=${GITHUB_REF##*/v}" >> $GITHUB_ENV | |
- name: Extract release notes | |
id: release_notes | |
run: | | |
RELEASE_NOTES="## Version ""$RELEASE_VERSION"$'\n' | |
CURRENT_LINE=0 | |
while IFS= read -r line; do | |
if [[ "$line" == "## [$RELEASE_VERSION] - "* ]]; then | |
CURRENT_LINE=1 | |
elif [[ "$CURRENT_LINE" == 1 && "$line" == "## ["* ]]; then | |
CURRENT_LINE=0 | |
elif [[ "$CURRENT_LINE" == 1 ]]; then | |
RELEASE_NOTES="$RELEASE_NOTES"$'\n'"$line" | |
fi | |
done < "CHANGELOG.md" | |
echo "$RELEASE_NOTES" > release_notes_diff.txt | |
- name: Create Release | |
uses: softprops/action-gh-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: v${{ env.RELEASE_VERSION }} | |
name: v${{ env.RELEASE_VERSION }} | |
body_path: ${{ github.workspace }}/release_notes_diff.txt |