Workflow file for this run
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: Generate Release Notes and Create Draft Release | |
on: | |
push: | |
tags: | |
- "*" | |
jobs: | |
generate-release-notes: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Get Previous Tag | |
id: prev_tag | |
run: | | |
echo "::set-output name=previous_tag::$(git describe --abbrev=0 --tags $(git rev-list --tags --skip=1 --max-count=1))" | |
- name: Generate Changelog Content Debug | |
id: generate_changelog | |
run: | | |
echo "::group::Generating Changelog" | |
git log --pretty=format:"* %s (%cn)" ${{ steps.prev_tag.outputs.previous_tag }}..${{ github.ref }} > changelog.txt | |
cat changelog.txt | |
echo "::endgroup::" | |
echo "::set-output name=changelog_file::changelog.txt" | |
- name: Extract Changelog Content | |
id: extract_changelog | |
run: | | |
changelog_content="" | |
while IFS= read -r line; do | |
changelog_content="$changelog_content$line\n" | |
done < ${{ steps.generate_changelog.outputs.changelog_file }} | |
echo "::set-output name=changelog_content::$changelog_content" | |
- name: Create Draft Release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: "Release Notes for ${{ github.ref }}" | |
body: | | |
${{ steps.extract_changelog.outputs.changelog_content }} | |
draft: true |