From d0767fcce72d160c2dbcd25c5d4c3fa8b1a0af00 Mon Sep 17 00:00:00 2001 From: Nathaniel Graff Date: Mon, 4 May 2020 12:42:02 -0700 Subject: [PATCH] Fix release notes generation with GitHub Action Signed-off-by: Nathaniel Graff --- .github/workflows/release.yml | 11 ++++------- scripts/create-release-notes.sh | 29 ----------------------------- 2 files changed, 4 insertions(+), 36 deletions(-) delete mode 100755 scripts/create-release-notes.sh diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3626bb3..9fd7994 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -27,14 +27,11 @@ jobs: run: git fetch --prune --unshallow - name: 'Create Release Notes' + uses: sifive/action-release-notes@v1 id: create-release-notes - run: | - tag=$(echo ${{ github.ref }} | cut -d '/' -f 3) - release_notes=$(./scripts/create-release-notes.sh ${{ env.PROJECT_NAME }} ${tag}) - # The string passed to Actions must urlencode newlines. - release_notes="${release_notes//$'\n'/'%0A'}" - # Use a magic "workflow command" to set the output for the step. - echo "::set-output name=release-notes::${release_notes}" + with: + project-name: ${{ env.PROJECT_NAME }} + release: ${{ github.ref }} - name: 'Create Release' uses: actions/create-release@v1 diff --git a/scripts/create-release-notes.sh b/scripts/create-release-notes.sh deleted file mode 100755 index 8f85811..0000000 --- a/scripts/create-release-notes.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash -# Copyright (c) 2020 SiFive Inc. -# SPDX-License-Identifier: Apache-2.0 - -set -euo pipefail - -if [ "$#" -lt 2 ] ; then - >&2 echo "$0: please provide project name and release tag" - exit 1 -fi - -project=$1; shift 1; -current_release=$1; shift 1; - -# Get the most recent previous tag with git-describe. If this is -# the first tag in the repository, then this will return a commit -# hash (because of the --always flag). -last_release=$(git describe --tags --always HEAD~) - -echo "# Release notes for ${project} ${current_release}" -echo "## Statistics since ${last_release}" -echo "- $(git rev-list --count ${last_release}..HEAD) commits" -echo "-$(git diff --shortstat ${last_release} HEAD)" -echo "" -echo "## Authors" -git shortlog -s -n --no-merges ${last_release}..HEAD | cut -f 2 -echo "" -echo "## Merge history" -git log --merges --pretty=format:"%h %b" ${last_release}..HEAD