From c2a72b0588b3d077e25cb70f635a044a7c0e0c5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Hurlin?= Date: Mon, 22 Apr 2024 18:09:28 +0200 Subject: [PATCH] CI: create release changelog automatically --- .github/workflows/release-upload.yaml | 6 ++++++ scripts/ci/extract-changelog.sh | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/.github/workflows/release-upload.yaml b/.github/workflows/release-upload.yaml index 18a57ff80e..f4a2a4a7a7 100644 --- a/.github/workflows/release-upload.yaml +++ b/.github/workflows/release-upload.yaml @@ -160,6 +160,7 @@ jobs: name: "Create Release" runs-on: ubuntu-latest steps: + - uses: actions/checkout@v4 # We need the repo to execute extract-changelog.sh below - uses: actions/download-artifact@v4 with: name: cardano-cli-linux # Should match (2) @@ -186,6 +187,10 @@ jobs: long_tag=${{ needs.wait_for_hydra.outputs.TARGET_TAG }} short_tag="${long_tag#cardano-cli-}" echo "SHORT_TAG=$short_tag" >> "$GITHUB_ENV" + - name: Create changelog + run: | + echo -e "# Changelog\n" > RELEASE_CHANGELOG.md + ./scripts/ci/extract-changelog.sh ${{ env.SHORT_TAG }} >> RELEASE_CHANGELOG.md - name: Create Release uses: input-output-hk/action-gh-release@v1 if: ${{ needs.wait_for_hydra.outputs.DRY_RUN == 'false' }} @@ -199,3 +204,4 @@ jobs: # All entries in 'files' below should match (3) files: | ${{ needs.wait_for_hydra.outputs.TARGET_TAG }}-linux.tar.gz + body_path: RELEASE_CHANGELOG.md diff --git a/scripts/ci/extract-changelog.sh b/scripts/ci/extract-changelog.sh index 6912e123ed..288af0401c 100755 --- a/scripts/ci/extract-changelog.sh +++ b/scripts/ci/extract-changelog.sh @@ -31,4 +31,8 @@ NUMBER_OF_LINES=$((NUMBER_OF_LINES - 1)) # Uncomment to debug # echo "Found number of lines: $NUMBER_OF_LINES" +# Piping tail doesn't play nice with "set -o pipefail" so turning it off +# See https://superuser.com/questions/554855/how-can-i-fix-a-broken-pipe-error +set +o pipefail + tail -n "+$CHANGELOG_START_LINE" "$CHANGELOG" | head -n "$NUMBER_OF_LINES"